我怎样才能更改运行标题中章节/节号的颜色scrbook
?
梅威瑟:
\documentclass[headinclude=true]{scrbook}
\usepackage{lipsum}
\usepackage{xcolor}
\renewcommand*{\chapterformat}{%
\textcolor{red}{\thechapter}\autodot\enskip%
}
\renewcommand*{\sectionformat}{%
\textcolor{red}{\thesection}\autodot\enskip%
}
\renewcommand*{\subsectionformat}{%
\textcolor{red}{\thesubsection}\autodot\enskip%
}
\renewcommand*{\subsubsectionformat}{%
\textcolor{red}{\thesubsubsection}\autodot\enskip%
}
\begin{document}
\chapter{Things}
\section{Important things}
\lipsum[2-10]
\section{Other important things}
\lipsum[11-15]
\chapter{Other things}
\lipsum[16-20]
\end{document}
答案1
您可以在手册第 111 页找到如何重新定义标头:https://komascript.de/~mkohm/scrguien.pdf
基本上,您必须使用相同的\textcolor
命令,仅对于*mark*
命令,正如您在此处看到的:
\documentclass[headinclude=true]{scrbook}
\usepackage{lipsum}
\usepackage{xcolor}
\renewcommand*{\chapterformat}{%
\textcolor{red}{\thechapter}\autodot\enskip%
}
\renewcommand*{\sectionformat}{%
\textcolor{red}{\thesection}\autodot\enskip%
}
\renewcommand*{\subsectionformat}{%
\textcolor{red}{\thesubsection}\autodot\enskip%
}
\renewcommand*{\subsubsectionformat}{%
\textcolor{red}{\thesubsubsection}\autodot\enskip%
}
\renewcommand*{\chaptermarkformat}{%
\chapappifchapterprefix{\ }\textcolor{red}{\thechapter\autodot}\enskip}
\renewcommand*{\sectionmarkformat}{%
\textcolor{red}{\thesection\autodot}\enskip}
\renewcommand*{\subsectionmarkformat}{%
\textcolor{red}{\thesubsection\autodot}\enskip}
\begin{document}
\chapter{Things}
\section{Important things}
\lipsum[2-10]
\section{Other important things}
\lipsum[11-15]
\chapter{Other things}
\lipsum[16-20]
\end{document}