TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to scale a multi line text up to the available textwidth. I found something here: pgfplots: how can I scale to text width? and here: http://stackoverflow.com/questions/3106587/scale-an-equation-to-fit-exact-page-width and also, probably the most promising: How to scale a tikzpicture to \textwidth

I also want to scale a word up to the textwidth to produce a very simple poster and I'm doing something like this:

\centering\noindent\resizebox{\textwidth}{!}{Queue here!}

But that doesn't work for multi line solutions, i.e.


Would result in an error:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...
l.12 ...ent\resizebox{\textwidth}{!}{Queue\here!}

Note that the above mentioned code doesn't work as expected if the text is more high than wide, i.e.


would not fit the exclamation mark onto the page, because it will grow too tall and way beyond the page.

As mentioned in How to scale a tikzpicture to \textwidth I also tried the adjustbox package. However, the following doesn't work as expected for two reasons: Firstly, it doesn't break lines, and secondly, it makes the text grow beyond the right border (according to the paper compile with the geometry package and showframe as argument).


Just right now, I am looking for a solution that allows me to produce a poster type of document with multiple lines without wasting space, i.e. make it as big as possible. Obviously, I want to switch the paper as I usually do, namely just by changing i.e. "a4paper" into "a3paper" somewhere in the document.

Ideally, there is a generic solution that scales anything, including graphics, etc., up to the page. In my use case scenario, assuming that nothing else will be on the page is very reasonable. The ideal solution also works in corner cases like the above mentioned exclamation mark.

FWIW: Here is the code I have so far:



My fallback workflow up to now is something along the lines of:

Create a simple document, use pdfcrop and then pdfnup --nup 1x1 to scale it up.

share|improve this question
up vote 5 down vote accepted

The problem is that most multiline constructs have the current linewidth as the resulting width, so rescaling them does not make sense anyway. However, you can try the \resizebox on something like


and should have reasonable chances for success (the @{} take away the normal per-column padding).

share|improve this answer

enter image description here





foo\\ bar%

\item foo
\item bar

share|improve this answer
Nice, but unfortunately, that doesn't do the multiline example, i.e. \noindent\resizebox\textwidth!{\begin{varwidth}{\textwidth}% foo\\ bar \end{varwidth}} doesn't work – Frederick Nord May 11 '12 at 16:16
I gave a more complicated multiline example in my answer, and I have just confirmed again that \noindent\resizebox\textwidth!{\begin{varwidth}{\textwidth}% foo\\ bar% \end{varwidth}} works, I could update the code and image in the answer if need be? – David Carlisle May 11 '12 at 16:35
image/code updated to show foo\\bar scaled – David Carlisle May 11 '12 at 16:39
Sorry for not being entirely clear. It doesn't work for me in DIN A4 landscape mode. It grows too tall and the second line is not visible anymore. So it suffers from the exclamation mark problem mentioned in the question. – Frederick Nord May 11 '12 at 16:59
Code updated with scaling for textheight and width but preserving aspect ratio – David Carlisle May 11 '12 at 19:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.