1

I am trying to make a table and want to set the first column with specified width, namely 1 inch. I have seen some relevant solutions, but they basically use \textwidth. Therefore I am looking if there is some simple direct solution to assign the width as 1 inch.

Below is my MWE:

\documentclass[10pt]{article}
\usepackage[margin=0.8in]{geometry}

\begin{document}
    \begin{table}[h!]
        \begin{tabular}{ll}
            1, 1 & 2, 1\\
            1, 2 & 2, 2
        \end{tabular}
    \end{table}
\end{document}
  • 1
    Have you tried p{1in} instead l? – Mensch Feb 26 at 10:37
1

You can use p{1in} instead of l.

In the following code I added | to get vertical lines for marking the printed columns.

Please see the code:

\documentclass[10pt]{article}
\usepackage[margin=0.8in]{geometry}

\begin{document}
    \begin{table}[h!]
        \begin{tabular}{|p{1in}|l|} % <====================================
            1, 1 & 2, 1\\
            1, 2 & 2, 2
        \end{tabular}
    \end{table}
\end{document}

and its result:

resulting pdf

  • Btw I find it interesting that one can use the command \newline with "p{...}" but not "l". – Salomo Feb 26 at 11:28
  • 1
    @Salomo Well, l supposes a short column entry, which needs no linebreaking. p is build to be able to break lines ... – Mensch Feb 26 at 11:31
  • May I ask a follow-up question, if I want the last column use up all the remaining space, is there something like "p{}"? – Salomo Feb 26 at 12:58
  • 1
    @Salomo Then you should use environment tabularx, see documentation on your terminal/console with texdoc tabularx. – Mensch Feb 26 at 18:47

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.