让事物正确居中的最佳方法是什么?一旦我开始乱搞桌子,事情就会开始向左或向右移动,破坏平衡。怎么能让一切都始终居中?
现在,这将导致桌子混乱,并且右边缘离开屏幕。我该怎么办?
这是大部分代码,我删除了很多无用的函数,因为它们几乎都是一样的。它用于为学校制作用例,因为我们为项目做了大约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}
答案 0 :(得分:1)
由于几个错误,我无法编译你的例子,我不确定你的意思是“让事情正常中心的最好方法”。作为一种水晶球式的答案,这就是你要找的东西吗?
\documentclass[10pt,a4paper]{article}
\usepackage{array}
\begin{document}
\begin{table}
\centering
\begin{tabular}{
| >{\centering\arraybackslash }p{4cm} |
>{\centering\arraybackslash }p{6cm} |
}
\hline
some centred text in cells & some more centred text in cells \\
\hline
centred text in cells & more centred text in cells \\
\hline
\end{tabular}
\end{table}
\end{document}
答案 1 :(得分:1)
当我们无法编译你的例子时,很难看出问题是什么。
查看您提供的代码,在这种情况下,表格可能实际上并不合适。相反,您可以尝试以下内容:
\documentclass[10pt,a4paper]{article}
\begin{document}
\subsection{Administrator Starts Server}
\paragraph{Description:} This describes the process of the adminsitrator starting the server.
\paragraph{Actors:} Administrator
\paragraph{Preconditions:} Server is not running.
\paragraph{Sequence:}
\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}
\end{document}
在您提供的示例中,我没有看到您在“可跟踪性”列中放置任何文本。要模仿此列,您可以使用\marginpar{my text}
将文本放入边距,也可以使用blahblah\hfill{}my text
右对齐与“blahblah”相同的行上的文本。如果您希望可跟踪性文本在其自己的行上右对齐,请使用\begin{flushright} my text \end{flushright}
。
如果这无法解决您的问题,请向我们提供一个编译和演示问题的最小示例。