3

I would like the pieces of texts in the right column to be closer to the pieces of text in the left column. At the same time, I want the table to accommodate long pieces of text nicely, as it does now. One way to achieve this result would be to restrict the width of the left column, augment the width of the right column, and move the left margin of the right column to the left. But I do not know how to do it.

Here is a MWE of what I got so farTable:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}

\begin{document}

\begin{table}
 \centering
 \begin{tabular}{*{2}{p{.425\linewidth}}}
  \toprule
  first &  second second second second second second second second second second\\
  \midrule
  third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \\
  \bottomrule
 \end{tabular}
\end{table}

\end{document}

Thanks for your help.

  • 2
    You're probably looking for a setup like \begin{tabularx}{\linewidth}{ l X } ... \end{tabularx} (requires \usepackage{tabularx} in your preamble). – Werner Mar 19 at 15:27
  • Thanks very much. This indeed achieves the goal. – orient Mar 19 at 15:50
5

As far as I understand the question, I would try

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}

\begin{document}
\begin{table}
 \centering
 \begin{tabular}{l p{0.5\linewidth}}
  \toprule
  first &  second second second second second second second second second second\\
  \midrule
  third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \\
  \bottomrule
 \end{tabular}
\end{table}
\end{document}

to obtain

enter image description here

  • Thanks, Denis. Your solution also works and is indeed using just the package booktabs. – orient Mar 19 at 15:51
3

As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx package and to employ a tabularx environment (with overall width set to \textwidth) instead of tabular. Then, change the first column specification from p{...} to l, and change the second column specification from p{...} to X.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{tabularx} % for "tabularx" env. and "X" column type

\begin{document}

\begin{table}
\begin{tabularx}{\textwidth}{@{} l X @{}}
  \toprule
  first & second second second second second second second 
          second second second second second second second second \\
  \midrule
  third & fourth fourth fourth fourth fourth fourth fourth fourth 
          fourth fourth fourth fourth \\
  \bottomrule
\end{tabularx}
\end{table}

\end{document} 
  • Thanks very much, Mico. Your idea does provide the solution. – orient Mar 19 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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