2

Hello everybody out there,

Consider the following minimal example:

\documentclass{article}
\begin{document}
Introductive text \dots\par
\begin{tabular}{cc|cc}
  A & B123 & C & D\\
  E & F123 & G & H
\end{tabular}

Text between tables \dots\par
\begin{tabular}{c|cc}
  B & C & D\\
  F & G & H
\end{tabular}
\end{document}

The letters C & D and G & H as well as the vertical seperating line of both tables should be align above one another and the longer table (in this case the first one) should be in the middle of the page, without making the first column of the second table as wide/long as the second column of the first table.

Finally, the document should look more or less like this:

Introductive text ...

  A B123 | C D
  E F123 | G H

Text between tables ...

       B | C D
       F | G H

Thanks in advance for your help.

3 Answers 3

1

Here is my solution. Save the first table in a box and use the width of that box to create another box in which put the second table. This way both boxes will have the same width and are easier to align.

My MWE:

\documentclass{article}
\begin{document}

\newsavebox{\mytable}  % Save the first  table in a box
\savebox{\mytable}{%
\begin{tabular}{cc|cc}
  A & B123 & C & D\\
  E & F123 & G & H
\end{tabular}
}

% Now the example
\noindent\hrulefill\par % A line to see the page width
Introductive text \dots    

\begin{center}
\usebox{\mytable}  % Put the first table centered
\end{center}

Text between tables \dots

\begin{center} % Put the second table inside a box of the same width of the first one
\makebox[\wd\mytable][r]{%  The r is for "flush right" the table inside the box
\begin{tabular}{c|cc}
  B & C & D\\
  F & G & H
\end{tabular}
}
\end{center}
\noindent\hrulefill\par % A line to see the page width
\end{document}

Result

0
2

enter image description here

\documentclass{article}
\begin{document}

\noindent X\dotfill X

Introductive text \dots
\begin{center}
\begin{tabular}{ccc}
A & B & C\\
D & E & F\\[5pt]
\multicolumn{3}{c}{%
\hbox to 0pt{\hss\begin{minipage}{\textwidth}
\begin{flushleft}
Text between tables \dots

\noindent X\dotfill X
\end{flushleft}
\end{minipage}\hss}}\\[5pt]
&B & C\\
&E & F
\end{tabular}
\end{center}

\end{document}
1
  • Sorry for having not described my problem and the intended layout precisely enough. Your post would indeed yield a nice solution for the problem as described before. I edited my question to give a better explanation of the problem. Nov 30, 2012 at 9:48
2

What about:

\documentclass{article}

\begin{document}

Introductive text \dots
\begin{center}
  \begin{tabular}{ccc}
    A & B & C\\
    D & E & F
  \end{tabular}
\end{center}
Text between tables \dots
\begin{center}
  \begin{tabular}{ccc}
    \phantom{A} & B & C\\
    & E & F
  \end{tabular}
\end{center}

\end{document}

However, it may need further tricks if you have \hline's and so on...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .