1

I'm trying to create a poster-sized document (24"x36", 27"x40") with code listing across 10-15 columns. I've tried multicols and multicols* environments, but both end up failing once an extend gets too large in one direction or the other - multicols fails when columns need to exceed around 18" in height, and multicols* fails when the number of columns filled exceeds around 14" in width.

The failure mode is to fill up the first page and spill to a second (or multiple) pages and all but the last page will fail in the same way - typically the last page doesn't fail because the content is small enough to fit within the above constraints.

Here is an example with multicols* failing:

multicols* what's wrong with you!?

Here's an example with multicols failing:

multicols what's wrong with you?!

If I can stay within these mystery constraints, say by reducing the font size, the layout is satisfactory. I just want to be able to fill more of the page.

enter image description here

Are these dimensions too large for multicols?

UPDATE: Thanks for the early help in the comments. Here is a minimal document that contains the issue:

\documentclass{article}
\usepackage{tikz}

\usepackage{fp}
\usetikzlibrary{calc}

\usepackage[showframe]{geometry}
\geometry{paperwidth=24in,paperheight=36in,margin=2cm}

\usepackage{multicol}

% make a label command
\newcommand{\lbl}[1]{\tikz[remember picture,inner sep=0pt] \node(#1) {};}%
\newcommand{\addr}[1]{\lbl{ADDR_#1}}%
\newcommand{\data}[1]{\texttt{#1}}%
\newcommand{\op}[1]{\texttt{#1}}%

\begin{document}
\noindent
\begin{multicols}{13}

{\ttfamily\fontsize{4.5}{5}\selectfont\setlength{\parindent}{0cm}

% new block
{\hspace*{-2em}DATA\_00000107:}\\
{\hspace*{-2em}CATCH\_00000200:}\\
\addr{0x200}nop\\
bra.b \#-\$4\lbl{JMP_0x202}\\

% new block
{\hspace*{-2em}TRAP\_0000020c:}\\
\addr{0x20c}rte\\
{\hspace*{-2em}MAIN:}\\
\addr{0x20e}tst.l (\#\$a10008).l\\
bne.b \#\$6\lbl{JMP_0x214}\\
tst.w (\#\$a1000c).l\\
{\hspace*{-2em}LABEL\_0000021c:}\\
\addr{0x21c}bne.b \#\$7c\lbl{JMP_0x21c}\\
lea (\#\$7c, PC), A5\\

% a real listing has >10k additional lines

}
\end{multicols}
\end{document}

And as @ulrike-fischer pointed out, I do get Dimension too large. errors:

! Dimension too large.
\set@mult@vsize ...dima \vsize \col@number \vsize 
                                                  \advance \vsize -\@tempdim...

l.20 
   
? r
OK, entering \nonstopmode...

Underfull \hbox (badness 10000) in paragraph at lines 23--26


Underfull \hbox (badness 10000) in paragraph at lines 27--36

! Dimension too large.
\endmulticols ...@botmark }\else \ifdim \pagegoal 
                                                  =\maxdimen \ifvoid \colbre...

l.40 \end{multicols}
                  
[1{/opt/local/var/db/texmf/fonts/map/pdftex/updmap/pdftex.map}]
(./sample-listing.aux))

As @david-carlisle suggested, I did reduce the size of the document and scaled everything appropriately and I can now generate a PDF without errors. I think this will allow me to get by for now. It's odd working with such small dimensions, but ultimately the output seems scaled correctly.

enter image description here

If I'm following how multicol works, the text is rendered as if it were all in a single column first, which at 36" high reaches \maxdimen somewhere in the 7ᵀᴴ column. I hadn't thought about the "how". Does multicol* need to do this calculation as well? I suppose it needs the full dimension to find where column breaks will ultimately appear to avoid a ragged bottom on the "full" columns?

Is there a technical constraint for \maxdimen's value or way to configure to something higher?

Thanks again. This is definitely getting me closer to what I'd like the final output to look like.

4
  • 1
    Welcome to TeX.SE!. You need to provide more information about what you doing in form of small but complete document which produce showed image.
    – Zarko
    Nov 3, 2022 at 5:56
  • don't you get errors? If your columns have a height of 36in ~ 91cm, then you will exceed \maxdimen with seven columns and should get a ! Dimension too large. error. Nov 3, 2022 at 10:01
  • if you get any error you should ask about the error message not show pdfoutput (which is never intended to be usable after a error). If you are exceeding \maxdimen you could make a document half your desired size, with half size fonts, then scale up the final pdf on printing or via a pdf edit post process Nov 3, 2022 at 12:38
  • Is there a technical constraint for \maxdimen's value or way to configure to something higher? that is 2^{30}sp and baked in to the syntax and implementation and can not be changed, even in luatex Nov 4, 2022 at 9:05

2 Answers 2

0

You can make the document at quarter size, then scale using \mag at the final size

pdfinfo confirms the page is 24in (1728bp) wide even though specified to geometry as 6in

$ pdfinfo file.pdf 
...
Page size:      1728 x 2592 pts

enter image description here

\mag4000
\documentclass{article}
\usepackage{lmodern}
\usepackage[papersize={6in,9in},margin=5pt]{geometry}
\usepackage{multicol}
\begin{document}

\fontsize{1.2pt}{1.3pt}\selectfont
\begin{multicols}{15}

 \loop
  \ifnum\value{enumi}<1500
   \stepcounter{enumi}
   \roman{enumi}\par\Roman{enumi}\par\arabic{enumi}\par
   \roman{enumi}\par\Roman{enumi}\par\arabic{enumi}\par
  \repeat
\end{multicols}
\end{document}
2

The TeX primitive \setbo0=\vbox{...} is able to construct the \vbox with arbitrary height. Then you can use TeX primitive \vsplit0 in order to read a pieces of the accumulated material and set it into columns. No \maxdimen limit is reached when you are using these primitives.

I tried this with your document. I only replaced your \begin{multicols}{13} by \setbox0=\vbox\bgroup \hsize=3cm, the \end{multicols} is replaced by \egroup. Then I added a material to your columns:

\count0=1
\loop 
   \the\count0 \par 
   \advance\count0 by1 
   \ifnum\count0<10000 \repeat
   % a real listing has >10k additional lines

Finally, I added the following routine after the \endgroup. It prints the accumulated material to columns:

\hbox{\count0=1
   \loop
      \vsplit0 to\vsize
      \advance\count0 by1
      \ifnum\count0<20 \repeat
}

No \maxdimen limit was reached, 20 very long columns were printed.

1
  • +1 I did wonder about trying this, but scaling seems safer, working with over-size boxes is so fragile , you can avoid the errors, but if you breath on it tex will calculate the \ht of the box for some reason and hit the error. But it is good to flag that the error happens when/if the size of a box is accessed not when the large box is generated. Nov 4, 2022 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .