1

使事物正确居中的最佳方法是什么?一旦我开始摆弄桌子,事情就会开始向左或向右移动,破坏平衡。怎样才能使一切始终居中?

现在这将导致桌子被弄乱,并且右边缘离开屏幕。我能做些什么?

这是大部分代码,我删掉了很多无用的功能,因为它们几乎都一样。它用于为学校制作用例,因为我们必须为一个项目做大约 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}
4

2 回答 2

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}
于 2009-02-07T07:57:13.233 回答
1

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:

\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}

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 use blahblah\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.

于 2009-02-10T01:21:46.267 回答