1

I'm facing an error while compiling and have already included the necessary packages. O want the three columns to be 15 % 70 % 15% respectively and the first two left aligned with the third right aligned. However, I'm facing issues compiling and checked other error troubleshoots but those solutions didn't work.

Package array Error: Illegal pream-token (1): `c' used. ...extwidth} 1{.7\textwidth} r{.15\textwidth}}
\begin{longtable}[h]{l{.15\textwidth} l{.7\textwidth} r{.15\textwidth}} 
        \textbf{Symbol} & \textbf{Description} & \textbf{Units} \\ \hline
\end{longtable}
  • 1
    l, c, and r don't take arguments like that. You should use p. – Phelype Oleinik Apr 23 at 20:12
  • [h] has nothing to do in a longtable, as it is not a float. – Bernard Apr 23 at 20:19
2

Maybe you are interested in using the W{<alignment>}{<width>} column type that was recently introduced in the array package.

\documentclass{article}

\usepackage{array}
\usepackage{longtable}
\usepackage{calc}

\begin{document}

\begin{longtable}{W{l}{.15\textwidth-2\tabcolsep} W{l}{.7\textwidth-2\tabcolsep} W{r}{.15\textwidth-2\tabcolsep}} 
        \textbf{Symbol} & \textbf{Description} & \textbf{Units} \\ \hline
\end{longtable}

\end{document} 

Please also keep in mind that I have also changed the widths of the columns as currently the table is still wider than the text width. This is due to the tabcolsep that is responsible for some horizontal white space on both sides of a cell. In order make the table as wide as the text width, I have used the calc package and used widths like 0.15\textwidth-2\tabcolsep}.

  • Thanks for the information. I was struggling with setting up the long table. – Rajath Pai Apr 24 at 9:17

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.