在我的双面文档的页眉中,作者应始终位于左侧。奇数页上的章节应位于右侧,偶数页上的子章节也应位于右侧。
我尝试使用上述代码,但子部分未显示。我该怎么做?
\documentclass[12pt, twoside=semi,BCOR=6mm, usegeometry=true]{scrartcl}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2cm, headsep=0.75cm, headheight=1cm, marginparwidth=4cm, marginparsep=0.5cm, footskip=1cm]{geometry}
\usepackage[automark]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearscrheadfoot
\cfoot{\pagemark}
\lohead{author}
\lehead{author}
\rohead[section]{subsection}
\rehead[section]{subsection}
\ihead{\headmark}
\begin{document}
\section{test}
Lorem \newpage
\subsection{test}
ipsum
\end{document}
答案1
也许你想要:
\documentclass[12pt, twoside=semi,BCOR=6mm, usegeometry=true]{scrartcl}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2cm, headsep=0.75cm, headheight=1cm, marginparwidth=4cm, marginparsep=0.5cm, footskip=1cm]{geometry}
\usepackage[automark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\cfoot{\pagemark}
\lohead{author}
\lehead{author}
\rohead{\leftmark}
\rehead{\rightmark}
\begin{document}
\section{test}
Lorem \newpage
\subsection{test}
ipsum
\end{document}
结果:
更新:
如果页眉中没有子节且页面上有新节,即使页面是偶数,也应该有该节:
\documentclass[12pt, twoside=semi,BCOR=6mm, usegeometry=true]{scrartcl}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2cm, headsep=0.75cm, headheight=1cm, marginparwidth=4cm, marginparsep=0.5cm, footskip=1cm]{geometry}
\usepackage[automark]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\automark[section]{section}% <- added
\automark*[subsection]{}% <- added
\clearpairofpagestyles
\cfoot{\pagemark}
\lohead{author}
\lehead{author}
\rohead{\leftmark}
\rehead{\rightmark}
\usepackage{lipsum}% only for dummy text
\begin{document}
\section{test}
\lipsum[1-15]
\subsection{test}
\lipsum[16-35]
\section{second section}
\lipsum[36]
\subsection{another subsection}
\lipsum
\end{document}