1

If I create a standalone document, and it's approximately the shape of an A4 piece of paper, can I expand it to take up a full page; stretch it to fit the dimensions of the an A4 article? Just want to stretch to fit the whole thing without fiddling around with it if possible.

As I understand it, LaTeX PDFs are scalable like that, but I don't know if it's something the LaTeX will accomodate. I have other ways of achieving the goal, but I'd like to see if it's possible with LaTeX first.

I didn't originally intend to do more than a couple of little standalone graphics but over time I added to it. I don't want to have to go through restructuring and formatting, etc. because a) I finally have it (almost) exactly how I like it, except for this new scaling issue. And b) it will be considerably time consuming to do it now.

In other words, it started as "fit-page-to-contents", but now I want to "fit-contents-to-page". I'm using \tabular and \booktabs if that helps.

Here's an example of what it looks like as a standalone:

enter image description here

Here's what it look's like if I force it back into article mode

enter image description here

Here's the code:

\documentclass[margin=6]{standalone}
\usepackage{amsmath,tikz,booktabs,array}
\begin{document}
\begin{tabular}{c|c}
\midrule
\multicolumn{2}{c}{\scshape Head Section} \\
\midrule
\begin{tikzpicture}
\draw (0,0)--(1,1);
\end{tikzpicture}
&
\begin{tikzpicture}
\draw (0,0)--(1,1);
\end{tikzpicture} \\
$\alpha$&$\alpha$ \\ 
\midrule
\multicolumn{2}{c}{\scshape Section One} \\
\midrule
$\begin{gathered}
\textsc{Left Side}  \\
\midrule
  \begin{aligned}
  X(x)&=(1,0,1,0,1) \\
  Y(y)&=(1,0,1,0,1) \\
  \midrule
  \delta&=0 \ \ |  \ \ 
  \Delta=0 \\
  \end{aligned}
\end{gathered}$ &
$\begin{gathered}
\textsc{Right Side} \\
\midrule
  \begin{aligned}
  X(x)&=(1,0,1,0,1) \\
  Y(y)&=(1,0,1,0,1) \\
  \midrule
  \delta&=0 \ \ |  \ \ 
  \Delta=0 \\
  \end{aligned}
\end{gathered}$
\\
\midrule
\multicolumn{2}{c}{\scshape Section Two} \\
\midrule
$\begin{gathered}
\textsc{Xx \& Yy} \\
\midrule
  \begin{aligned}
  xyxyxy \ 
  xyxyxy \\
  \end{aligned}
\end{gathered}$ &
$\begin{gathered}
\textsc{Xx \& Yy} \\
\midrule
  \begin{aligned}
  xyxyxy \ 
  xyxyxy \\
  \end{aligned}
\end{gathered}$
\\
\midrule
\multicolumn{2}{c}{\scshape Section Three} \\
\midrule
\multicolumn{2}{c}{$\Omega$} \\
\multicolumn{2}{c}{$\xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}$} \\
\multicolumn{2}{c}{$\xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}$} \\
\midrule
\multicolumn{2}{c}{\scshape Tail Section} \\
\midrule
\multicolumn{2}{c}{%
$\begin{array}{@{} c *{5}{@{} >{{}}c<{{}} @{} c @{}} } 
\ \  \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ 
       & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \\
\ \  \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ 
       & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \\
\end{array}$%
} \\
\bottomrule[\lightrulewidth]
\end{tabular}
\end{document}
  • 1
    Why do you want to use standalone when the size is as large as an A4 paper? Don't overuse standalone! – user156344 Mar 30 at 6:45
  • 1
    Well you can box the content and scale the box. The easiest way would to use adjustbox with width=210mm, height=297,keepaspectratio – Martin Scharrer Mar 30 at 6:50
  • 1
    I wouldn't scale the content - this could distort it - but put eg a minipage of the right size around it. – Ulrike Fischer Mar 30 at 8:49
  • 1
    I certainly know how to do it. But you didn't provide a complete minimal example so don't expect code from me. – Ulrike Fischer Mar 30 at 9:41
  • 1
    Better. Beside others it helped me to see that I misunderstood the question. I thought the content is already nearly a4. But as it is quite small you will have to resize the box too as Martin suggested. I will add some code. – Ulrike Fischer Mar 30 at 16:40
2

You can use adjustbox to resize your content to nearly a4. And then use a minipage to force the papersize to be exactly a4. Personally I probably wouldn't do it like this but import the document with pdfpages in another document, imho this is less trouble.

\documentclass[]{standalone}
\usepackage{amsmath,tikz,booktabs,array}
\usepackage{adjustbox}
\begin{document}
\begin{minipage}[t][29.7cm][c]{21cm}
\vspace{0pt}\centering
\adjustbox{max totalheight=29.7cm}{\adjustbox{min width=21cm}{%
\begin{tabular}{c|c}
\midrule
\multicolumn{2}{c}{\scshape Head Section} \\
\midrule
\begin{tikzpicture}
\draw (0,0)--(1,1);
\end{tikzpicture}
&
\begin{tikzpicture}
\draw (0,0)--(1,1);
\end{tikzpicture} \\
$\alpha$&$\alpha$ \\
\midrule
\multicolumn{2}{c}{\scshape Section One} \\
\midrule
$\begin{gathered}
\textsc{Left Side}  \\
\midrule
  \begin{aligned}
  X(x)&=(1,0,1,0,1) \\
  Y(y)&=(1,0,1,0,1) \\
  \midrule
  \delta&=0 \ \ |  \ \
  \Delta=0 \\
  \end{aligned}
\end{gathered}$ &
$\begin{gathered}
\textsc{Right Side} \\
\midrule
  \begin{aligned}
  X(x)&=(1,0,1,0,1) \\
  Y(y)&=(1,0,1,0,1) \\
  \midrule
  \delta&=0 \ \ |  \ \
  \Delta=0 \\
  \end{aligned}
\end{gathered}$
\\
\midrule
\multicolumn{2}{c}{\scshape Section Two} \\
\midrule
$\begin{gathered}
\textsc{Xx \& Yy} \\
\midrule
  \begin{aligned}
  xyxyxy \
  xyxyxy \\
  \end{aligned}
\end{gathered}$ &
$\begin{gathered}
\textsc{Xx \& Yy} \\
\midrule
  \begin{aligned}
  xyxyxy \
  xyxyxy \\
  \end{aligned}
\end{gathered}$
\\
\midrule
\multicolumn{2}{c}{\scshape Section Three} \\
\midrule
\multicolumn{2}{c}{$\Omega$} \\
\multicolumn{2}{c}{$\xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}$} \\
\multicolumn{2}{c}{$\xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}\ \ \ \ \ \ \xleftarrow{}
        \ \ \ \ \ \ \xleftarrow{}$} \\
\midrule
\multicolumn{2}{c}{\scshape Tail Section} \\
\midrule
\multicolumn{2}{c}{%
$\begin{array}{@{} c *{5}{@{} >{{}}c<{{}} @{} c @{}} }
\ \  \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \
       & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \\
\ \  \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \
       & \ \ \ \ & \ \to \ & \ \ \ \ & \ \to \ & \ \ \ \\
\end{array}$%
} \\
\bottomrule[\lightrulewidth]
\end{tabular}}}
\end{minipage}

\end{document} 
  • Thanks. I'll try it. Can you show the alternative too? The way you said you'd do it? I'll try it both ways and share the results. – voices Mar 31 at 15:53

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.