[Tex/LaTex] Perfectly scale line, paragraph, image, anything up to textwidth

graphicsparagraphsscaling

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: https://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.

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

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.

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

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).

\minsizebox{\textwidth}{!}{foo\\bar}

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:

\documentclass[landscape]{minimal}
\usepackage[showframe,a4paper]{geometry}
\newcommand{\vstretch}[1]{\vspace*{\stretch{#1}}}
\usepackage{adjustbox}

\begin{document}
\topskip0pt
\vstretch{1}
\minsizebox{\textwidth}{!}{foo\\bar}
%\centering\noindent\resizebox{\textwidth}{!}{!}%
\vstretch{1}
\end{document}

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

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

Best Answer

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

\begin{tabular}{@{}c@{}}
foo\\
bar
\end{tabular}

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