I'm using the multicol package to get two columns, but sometimes the contents is too wide in a particular column and I was wondering if there is a way to first make sure the contents will fit (horizontally) in two columns and if it doesn't just print a normal one column.

I want to do this in a new environment definition and I thought I could use the ifthen package.

  • As in David Carlisle's answer you need give an example here. Are you thinking about equations overfilling lines? If so (or presumably for figures) you could consider a widetext environment (making this conditional would be a nice little exercise).
    – Chris H
    Sep 25 '13 at 9:05

In general the answer is no, text does not have a "natural width" You specify the column width and then TeX breaks the text into lines of that width, it may have difficulty breaking some lines and make overfull boxes, but there is no certainty that if you widen the line length that will not happen somewhere else. In your particular case (you should always include a complete example document) that there are particular items such as images that you don't want to scale. It is possible to measure those items and then start or not start multicol depending on the width.

  • Thanks for the answers. This matter is about equations that sometimes get wide. Here is an example:\newenvironment[2]{ejemplo}{\par#1\par\ifthenelse{test}{\begin{multicols}{2}#2\end{multicols}}{#2}}{\par}. The problem is i can't find the right test.
    – jcis27
    Oct 2 '13 at 4:06

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.