
내부에 두 가지 이상의 색상이 포함된 헤드규칙을 만들고 싶습니다. 문제는 로그에 다음과 같은 경고가 표시된다는 것입니다.
pdfTeX 경고: pdflatex: 빈 컬러 페이지 스택 0이 나타납니다.
내 문서의 두 번째 페이지는 머리 규칙에 사용된 두 번째 색상으로 인쇄됩니다. 또 다른 문제는 두 번째 페이지에서 rhead가 바람직하지 않은 값으로 채워져 있다는 것입니다.
처리할 방법을 찾을 수 있지만( 을 \normalcolor
앞에 추가 하고 을 추가하여 ) 문서가 더 완전해질 때 다른 문제가 발생할까봐 두렵습니다(오류가 여전히 있기 때문에 출력만 수정됩니다). .\color
\renewcommand\headrule
\rhead{}
나는 그것에 대해 많은 검색을 수행했지만 실제로 도움이 되는 것은 없습니다.
이 경우 색상 스택을 어떻게 올바르게 관리할 수 있습니까?
사용된 코드는 다음과 같습니다.
\documentclass{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{eso-pic}
\usepackage{xcolor}
\definecolor{logoColor}{RGB}{237,162,153}
\setlength\oddsidemargin{-0.5in}% marge de gauche (référence 0 est à 1 inche)
\setlength\topmargin{-0.75in}%espace blanc au dessus du header (référence 0 est à 1 inche)
\setlength\headheight{33pt}%see in a log, to avoid further problem in some cases
\setlength\headsep{1in}
\pagestyle{fancy}
\renewcommand\headrule{
\color{logoColor}
\vspace{1pt}
\hrule height 2pt width\headwidth
\vspace{1pt}
\color{blue}
\hrule height 1pt width\headwidth
}
\chead{ref:0214-07}
\begin{document}
This is some preamble text that you enter yourself.
\section{Text for the first section}
\lipsum[1]
\subsection{Text for a subsection of the first section}
\lipsum[2-3]
\part{test}
\subsection{Another subsection of the first section}
\lipsum[4-5]
\section{The second section}
\lipsum[6]
\subsection{Title of the first subsection of the second section}
\lipsum[7]
\end{document}
답변1
직접 사용하면 \color
연속된 색상이 전체적으로 변경되므로 까다롭습니다. 이 경우 재정의된 명령 내에서 변경 사항에 \begingroup...\endgroup
대해 쌍을 사용하는 것이 더 좋습니다 . 이렇게 하면 오류 메시지가 제거되고 안전해야 합니다. 그러면 문서의 전체 색상 스택은 변경되지 않습니다. \color
\headrule
\documentclass{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{eso-pic}
\usepackage{xcolor}
\definecolor{logoColor}{RGB}{237,162,153}
\setlength\oddsidemargin{-0.5in}% marge de gauche (référence 0 est à 1 inche)
\setlength\topmargin{-0.75in}%espace blanc au dessus du header (référence 0 est à 1 inche)
\setlength\headheight{33pt}%see in a log, to avoid further problem in some cases
\setlength\headsep{1in}
\pagestyle{fancy}
\renewcommand\headrule{%
\begingroup
\color{logoColor}
\vspace{1pt}
\hrule height 2pt width\headwidth
\vspace{1pt}
\color{blue}
\hrule height 1pt width\headwidth
\endgroup
}
\chead{ref:0214-07}
\begin{document}
This is some preamble text that you enter yourself.
\section{Text for the first section}
\lipsum[1]
\subsection{Text for a subsection of the first section}
\lipsum[2-3]
\part{test}
\subsection{Another subsection of the first section}
\lipsum[4-5]
\section{The second section}
\lipsum[6]
\subsection{Title of the first subsection of the second section}
\lipsum[7]
\end{document}