获取标题中 \chapter[]{} 的长章节

获取标题中 \chapter[]{} 的长章节

我目前正在写一本书。为此,我“定义”了自己的 chapter-command \mychapter,它只执行

\newcommand{\mychapter}[2]{\chapter[#1 -- by #2]{#1}

这是因为我想显示目录中每一章的作者。现在我想获取页眉中的标题。我知道通常我可以使用 来做到这一点fancyhdr,但那里使用了可选参数,在我的情况下是Title -- by author。但由于这对于页眉来说太长了,所以我想获取{...}页眉中的 部分。我怎样才能抑制它,以便选择可选的标题?

答案1

感谢@Skillmons 的想法,我可以创建一个可行的解决方案:

\newcommand{\chapterauthor}[1]{
    {\parindent0pt\vspace*{-30pt}
        \linespread{1.1}\Large\textbf{#1}
        \par\nobreak\vspace*{30pt}}
    \@afterheading%
}
\newcommand{\mychapter}[2]{ % chapter with name
    \thispagestyle{empty}
    \chapter[#1 --- \textit{von #2}]{#1}\chapterauthor{#2}
    \markboth{\ifnum\value{secnumdepth}>-1 
        \if@mainmatter  
            \thechapter\ 
        \fi
    \fi
    #1}{}
}

当我现在使用\leftmark-package时fancyhdr,我得到了我想要的东西。

相关内容