# Column Width with Tabu Package

How can I set particular column widths in tabu? Here's what I have at the moment

{\tabulinesep=1.2mm
\begin{tabu}{|X|X|X|X|}
\hline
\textbf{Question} & \textbf{Solution} & \textbf{Partial Marks} & \textbf{Guidance} \\
\hline
%%%%%%%%%%%%%%% Q1 Equation of a Line
1a & $\frac{1}{2}$ & A1 & cao \\
\hline
1b & $y-\frac{1}{3}x+4=0$ & A2 & cao \\
\hline
%%%%%%%%%%%%%%% Q2 Indices
2 & $\frac{3^{2x}}{3^{2y}}=3^{2x+4}$ & M1 & Converts $9^x$ to $3^{kx}$ where $k$ is an integer \\
\hline


which gives me this

I want to fix the size of the left-hand column and third column smaller than they currently are, while ideally leaving the other two alone. Any advice would be appreciated, thanks.

• Using tabu is not a good idea. It is unmaintained and has unfixed issues: github.com/tabu-fixed/tabu#not-yet-handled Commented Feb 3, 2019 at 2:52
• To make the first and third column narrower, use the l column type instead of X. Commented Feb 3, 2019 at 2:54
• In addition to what @HenriMenke is saying: if you want to draw more attention to your question, provide us with a minimal working example that starts with \documentclass and ends with \end{document} and can be compiled.
– user121799
Commented Feb 3, 2019 at 4:32

As @HenriMenke has already pointed out in a comment, don't use the tabu package: it's buggy and it's unmaintained. Instead, I would suggest that you use the tabularx package and its eponymous environment. I would also recommend that you give the tabular material a much more open "look", mainly by omitting all vertical lines and using fewer, but well-spaced horizontal lines.

The following solution assumes that the overall width of the tabular material should be \textwidth. Since line-breaks don't seem to be useful or permissible in the first three columns, they use the l column type. Only the final column uses the X column type.

A final comment on the design of the table: Using boldface for the material in the header cells gives the table a rather "hefty" look -- but without actually improving its intelligibility and readability. If this were my table, I wouldn't boldface the words in the header row.

\documentclass{article}
\usepackage{tabularx} % for 'tabularx' environment
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule, and \addlinespace macros
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{@{} lll X @{}}
\toprule
\textbf{Question} & \textbf{Solution} &
\textbf{Partial Marks} & \textbf{Guidance} \\
\midrule
%%%%%%%%%%%%%%% Q1 Equation of a Line
1a & $\frac{1}{2}$ & A1 & cao \\
1b & $y-\frac{1}{3}x+4=0$ & A2 & cao \\
%%%%%%%%%%%%%%% Q2 Indices
2 & $\frac{3^{2x}}{3^{2y}}=3^{2x+4}$ & M1 &
Converts $9^x$ to $3^{kx}$ where $k$ is an integer \\
\bottomrule
\end{tabularx}
\end{document}

• Thanks for the advice, @Mico ! Unfortunately, I can't make the suggested changes in terms of format as I'm mimicking the format of preexisting documents. I was originally using tabularx but switched to tabu as I was having issues with the lines rows not being high enough (ie. the top and bottoms of fractions touching the hline). Do you have any suggestions how I could fix that? If so I'll definitely switch back to tabularx Commented Feb 3, 2019 at 20:25
• @CharleyRobs - If you can't (or mustn't) use the well-spaced lines of the booktabs package, you could resort to inserting typographic "struts" to force a bit more space between the lines drawn by \hline and some of your numerator and denominator terms. See this answer to the query How to add vertical space struts after hline? for more information.
– Mico
Commented Feb 3, 2019 at 20:36

The new LaTeX3 package tabularray is an alternative to the outdated tabu package. And Q[2cm] sets the column width.

\documentclass[a4paper,12pt]{report}

\usepackage{tabularray}

\begin{document}

\noindent
\begin{tblr}{colspec={Q[2cm]XQ[2cm]X},row{1}={font=\bfseries},hlines}
Question & Solution                         & Partial Marks & Guidance \\
1a       & $\frac{1}{2}$                    & A1 & cao \\
1b       & $y-\frac{1}{3}x+4=0$             & A2 & cao \\
2        & $\frac{3^{2x}}{3^{2y}}=3^{2x+4}$ & M1 & Converts $9^x$ to $3^{kx}$ where $k$ is an integer \\
\end{tblr}

\end{document}


A small variant of @L.J.R. answer (for exercise):

\documentclass[a4paper,12pt]{report}
\usepackage{amsmath}
\usepackage{array,tabularray}
\NewColumnType{C}{>{$\displaystyle}X<{$}}

\begin{document}

\noindent
\begin{tblr}{colspec={Q[2cm] C Q[2cm,c,m] X[m]},
row{1}={font=\bfseries},
rowsep=3pt,
hlines}
Question & \text{Solution}                & Partial Marks  & Guidance \\
1a       & \frac{1}{2}                    & A1             & cao \\
1b       & y-\frac{1}{3}x+4=0             & A2             & cao \\
2        & \frac{3^{2x}}{3^{2y}}=3^{2x+4} & M1             & Converts $9^x$ to $3^{kx}$ where $k$ is an integer \\
\end{tblr}

\end{document}