Setting tabular width

1,939

Assuming you want the first column 4cm wide, flush with the left margin, and the second column to take all the available space, flush with the right margin, then

\usepackage{tabularx}

in the preamble and

\noindent\begin{tabularx}{@{}p{4cm}X@{}}
$Q_r$ & Heat energy rejected \\
$Q_s$ & Heat energy supplied \\
$R$ & Real gas constant for fluid \\
\end{tabularx}

should do.

Note that a4wide is an obsolete package that shouldn't be used any more (see texdoc l2tabuen).

Share:
1,939

Related videos on Youtube

Andy
Author by

Andy

Updated on August 01, 2022

Comments

  • Andy
    Andy over 1 year

    I'm using a tabular within multicols and would like to make a table extend its second column right to the edge of the column within multicols, so the column is pushed over but the text is still left justified. The code I'm trying to use this:

    \documentclass[11pt, a4paper]{article}
    \usepackage{tikz}
    \usepackage{a4wide}
    \usepackage{multicol}
    \usepackage{amsmath}
    
    \begin{document}
    \begin{multicols*}{2}
    \section{Notation}
    \begin{tabular}{l l}
    $Q_r$ & Heat energy rejected \\
    $Q_s$ & Heat energy supplied \\
    $R$ & Real gas constant for fluid \\
    \end{tabular}
    \end{multicols*}
    \end{document}
    
    • egreg
      egreg over 11 years
      You probably want \begin{tabularx}{\columnwidth}{lX} from the tabularx package.
    • Martin Schröder
      Martin Schröder over 11 years
      @egreg: \linewidth would also work.
    • Andy
      Andy over 11 years
      @egreg How would I set that just so it worked with the second column?
    • egreg
      egreg over 11 years
      @Andy I can't understand. Do you want that the tabular extends into the second column?
    • Andy
      Andy over 11 years
      @egreg Sorry I meant so you could choose different widths for different columns, say for column one a width of 4cm and for column two a width of 8cm.