左邊距為黑色垂直長方形

左邊距為黑色垂直長方形

我在 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

\AddToShipoutPictureBG在包的幫助下eso-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} 

輸出

在此輸入影像描述

相關內容