Being confronted with having to produce a simple poster that holds just a few letter but prints them as big as possible, I found myself needing to scale text (or a letter) on a page.
At first, I found \scalebox
, which unfortunately takes a scaling factor, and not two dimensions. Instead of trying to do math, I found \resizebox
which does take dimensions (width and height).
You could think that simply scaling up to the \textwidth
is enough, but it’s not as you can see from the following “l” which was typeset using this code:
\documentclass[ landscape, a6paper, ]{scrartcl} \usepackage[pdftex]{graphicx} \usepackage{palatino} \begin{document} \resizebox{\textwidth}{!}{l}% \end{document}
And here’s the result:
So the character doesn’t scale well in the sense that if it is too narrow, it would grow too tall. Unfortunately, it doesn’t automatically keep the aspect ratio and it doesn’t take such an argument as \includegraphic
does. Fortunately, you can still make it keep the aspect ratio by globally setting the appropriate flag! So the following will work as expected:
\documentclass[landscape]{minimal} \usepackage[showframe,a4paper]{geometry} \usepackage{graphicx} \setkeys{Gin}{keepaspectratio} \newcommand{\vstretch}[1]{\vspace*{\stretch{#1}}} \usepackage{palatino} \begin{document} \resizebox{\textwidth}{\textheight}{l}% \end{document}
Another last thing is then multiline and centered output. The awesome people over at texexchange have a solution:
\documentclass[landscape]{minimal} \usepackage[showframe,a6paper]{geometry} \usepackage{varwidth} \usepackage{graphicx} \setkeys{Gin}{keepaspectratio} \newcommand{\vstretch}[1]{\vspace*{\stretch{#1}}} \usepackage{palatino} \begin{document} \topskip0pt % This seems to fully work \vstretch{1} \centering\noindent\resizebox*\textwidth\textheight{\begin{varwidth}{\textwidth}% \centering% foooooooooooooooo \centering bar% \end{varwidth}} \vstretch{1} \pagebreak % Trying to other method with the table \vstretch{1} \centering\noindent\resizebox*\textwidth\textheight{\begin{varwidth}{\textwidth}% \begin{tabular}{@{}c@{}} foooooooooooooooo\\ bar \end{tabular}% \end{varwidth}} \vstretch{1} \end{document}