将表格和其他元素居中的最简单方法?
让事物正确居中的最佳方法是什么? 一旦我开始摆弄桌子,事情就会开始向左或向右移动,破坏平衡。 如何才能让一切始终居中呢?
现在,这将导致表格混乱,并且右边缘超出屏幕。 我能做些什么?
这是大部分代码,我删掉了很多无用的函数,因为它们几乎都是一样的。 它是为学校制作用例,因为我们必须为一个项目做大约 40 个用例。
\documentclass[10pt, a4paper]{article}
\usepackage{booktabs}
\begin{document}
\newcommand{\UCStart}[2]{
\newpage
\subsection[UC.#1]{UC.#1}
\begin{tabular}{|l|m{4in}|c|}
\hline
\textbf{UC.#1}
& \textbf{#2}
& \textbf{Traceability} \\ \hline
}
\newcommand{\UCDesc}[2]{
\textbf{Description}
& #1
& #2 \\ \hline
}
\newcommand{\UCActors}[2]{
\textbf{External Actors}
& #1
& #2 \\ \hline
}
% Snip... 40 odd more functions %
\newcommand{\UCEnd}{
\end{tabular}
}
\begin{table}[!ht]
\setlength{\extrarowheight}{2pt}
% UC 1
\UCStart{01}{Administrator Starts Server}
\UCDesc{This describes the process of the administrator starting the server}{\space}
\UCActors{Administrator}{\space}
\UCRelated{UC.02}{\space}
\UCPre{Server is not running}{\space}
\UCTrigger{Administrator wants to start the server}{\space}
\UCSeq{
\begin{enumerate}
\item Administrator boots up hardware
\item Administrator starts Administrator console
\item Administrator logins into Administrator account with the corresponding password
\item Administrator clicks start
\end{enumerate}
}{\space}
\UCPost{Conditions that must be true, in order for the use case to finish}{\space}
\UCAltSeq{
\textbf{Alternative Use Case 01} \newline
\begin{itemize}
\item UC.01.ALT.01
\item If administrator fails authentication in step 3
\begin{enumerate}
\item Notify administrator of failed authentication
\end{enumerate}
\end{itemize}
}{\space}
\UCNonFunc{ ??? }{\space}
\UCComments{ Comments Go Here }{\space}
\UCEnd
\end{table}
\end{document}
What is the best way to make things center properly? Once I start messing around with tables, things either start shifting left or right, destroying the balance. How can make it so everything is always centered?
Right now this will lead to the table being messed up, and have the right edge go off the screen. What can I do?
Here's most of the code, I cut out a lot of the useless functions, since they are all almost the same. Its for making Use Cases for school, since we got to do about 40 of these for a project.
\documentclass[10pt, a4paper]{article}
\usepackage{booktabs}
\begin{document}
\newcommand{\UCStart}[2]{
\newpage
\subsection[UC.#1]{UC.#1}
\begin{tabular}{|l|m{4in}|c|}
\hline
\textbf{UC.#1}
& \textbf{#2}
& \textbf{Traceability} \\ \hline
}
\newcommand{\UCDesc}[2]{
\textbf{Description}
& #1
& #2 \\ \hline
}
\newcommand{\UCActors}[2]{
\textbf{External Actors}
& #1
& #2 \\ \hline
}
% Snip... 40 odd more functions %
\newcommand{\UCEnd}{
\end{tabular}
}
\begin{table}[!ht]
\setlength{\extrarowheight}{2pt}
% UC 1
\UCStart{01}{Administrator Starts Server}
\UCDesc{This describes the process of the administrator starting the server}{\space}
\UCActors{Administrator}{\space}
\UCRelated{UC.02}{\space}
\UCPre{Server is not running}{\space}
\UCTrigger{Administrator wants to start the server}{\space}
\UCSeq{
\begin{enumerate}
\item Administrator boots up hardware
\item Administrator starts Administrator console
\item Administrator logins into Administrator account with the corresponding password
\item Administrator clicks start
\end{enumerate}
}{\space}
\UCPost{Conditions that must be true, in order for the use case to finish}{\space}
\UCAltSeq{
\textbf{Alternative Use Case 01} \newline
\begin{itemize}
\item UC.01.ALT.01
\item If administrator fails authentication in step 3
\begin{enumerate}
\item Notify administrator of failed authentication
\end{enumerate}
\end{itemize}
}{\space}
\UCNonFunc{ ??? }{\space}
\UCComments{ Comments Go Here }{\space}
\UCEnd
\end{table}
\end{document}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于几个错误,我无法编译您的示例,并且我不确定您所说的“使事物正确居中的最佳方法”是什么意思。 作为一种水晶球式的答案,这是您正在寻找的吗?
I can't compile your example due to several errors, and I'm not sure what you mean by "the best way to make things center properly". As a kind of crystal ball-type answer, is this what you're looking for?
当我们无法编译您的示例时,很难看出问题所在。
查看您提供的代码,表格实际上可能不适合这种情况。 相反,您可以尝试如下操作:
在您提供的示例中,我没有看到您在“可追溯性”列中放置过任何文本。 要模仿此列,您可以使用
\marginpar{my text}
将文本放在页边距中,也可以使用blahblah\hfill{}my text
放在右侧 -将文本与“blahblah”对齐在同一行。 如果您希望可追溯性文本右对齐并独占一行,请使用\begin{flushright} my text \end{flushright}
。如果这不能帮助解决您的问题,请向我们提供一个编译并演示问题的最小示例。
It is difficult to see what the problem is when we can't compile your example.
Looking through the code you provided, a table may not actually be appropriate in this situation. Instead, you might try something like the following:
In the example you provided, I don't see that you ever put any text in the "Traceability" column. To mimic this column, you could either use
\marginpar{my text}
to put text in the margin, or you could useblahblah\hfill{}my text
to right-align text on the same line as "blahblah". If you want the traceability text to be right-aligned and on its own line, use\begin{flushright} my text \end{flushright}
.If this doesn't help solve your problem, please provide us with a minimal example that compiles and demonstrates the problem.