在较大的页面上打印并裁剪到较小的纸张上

在较大的页面上打印并裁剪到较小的纸张上

我有一台可以打印 A4 (297x210mm) 纸张的普通打印机,但偶尔我想打印一些最终尺寸小于 A4 的文本。为此,我认为我可以随后裁剪纸张以获得所需的纸张尺寸(为此,我用一把简单的剪刀进行裁剪)。

因此,我希望 LaTeX 能够将文档排版为较小的纸张尺寸(例如 250x180mm),但输出适用于 A4 纸的 PDF,并带有一个矩形显示纸张的裁切位置。我该如何实现呢?

答案1

这是一个必须完全删除红线的解决方案:

(专为双面打印而设计)

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{bophook}

%%%% From https://tex.stackexchange.com/a/213233/120578 to change geometry on odd and even pages
\makeatletter
\let\@@outputpage\@outputpage
\def\@outputpage{\expandafter\@thisgeometry\@@outputpage}
\def\oddgeometryeven#1#2{%
    \gdef\@thisgeometry{%
    \ifodd\thepage
        \newgeometry{#1}%
    \else
        \newgeometry{#2}%
    \fi}
}
\makeatother
% Every size is increased by 15 mm as a real margin inside desired area
\oddgeometryeven{left=15mm,right=45mm,top=15mm,bottom=62mm}{left=45mm,right=15mm,top=15mm,bottom=62mm} 
%%%% End from https://tex.stackexchange.com/a/213233/120578 to change geometry on odd and even pages

\AtBeginPage{%
\ifodd\thepage
\begin{tikzpicture}[remember picture,overlay]
    \coordinate (A) at (current page.north east);
    \coordinate (C) at (current page.south west);
    \coordinate (B) at (current page.south east);
    \draw[line width=1mm, red,inner sep=0]
    ([xshift=-29.5mm]A) -- ([yshift=46.5mm,xshift=-29.5mm]B); % Sizes to cut the page
    \draw[line width=1mm, red,inner sep=0]
    ([yshift=46.5mm]C) -- ([yshift=46.5mm,xshift=-29.5mm]B); % Sizes to cut the page
\end{tikzpicture}
\else
\begin{tikzpicture}[remember picture,overlay]
    \coordinate (A) at (current page.north west);
    \coordinate (C) at (current page.south west);
    \coordinate (B) at (current page.south east);
    \draw[line width=1mm, red,inner sep=0]
    ([xshift=29.5mm]A) -- ([yshift=46.5mm,xshift=29.5mm]C); % Sizes to cut the page
    \draw[line width=1mm, red,inner sep=0]
    ([yshift=46.5mm,xshift=29.5mm]C) -- ([yshift=46.5mm]B); % Sizes to cut the page
\end{tikzpicture}
\fi
}

\title{My Title}
\author{Me}

\begin{document}
\pagestyle{fancy}
\maketitle
\tableofcontents
\section{test}
\lipsum*[1-3]\footnote{test footnote}
\subsection{test 2}
\lipsum[1-15]
\section{test 3}
\lipsum
\end{document}

我使用了这里的答案:https://tex.stackexchange.com/a/213233/120578用于在奇数页和偶数页之间改变几何形状。

输出:

enter image description here

答案2

这是一个使用geometry包装机制的解决方案。

\documentclass{article}
\usepackage[paper=a4paper,%             % a4: 210mm by 297mm
            layoutsize={180mm,250mm},   % width,height
            layoutoffset={15mm,23.5mm}, % center on A4 page
            showcrop]%                  % show cropmarks
           {geometry}
\usepackage{lipsum}  % for filler text
\begin{document}
\lipsum
\end{document}

enter image description here

选择该选项的参数layoutoffset是为了将裁剪的(逻辑)页面置于 A4(物理)页面的中心:15mm=(210mm-180mm)/223.5mm=(297mm-250mm)/2

显然,还有其他放置选项。例如,如果您想将逻辑页面放置在物理页面的左上角,这样就不必用剪刀剪裁,您可以设置layoutoffset={0mm,0mm}-- 或者干脆完全忽略此选项,因为这0mm,0mm是参数的默认值layoutoffset

相关内容