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.

How to justify a table column like:

\begin{table}{j j}
ab cd & ef gh\\
ij kl & mn op
\end{table}

where j stands for justified column, i.e. both right and left are aligned.

Thanks...

share|improve this question
add comment

2 Answers 2

A simple readymade solution is to use David Carlisle'’s tabulary-package. As a free bonus, you can specify the width of the tabular, and the width of the column is tailored to the width of the text.

The J-column gives you justified columns. You can also fine tune the appearance with the lengths \tymin and \tymax controlling the minimum and maximum widths of the columns, see the manual page 4.

A MWE

\documentclass{article}
\usepackage{booktabs,tabulary}
\begin{document}
\begin{tabulary}{.3\linewidth}{JJ}\toprule
  ab cd ... & ef gh ...\\
  ij kl ...& mn op ...\\
\bottomrule
\end{tabulary}
\end{document}
share|improve this answer
add comment

For this you need to specify a fixed-width column, like p{<len>}, where <len> is a known TeX length. For example,

\begin{tabular}{p{4cm}p{5cm}}
  ab cd ... & ef gh ... \\
  ij kl ... & mn op ...
\end{tabular}

Note that I use tabular and not table. The former is the structure to create the table, while the latter is a float that allows the structure to move around in your document.

Another alternative would be to place the contents of the cells inside a "justified" box, like a \parbox. However, this also requires you to specify the width:

\begin{tabular}{ll}
  \parbox{4cm}{ab cd ...} & \parbox{5cm}{ef gh ...} \\
  ij kl & mn op
\end{tabular}
share|improve this answer
add comment

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.