如果我创建了一个独立文档,并且它的形状大约是一张 A4 纸,我可以将其扩展以占据整页吗?将其拉伸以适合 A4 文章的尺寸?如果可能的话,只想拉伸以适合整个内容而不摆弄它。
据我所知,LaTeX PDF 具有这样的可扩展性,但我不知道 LaTeX 是否能适应。我还有其他方法可以实现这一目标,但我想先看看是否可以使用 LaTeX。
我最初不打算制作超过几张独立的小图形,但随着时间的推移,我添加了更多内容。我不想经历重组和格式化等,因为 a) 除了这个新的缩放问题外,我终于 (几乎) 完全按照我喜欢的方式制作了。并且 b) 现在做这件事会花费相当多的时间。
换句话说,它开始是“适合页面到内容”,但现在我想要“适合内容到页面”。我正在使用\tabular
,\booktabs
希望这有帮助。
以下是其独立版本的示例:
如果我强制将其恢复为文章模式,它看起来会是这样的
代码如下:
\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
您可以使用adjustbox将内容调整为接近a4。然后使用minipage将纸张尺寸强制为a4。我个人可能不会这样做,而是将带有pdfpages的文档导入另一个文档,我认为这样麻烦较少。
\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}