I'm writing some xsl
that takes xml
source and outputs a .tex
file. The source has an element that is meant to frequently become a multicols
environment in the .tex
output, and it has a cols
attribute to specify how many columns there are.
I'd like the default to be one column if no cols
attribute has been specified. But it appears that \begin{multicols}{1}
still produces two-column output. I could write the xsl
in a casewise way and skip the multicols
environment altogether when cols
is not specified (or is specified as 1
), but for the sake of consistency I'd prefer not to.
Is there any LaTeX way to get the multicols
environment to produce one-column output?
Best Answer
This solution is inspired by Werner's, but it supports the optional argument to
\begin{multicols}
and, more importantly, doesn't collect the whole contents in a single swoop, which is best to avoid, if possible. It also doesn't require changing the environment's name.