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
  • 1
    Have you tried p{1in} instead l?
    – Mensch
    Commented Feb 26, 2019 at 10:37

1 Answer 1

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

4
  • Btw I find it interesting that one can use the command \newline with "p{...}" but not "l".
    – Salomo
    Commented Feb 26, 2019 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
    Commented Feb 26, 2019 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
    Commented Feb 26, 2019 at 12:58
  • 1
    @Salomo Then you should use environment tabularx, see documentation on your terminal/console with texdoc tabularx.
    – Mensch
    Commented Feb 26, 2019 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .