答案1
您可以使用eso-pic
包在所需位置添加数字。使用宏保存数字并重新定义它,您可以获得所需的结果。一个小例子:
\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{eso-pic}
\usepackage{lipsum}
\newcommand\Grade{5}
\newcommand\GradeHeader{%
\fontsize{30}{36}\selectfont%
{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}\,\Grade%
\,{\color{gray!60}\vrule width 3pt}%
}
\AddToShipoutPictureBG{%
\AtPageUpperLeft{%
\raisebox{-2\height}{%
\makebox[\paperwidth]{\GradeHeader}%
}%
}%
}
\begin{document}
\section{5th Grade}
\lipsum[1-4]
\clearpage
\renewcommand\Grade{6}
\section{6th Grade}
\lipsum[1-4]
\clearpage
\renewcommand\Grade{7}
\section{7th Grade}
\lipsum[1-4]
\clearpage
\renewcommand\Grade{8}
\section{8th Grade}
\lipsum[1-4]
\end{document}
结果: