我想实现以下目标:在双面文档中,我想在偶数页上显示章节标题,在奇数页上显示节标题(如果有子节,则加上子节)。这样,对于奇数页,如果有子节,则看起来像“节-子节”,否则看起来像“节”。到目前为止,我这样做:
\documentclass[a4paper, 12pt, twoside, openright, appendixprefix, BCOR7.5mm, pointlessnumbers, bibliography=totoc, listof=totoc]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{blindtext}
\usepackage{scrpage2}
\begin{document}
\pagestyle{scrheadings}
\automark[subsection]{chapter}
\renewcommand*{\sectionmark}[1]{%
\markright{\ifnum \value{secnumdepth} >0 \sectionmarkformat\fi
#1}}%
\setheadsepline{.2pt}
\ohead{\headmark}
\chapter{Chapter 1}
\section{section}
\blindtext[15]
\chapter{Chapter 2}
\section{section}
\subsection{subsection}
\blindtext[15]
\end{document}
到目前为止,它分别显示章节和节或小节,这是可行的。现在我想同时显示章节和小节。我该怎么做?谢谢。
编辑:添加示例。
答案1
尝试这个
\documentclass[a4paper, 12pt, twoside, openright, appendixprefix, BCOR7.5mm, pointlessnumbers, bibliography=totoc, listof=totoc]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{blindtext}
\usepackage{extramarks}
\usepackage{scrpage2}
\newcommand\currentsectionmark{}
\pagestyle{scrheadings}
\automark[subsection]{chapter}
\renewcommand*{\sectionmark}[1]{%
\markright{\ifnum \value{secnumdepth} >0 \sectionmarkformat\fi
#1}\def\currentsectionmark{\ifnum \value{secnumdepth} >0 \sectionmarkformat\fi
#1}}%
\renewcommand*\subsectionmark[1]{%
\markright{\currentsectionmark\ -- \subsectionmarkformat #1}}
\setheadsepline{.2pt}
\lehead{\leftmark}
\rohead{\lastrightmark}
\begin{document}
\chapter{Chapter 1}
blub
\newpage
blub
\newpage
\section{section}
\section{section 2}
\blindtext[15]
\chapter{Chapter 2}
blub
\newpage
blub
\newpage
\section{section}
\section{section 2}
\subsection{subsection}
\blindtext[15]
\chapter{Chapter 2}
blub
\newpage
blub
\newpage
\section{section}
\subsection{subsection}
\section{section 2}
\blindtext[15]
\chapter{Chapter 2}
blub
\newpage
blub
\newpage
\section{section}
\newpage
\subsection{subsection}
\subsection{subsection 2}
\blindtext[35]
\end{document}