5

having an issue with longtabu and setting columns to a percentage of the table width. I've achieved what i want with tabularx:

\documentclass{report}

\usepackage{tabularx}
\begin{document}

\begin{tabularx}{\textwidth}{
    >{\hsize=.1\hsize}X
    >{\hsize=.1\hsize}X
    >{\hsize=.1\hsize}X
    >{\hsize=.7\hsize}X} % 70% of table width
    \hline 
    \textbf{Time End of Step} & 
    \textbf{Step} & 
    \textbf{Event} &
    \textbf{Description} 
    \\ \hline 
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
\end{tabularx}

\end{document}

then i try with tabu:

\documentclass{report}

\usepackage{longtable,tabu}
\begin{document}

\begin{longtabu} to \textwidth {
    >{\hsize=.1\hsize}X
    >{\hsize=.1\hsize}X
    >{\hsize=.1\hsize}X
    >{\hsize=.7\hsize}X} % 70% of table width
    \hline \hline
    \textbf{Time End of Step} & 
    \textbf{Step} & 
    \textbf{Event} &
    \textbf{Description} 
    \\ \hline \hline \hline \hline
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
\end{longtabu}

\end{document}

So this produces an error, saying dimension too large. Anyone know how to use this hsize in longtabu? Thanks!

10

docs for http://mirror.unl.edu/ctan/macros/latex/contrib/tabu/tabu.pdf are found here. after reviewing them. ive come up with a solution.

\documentclass{report}

\usepackage{longtable,tabu}
\begin{document}

\begin{longtabu} to \textwidth {
    X[1,c]
    X[1,c]
    X[1,c]
    X[10,l]}
    \hline \hline
    \textbf{Time End of Step} & 
    \textbf{Step} & 
    \textbf{Event} &
    \textbf{Description} 
    \\ \hline \hline \hline \hline
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
    12:18:52 & 1 & 1 & this is a description for the event \\
\end{longtabu}

\end{document}

So this is not exactly percentages but it will be good enough for what im working on. X[1,c] means its coefficient is 1 and its alignment is center. So in my above the coefficients add up to 13. so the first column will be 1/13 (7.6%) of the total table width. where as the last column will be 10/13 (76%).

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.