如何添加标题和作者

如何添加标题和作者

我怎样才能添加所谓的“跑步“每页顶部显示标题和作者姓名?这一功能通常用于期刊,以便简短的运行标题显示在顶部奇怪的页面和连载作者名称显示在偶数页上。

在日记样式文件中,他们通常提供\titlerunning\authorrunning命令来快速完成此操作,但我如何自己添加它们?

并且,添加一行将该运行标题与页面的其余部分分隔开也是非常好的(几乎是必要的)。

答案1

尝试fancyhdr 包。最简单的方法是手动设置标题。

\documentclass{article}
\title{Owl stretching time}
\author{M Python}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{M Python}
\rhead{Owl stretching time}
\begin{document}
\maketitle
abc
\newpage
def
\newpage
\end{document}

\author使用和给出的参数\title稍微困难一些,因为\maketitle执行 时这些参数会被清除。但是,您可以使用 进行复制\let

\documentclass{article}
\title{Owl stretching time}
\author{M Python}
\usepackage{fancyhdr}
\pagestyle{fancy}
\makeatletter
\let\runauthor\@author
\let\runtitle\@title
\makeatother
\lhead{\runauthor}
\rhead{\runtitle}
\begin{document}
\maketitle
abc
\newpage
def
\newpage
\end{document}

答案2

我必须将这些答案的不同部分拼凑在一起才能得到我需要的东西。双面、双栏、左右页眉交替,第一页没有页眉。还有双面行号。您可以稍后随意插入标题,但这个想法是,您不会希望页眉覆盖在标题上。

\documentclass[twocolumn,twoside]{article}
% Line numbers package
\usepackage[switch,columnwise]{lineno}
% Creates example text
\usepackage{lipsum} 
% Headers
\usepackage{fancyhdr}
\pagestyle{fancy}
\thispagestyle{empty}
\fancyhead[LO]{My Running Title for Header}
\fancyhead[RE]{2013 Firstauthor and Secondauthor}
\begin{document}
\linenumbers
\lipsum[1-20]
\end{document}

这只是对这里已经给出的优秀答案的扩展。而且它有效。

相关内容