我需要一本小册子,里面有针对不同目标群体的单独部分,并且标题处应该有一个标记。Gonzalo 帮助给出以下,但标题页和包含介绍和目录的页面不应该有这些标记。您能帮忙取消开始页上的这些标记吗?
\documentclass{article}
\usepackage[a6paper]{geometry}
\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}
\pagestyle{plain}
\begin{titlepage}
\centering
{\scshape\Large XYZ College \par}
\vspace{1cm}
{\scshape\Large for grade 5 to grade 8 \par}
\vspace{1.5cm}
{\huge\bfseries Math Shortlisted Problems Booklet\par}
\vspace{2cm}
{\Large\itshape John Birdwatch\par}
\vfill
\par
Dr.~Mark \textsc{Brown}
\vfill
% Bottom of the page
{\large \today\par}
\end{titlepage}
\tableofcontents
\section{Introduction }
\lipsum[1-2]
\clearpage
\section{Problem Committee}
\lipsum[1-2]
\clearpage
\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}
答案1
您必须在需要时使用 \AddToShipoutPictureBG,而不是在开始时就使用。
\documentclass{article}
\usepackage[a6paper]{geometry}
\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}%
}
\begin{document}
\pagestyle{plain}
\begin{titlepage}
\centering
{\scshape\Large XYZ College \par}
\vspace{1cm}
{\scshape\Large for grade 5 to grade 8 \par}
\vspace{1.5cm}
{\huge\bfseries Math Shortlisted Problems Booklet\par}
\vspace{2cm}
{\Large\itshape John Birdwatch\par}
\vfill
\par
Dr.~Mark \textsc{Brown}
\vfill
% Bottom of the page
{\large \today\par}
\end{titlepage}
\tableofcontents
\section{Introduction }
\lipsum[1-2]
\clearpage
\section{Problem Committee}
\lipsum[1-2]
\clearpage
\AddToShipoutPictureBG{%
\AtPageUpperLeft{%
\raisebox{-2\height}{%
\makebox[\paperwidth]{\GradeHeader}%
}%
}%
}
\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}