绘制用户定义的打印边距

绘制用户定义的打印边距

如何在每页上绘制一个框(KOMA 类 srcreprt)以显示用户定义的打印边距。例如,该框应距每页边距 25 毫米(这可能与实际布局设置不同,实际布局设置可使用 \usepackage{showframe} 显示)

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{showframe}

\begin{document}

\Blinddocument

\end{document}

答案1

试试这个代码:

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\usepackage{eso-pic}

\AddToShipoutPicture{%
\begin{tikzpicture}[remember picture, overlay]
    \draw[line width=1pt]
         ($(current page.north west) +(25mm,-25mm)$)
         rectangle
         ($(current page.south east) +(-25mm,25mm)$);
\end{tikzpicture}%
}
\begin{document}

\Blinddocument

\end{document} 

输出:

在此处输入图片描述

答案2

background

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{background}
\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={%
\begin{tikzpicture}[remember picture, overlay]
\draw ([xshift=25mm,yshift=25mm]current page.south west) rectangle ([xshift=-25mm,yshift=-25mm)]current page.north east);
\end{tikzpicture}%
}
}

\begin{document}
\Blinddocument

\end{document}

在此处输入图片描述

答案3

对 karlkoeller 的代码进行一些修改后,我找到了我正在寻找的解决方案:

\documentclass{scrreprt}
\usepackage{blindtext}

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\usepackage{eso-pic}

\AddToShipoutPicture{%
\begin{tikzpicture}[remember picture, overlay]
    \draw[line width=1pt]
         ($(current page.north west) +(25mm,-25mm)$)
         rectangle
         ($(current page.south east) +(-25mm,25mm)$);
\end{tikzpicture}%
}

\begin{document}

\Blinddocument

\end{document}

相关内容