tags:

views:

146

answers:

2

Okay so what is the best way to make things center properly? Once i start messing around with tables, things ether start shifting left or right, destroying the balance. How can i 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?

Heres most of the code, i cut out alot of the useless functions, since they are all almost the same. Its for making Use Cases for school, since we gotta 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}
+1  A: 

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?

 \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}
Will Robertson
+1  A: 

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.

godbyk