左边距有黑色垂直矩形

左边距有黑色垂直矩形

我在 A5 纸上打印文档。我有一个带页眉和页脚的模板。现在,我的激光打印机在左边距上留下了黑色标记,破坏了页面。我如何在左边距上画一条 5 毫米宽的黑色垂直条纹来隐藏这些标记?

答案1

background包。

\documentclass[a5paper]{article}

\usepackage{background}
\usetikzlibrary{calc}
\newsavebox\mybox
\sbox\mybox{%
\begin{tikzpicture}[remember picture]
    \fill[black] (current page.north west) rectangle ($(current page.south west) +(5mm,0)$);
\end{tikzpicture}%
}
\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={%
\begin{tikzpicture}[remember picture, overlay]
    \node[anchor=west] at  (current page.west) {\usebox{\mybox}};
\end{tikzpicture}%
}
}
\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document} 

在此处输入图片描述

答案2

借助\AddToShipoutPictureBGeso-pic,我们在每一页的出口处画一个黑色矩形。

平均能量损失

\documentclass[a5paper]{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
    \fill[black] (current page.north west) --
                 ($(current page.north west) +(5mm,0)$) --
                 ($(current page.south west) +(5mm,0)$) --
                 (current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document} 

输出

在此处输入图片描述

相关内容