\documentclass[
10pt, % Main document font size
a4paper, % Paper type, use 'letterpaper' for US Letter paper
oneside, % One page layout (no page indentation)
%twoside, % Two page layout (page indentation for binding and different headers)
headinclude,footinclude, % Extra spacing for the header and footer
BCOR5mm, % Binding correction
]{scrartcl}
\input{structure5.tex} % Include the structure.tex file which specified the document structure and layout
\hyphenation{Fortran hy-phen-ation} % Specify custom hyphenation points in words with dashes where you would like hyphenation to occur, or alternatively, don't put any dashes in a word to stop hyphenation altogether
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{multirow}
\usepackage{color}
%----------------------------------------------------------------------------------------
% HEADERS
%----------------------------------------------------------------------------------------
\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{~#1}}} % The header for all pages (oneside) or for even pages (twoside)
%\renewcommand{\subsectionmark}[1]{\markright{\thesubsection~#1}} % Uncomment when using the twoside option - this modifies the header on odd pages
The header style
\lehead{\mbox{\llap{\small\thepage\kern1em\color{halfgray} \vline}\color{halfgray}\hspace{0.5em}\rightmark\hfil}} % The header style
\pagestyle{scrheadings} % Enable the headers specified in this block
我尝试用“黑色”替换“半灰色”,但没有任何反应。
谁能帮我 ?
谢谢
答案1
你的问题不是颜色。对于 opion oneside
Koma-script 使用\lohead
、\cohead
和\rohead
。但是\lehead
、\cehead
和\rehead
未被使用。因此,用它替换\lehead
应该\lohead
可以工作:
\documentclass[
10pt, % Main document font size
a4paper, % Paper type, use 'letterpaper' for US Letter paper
oneside, % One page layout (no page indentation)
%twoside, % Two page layout (page indentation for binding and different headers)
headinclude,footinclude, % Extra spacing for the header and footer
BCOR5mm, % Binding correction
]{scrartcl}
%\input{structure5.tex} % we don't have this file!
\usepackage{color}
\usepackage{scrpage2}
\usepackage{lipsum}
%----------------------------------------------------------------------------------------
% HEADERS
%----------------------------------------------------------------------------------------
\renewcommand{\sectionmark}[1]{\markright{{~#1}}} % \spacedlowsmallcaps removed, package for this unknown
\clearscrheadings % to clear all header and foot parts
\lohead{\mbox{\llap{\small\thepage\kern1em\color{red} \vline}\color{red}\hspace{0.5em}\rightmark\hfil}} % color halfgray is undefined
\pagestyle{scrheadings} % Enable the headers specified in this block
\begin{document}
\section{Lipsum 1}
\lipsum
\end{document}
如果这没有帮助,你需要向我们提供适当的最小工作示例(MWE),这样可以显示您的问题,而无需我们猜测要使用哪些包。另外,请将加载的包减少到最低限度。
答案2
由于使用了,\spacedsmallcaps
我假设包scrlayer-scrpage
已加载。此包是已弃用的包的后继包scrpage2
。
所以我会使用:
\documentclass[
10pt,
%a4paper,% default
%oneside,% default
%twoside,
headinclude,footinclude,
BCOR=5mm, % changed syntax!!
]{scrartcl}
\usepackage{lipsum}% only for dummy text
\usepackage[nochapters]{classicthesis}
\usepackage{color}
\clearpairofpagestyles
\ohead{%
\ifodd\value{page}%
\mbox{\rightmark\hspace{0.5em}\rlap{\vline\kern1em\pagemark}}%
\else
\mbox{\llap{\pagemark\kern1em\vline}\hspace{0.5em}\rightmark}%
\fi
}
\addtokomafont{pagenumber}{\small}
\addtokomafont{pagehead}{\color{red}}
\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{~#1}}}
\begin{document}
\section{Lipsum 1}
\lipsum[1-20]
\end{document}
结果:
如果你启用twoside
:
如果标题不应该与文本区域的内部对齐,而是与外部边缘对齐,则可以替换\ohead{...}
为
\ihead{%
\ifodd\value{page}%
\mbox{\llap{\pagemark\kern1em\vline}\hspace{0.5em}\rightmark}%
\else
\mbox{\rightmark\hspace{0.5em}\rlap{\vline\kern1em\pagemark}}%
\fi
}
单面文档的结果:
与twoside
: