Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I currently have a table which has 2 columns: the left one is right-justified and the right one is left-justified. I'd like to center the table relative to between the two columns: that is, have the divider between the 2 columns in the center of the page. How would I do this?

share|improve this question
    
Can you post an example of the table and the current column specifications you use? –  Werner May 26 '12 at 1:48

1 Answer 1

Here's one way of doing it if you know the widths of the columns (via a paragraph style):

enter image description here

\documentclass{article}
\usepackage{showframe}% http://ctan.org/pkg/shoframe
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\noindent
\makebox[\linewidth][c]{%
\hspace*{5cm}%
\begin{tabular}{p{4cm}|p{5cm}}
  \raggedleft\lipsum[2] & \raggedright\lipsum[3]
\end{tabular}%
\hspace*{4cm}%
}
\end{document}

The idea is that you place everything in a centred box with column-equivalent spaces around it. In the above example, showframe was used to identify the text block boundaries and highlight the tabular alignment.

The above would also hold without problem if you currently have an r|l column specification. In that instance, rather use

\usepackage{array}% http://ctan.org/pkg/array
%...
\noindent
\begin{tabular}
  {>{\raggedleft\arraybackslash}p{\dimexpr.5\linewidth-2\tabcolsep-.5\arrayrulewidth}|
   >{\raggedright\arraybackslash}p{\dimexpr.5\linewidth-2\tabcolsep-.5\arrayrulewidth}}
  % <tabular content>
\end{tabular}

The additional \arraybackslash corrects the usage of \\, redefined by formatting commands like \raggedleft and \raggedright (amongst others).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.