格式化页眉和页码

格式化页眉和页码

我希望你能帮助我做一些相当简单的事情:

  1. 我想删除文档第一页的编号,但不删除页眉。

  2. 标题必须始终相同,现在第二页显示“参考文献”。

\documentclass[twoside,parskip=half,numbers=noendperiod,abstract=true]{scrartcl}
\usepackage[british]{babel}

%Bibliography
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{Bibliography-APA_w_header.bib}

\usepackage[utf8]{inputenc}
\usepackage[pdftex]{graphicx}    
\usepackage{microtype,textcomp}
\usepackage[a4paper,left=25mm,right=25mm,top=25mm,
bottom=25mm, headsep=10mm]{geometry} 

\usepackage{multicol} 
\usepackage{hyperref} 
\usepackage{paralist}
\usepackage{blindtext}

\renewcommand*{\thesection}{\Roman{section}.} 
\renewcommand*{\thesubsection}{\arabic{subsection}}

\setkomafont{title}{\normalfont\LARGE\bfseries}
\setkomafont{subtitle}{\normalfont\Large\bfseries}
\setkomafont{subsection}{\normalfont\large\bfseries}
\setkomafont{subsubsection}{\normalfont\large}
\setkomafont{author}{\normalfont\large}

%Header
\usepackage{scrlayer-scrpage} 
\pagestyle{scrheadings} 
\ihead{}\ohead{}\chead{\headmark}
\setkomafont{pageheadfoot}{\normalfont}
\markboth{Title \textbullet{} Course \textbullet{} 2015}
{Title \textbullet{}
Course \textbullet{} 2015} 

\KOMAoptions{headsepline=true}

\title{Elbør, Jancka und dann Zickler}
\subtitle{Subtitle of the paper}

\author{\textsc{Name Surname}\\[2ex]
\normalsize Unversity Name\\ 
\normalsize \href{mailto:[email protected]}{[email protected]}}
\date{}

\setlength{\skip\footins}{11mm}

\begin{document}
\maketitle
\thispagestyle{scrheadings}
\unskip\vspace{-1.5\baselineskip}

\begin{abstract}
\KOMAoptions{parskip=half}
\noindent Er hörte leise Schritte hinter sich. Gerade jetzt, wo er das Ding \parencite{book} seines Lebens gedreht hatte und mit der Beute verschwinden wollte! Hatte einer seiner zahllosen Kollegen dieselbe Idee gehabt, ihn beobachtet und abgewartet, um ihn nun um die Früchte seiner Arbeit zu erleichtern? Weil wir haben gesehen viele Male solche Spiel! Oder gehörten die Schritte \parencite{web-noauthor-nodate} hinter ihm zu einem der unzähligen Gesetzeshüter dieser Stadt. Die Schritte wurden lauter und lauter, er sah eine dunkle Gestalt \parencite{web-noauthor-date} um die Ecke biegen. Fieberhaft irrten seine \parencite{web-author-nodate} Augen durch die nächtliche Dunkelheit und suchten einen Ausweg. War jetzt wirklich alles'' Danke. Offensiv, offensiv ist wie machen wir in Platz \parencite{web-author-date}. Wir haben gesehen viele Male solche Spiel! \parencite{blog-date}.
\end{abstract}
\vspace{7mm}

\begin{center}
\textbf{Keywords}: assignment \textperiodcentered{} project \textperiodcentered{} keyword
\end{center}

\medskip
\setlength\columnsep{24pt}
\begin{multicols}{2} % Two-column layout throughout the main article text

\section{Introduction}
\subsection{Subsection}
\blindtext\par
\blindtext\par
\blindtext\par
\blindtext\par

\printbibliography

\end{multicols}
\end{document}

答案1

标题更改的主要问题是您将其设置为\headermark。因此,更新\headermark会相应地更新标题。相反,将 设置为某个不依赖于任何其他内容的固定值。

您可以在页眉/页脚中设置一个条件,以便根据页码打印内容:

\chead{Title \textbullet{} Course \textbullet{} 2015}
\ofoot{%
  \ifnum\value{page}>1 \thepage\fi}

上面的代码在任何地方都打印相同的页眉,并且仅打印页脚文本第 1 页。当然,您可以决定哪些页眉/页脚内容是有条件的。


建议对第一页使用不同的页面样式。然后,将整个文档的页面样式设置为scrheadings第一\thispagestyle{firstpage}页的页面样式:

\newpagestyle{firstpage}
  {{}{\makebox[\linewidth]{Title \textbullet{} Course \textbullet{} 2015}}{}}% header content
  {{}{}{}}% (Remove) footer content
\chead{Title \textbullet{} Course \textbullet{} 2015}
\ofoot{\thepage}

%...

\pagestyle{scrheadings}% Entire document page style
\thispagestyle{firstpage}% First page page style

答案2

您可以设置scrlayer-scrpage选项manualmark,让每页都使用相同的页眉,即使\headmark使用了。但直接设置更简单\chead*

该包scrlayer-scrpage将页面样式设置为scrheadings自动。

\usepackage{scrlayer-scrpage} 
\clearpairofpagestyles
\chead*{Title \textbullet{} Course \textbullet{} 2015}
\cfoot*{\pagemark}
\setkomafont{pageheadfoot}{\normalfont}

firstpage您可以通过克隆简单地定义新的页面样式scrheadings

\newpairofpagestyles[scrheadings]{firstpage}{\cfoot*{}}

\thispagestyle{firstpage}然后在第一页上使用。

请注意\chead*{<text>}\cfoot*{\pagemark}需要 KOMA-Script 3.14 或更高版本。对于 3.12 或 3.13 版本,使用\chead[<text>]{<text>}\cfoot[\pagemark]{\pagemark}可获得与 pagestyleplain和相同的页眉和页脚scrheadings

答案3

\chead*{Whatever you want to have as your header}与最新的 KOMA 包一起使用。

\clearpairofpagestyles
\cfoot[]{\pagemark}
\chead*{Whatever you want to have as your header}

实际上,第一个命令会重置所有字段并清除它们。第二个命令会用页码设置中央页脚字段,纯文本页面除外,因为纯文本页面实际上在文章文档中并不常用。您必须使用 @Werners 的解决方案。第三个命令会设置静态页眉,同样适用于纯文本页面。正如 Werner 已经解释的那样,\headmark它会动态更新。

相关内容