所有页面的页眉均位于右侧

所有页面的页眉均位于右侧

我朋友给了我一个 latex 代码,其中的页眉是根据奇数页和偶数页放置的。我想要的是将所有页眉都放在右侧。我尝试了各种选项,也在论坛上尝试过,但不幸的是无法得到所需的答案。我的页眉代码是

\usepackage[headsepline]{scrpage2}

\pagestyle{scrheadings}

\clearscrheadfoot

\cfoot[\pagemark]{\pagemark}

\ohead{\headmark}

\automark[chapter]{chapter}

\renewcommand*{\chapterheadstartvskip}{\vspace*{0cm}}

\bibliographystyle{alphadin}

我真的在寻找解决我论文问题的方法。提前致谢

答案1

您的答案中的代码片段中有一些过时的类选项。用键值语法替换它们以避免警告和切换到version=first。不要使用pdftex。使用较新的 KOMA-Script 版本,您不应重新定义\chapterheadstartvskip以更改章节标题前的空间。

该包scrpage2自 2014 年起就已过时。它的后继者是scrlayer-scrpage具有类似语法的包。

根据您的代码片段的片面文档:

\documentclass[
    12pt,
    %a4paper,% <- default
    BCOR15mm,% <- syntax changed
    DIV=14,% <- syntax changed
    parskip=half,
    %twoside,
    openany,
    numbers=noenddot,
    bibliography=totoc,
    index=totoc,
    titlepage
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage[headsepline]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\automark{chapter}
\clearpairofpagestyles
\cfoot*{\pagemark}
\ohead{\headmark}

\RedeclareSectionCommand[
  beforeskip=-1sp% no vertical space before chapter title
]{chapter}

\begin{document}
\Blinddocument
\end{document}

双面文件:

\documentclass[
    12pt,
    %a4paper,% <- default
    BCOR15mm,% <- syntax changed
    DIV=14,% <- syntax changed
    parskip=half,
    twoside,
    openany,
    numbers=noenddot,
    bibliography=totoc,
    index=totoc,
    titlepage
]{scrreprt}
\usepackage{blindtext}% only for dummy text

\usepackage[headsepline]{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\automark[chapter]{chapter}
\clearpairofpagestyles
\cfoot*{\pagemark}
\rohead{\headmark}% right side on odd pages
\rehead{\headmark}% right side on even pages

\RedeclareSectionCommand[
  beforeskip=-1sp% no vertical space before chapter title
]{chapter}

\begin{document}
\Blinddocument
\end{document}

twoside如果您注释或设置,第二个示例也有效twoside=false

答案2

感谢您的建议。我刚刚从文档类中删除了“twoside”参数,它起作用了

\documentclass[
    pdftex,         
    12pt,                   
    a4paper,                                
    BCOR15mm,               
    DIV14,                  
    parskip=half,           
    %twoside,           
    openany,                
    numbers=noenddot,       
    bibliography=totoc,     
    index=totoc,
    titlepage
]{scrreprt}

相关内容