0

I'm dealing with a large table in my thesis.

I currently have four columns in my table, with small numbers in the 1st and 4th columns and long(ish) text in columns 2 and 3. Therefore I want columns 1 and 4 to be narrower than 2 and 4.

I have referred to the tabularx (I've been told it is also applicable to xltabular) documentation where it says:

{>{\hsize=.5\hsize\linewidth=\hsize}X
>{\hsize=1.5\hsize\linewidth=\hsize}X}

to change the X column sizes, but how would I do this for four columns?

My current table uses the following:

\begin{xltabular}{\linewidth}{XXXX}
\hline
    \thead{Approx. \\ Raman shift\\ $(cm^{-1})$} & \textbf{Assignment} & \thead{What does this \\ mean for bone?} & \textbf{References} \\ \hline

Main body of table \end{xltabular}

I have referred to Table layout with tabularx (column widths: 50%|25%|25%), but it didn't help.

Many thanks

  • You could use `{>{\hsize=.5\hsize\linewidth=\hsize}X

    {\hsize=1.5\hsize\linewidth=\hsize}X >{\hsize=1.5\hsize\linewidth=\hsize}X >{\hsize=.5\hsize\linewidth=\hsize}X}. This will give you two pairs of equally wide columns with the wider pair having 3 times the width of the narrower column. Make sure the numbers add up to the number ofX` type columns (0.5+1.5+1.5+0.5=4)

    – leandriis Jul 24 '20 at 20:37
  • @leandriis ah hello again! Ahh that makes sense. Would this go in the preamble before \begin{document} or inside the table code somewhere? – Sammie Davies Jul 24 '20 at 20:40
  • This is supposed to replace {XXXX}. As you can see, >{\hsize=0.5\hsize\linewidth=\hsize} is added in fromt of the first and the last X type column. – leandriis Jul 24 '20 at 20:42
  • @leandriis oh of course! Thank you again for being so patient with my silly questions! My thesis is looking much better thanks to you!! – Sammie Davies Jul 24 '20 at 20:46
  • Is there a way to centre the information in these columns? – Sammie Davies Jul 24 '20 at 21:13
  • Assuming that you refer to horizontally centered contents, you can add \centering\arraybackslash as in >{\hsize=.5\hsize\linewidth=\hsize\centering\arraybackslash}X and likewise for the wider columns. – leandriis Jul 24 '20 at 21:20
  • If you want to adapt this format to multiple columns, it might be beneficial to define your own custom column command as \newcolumntype{Z}[1]{>{\hsize=#1\hsize\linewidth=\hsize\centering\arraybackslash}X}. You can later use it as follows: \begin{xltabular}{\textwidth}{Z{0.5}Z{1.5}Z{1.5}Z{0.5}}. – leandriis Jul 24 '20 at 21:23
  • What kind of citation style do you use? Is it a numeric one? Do you need linebreaks in the cells of the 4th column? You mentioned needing a narrow 4th column, so probably it is just easier to use \begin{xltabular}{\linewidth}{lXXl} instead of having to worry about changing the relative widths of the columns. – leandriis Jul 25 '20 at 10:17

0 Answers0