1

I have the following newenvironment defined using tabularx

\newenvironment{factlist}{%
    \newdimen\unbaseline
    \unbaseline=\dimexpr-\baselinestretch\baselineskip\relax
    \renewcommand\item[2]{%
    \textsc{##1} & {\raggedright ##2\smallskip\\}\\[\unbaseline]}
    \tabularx{\linewidth}{rX}}
    {\endtabularx}

I use it as follows:

\begin{factlist}
\item{A}{aaaa}
\item{B}{bbbb}
...
\item{Z}{zzzz}
\end{factlist}

Trouble is, the "factlist" does not split across pages. I believe this is because tabularx does not fit across pages.

I figured that "longtabu" from the "tabu" package has the same syntax as tabularx. However, I am not able to replace \tabularx and \endtabularx with \begin{longtabu} and \end{longtabu} in newenvironment. It throws a Runaway argument exception.

I am new to Latex. It would be nice if you could help me getting this code to work.

I am open to other methods as well, since all I want to do is BE ABLE TO SPLIT THE "FACTLIST" ACROSS PAGES!

  • In any case, \newdimen should be outside the environment. You declare a dimen, and then set it every time with the environment. But there's no reason to (in fact you can't) declare a new dimen everytime you use the environment. – Manuel Nov 30 '14 at 20:41
2

It is almost always better to set these things as a list:

\documentclass{article}
\newenvironment{factlist}{%
\begin{enumerate}
\renewcommand\labelenumi{\textsc{\Alph{enumi}}}}
{\end{enumerate}}
\begin{document}

\begin{factlist}
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\item One two three four five.
\end{factlist}

\end{document}

the exact list parameters can be tuned to the exact requirements,

  • I've used \textsc as in the question but it's an almost unnoticable font change on capital letters. – David Carlisle Nov 30 '14 at 20:54
  • The question is not about \textsc at all. This tex script is taken from a template for a resume. And using \textsc is relevant in that context. Also, your reply isn't exactly what I was looking for. I am aware that I can use \item, but I need a table to ensure proper alignment, etc in the resume. – P.C. Nov 30 '14 at 23:44
  • @P.C. yes that's why I relegated the \textsc to a comment. It would be very surprising if you can not get the alignment that you need using a list based layout. But it's your document and only you know the requirements that you have, – David Carlisle Dec 1 '14 at 0:36

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.