1

I need to set up a table with three columns.

The first two columns have a width of 7.2 cm and the last has a width of 1.5 cm.

I would like text in the first row of the columns to be centred, but then the text in the first and third columns will remain centred, but the second column is aligned to the left.

I tried the tabularx suggestion on here, but can't set the column widths, let alone see how I can change the second column to left aligned.

13
  • 1
    Could you please add a screenshor of the desired output as well as a minimal working example (MWE) that show what you tried so far?
    – leandriis
    Oct 9, 2019 at 6:44
  • 1
    Please also clarify: Is ist just the contents of the first row in every column that you want to horizontally center or do you want to horizontally center all rows of a specific column?
    – leandriis
    Oct 9, 2019 at 6:45
  • 1
    Also, are you sure that our textwidth is larger than 15.9 cm? Otherwise your table will overflow into the right margin.
    – leandriis
    Oct 9, 2019 at 6:47
  • 1
    15.9cm + 6\tabcolsep!
    – Bernard
    Oct 9, 2019 at 10:34
  • 1
    \multicolumn{1}{c|}{Column 2}should work.
    – leandriis
    Oct 9, 2019 at 14:09

1 Answer 1

1

Various alignment in tables is very easy with tblr environment of tabularray package:

\documentclass{article}

\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{tabularray}

\begin{document}

\begin{table}[h]
\centering
\begin{tblr}{
  colspec = {Q[7.2cm,c]|Q[7.2cm,l]|Q[1.5cm,c]},
  row{1} = {c}, hlines,
}
  Column 1 & Column 2 & Col 3 \\
  The text in this column needs to be centred and allow for text wrapping and will include equations
           & Text in this column needs to be aligned to the left and needs to allow for text wrapping
                      & no wrap \\
\end{tblr}
\end{table}

\end{document}

enter image description here

You must log in to answer this question.

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