Latex 和 fancyhdr 的问题
我希望 Stackoverflow 上也欢迎 Latex 问题,因为它与编程无关。
我在使用 fancyhdr
包定义标题的正确样式时遇到问题。我想要实现的是
- 在左侧的奇数页上有以下文本“我的论文标题”
- 在右侧的偶数页上有文本“名字姓氏”
(当然用正确的文本替换)。
目前我有以下“测试”乳胶文档:
\documentclass[a4paper,12pt,T2A,oneside]{article}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage[pdfborder=0 0 0]{hyperref}
%define the header
\pagestyle{fancy}
\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}
\begin{document}
\title{My title \\}
\author{\small{Firstname Surname}}
\date{June 9, 2009}
\maketitle
\section{Introduction}
blablabla asdfasdf asdf ads fad sf
adsfadsf a fdasfd asfd
\subsection{This is a subsection}
Some text\ldots
\pagebreak
some further text
\pagebreak
some additional text
% Stop your text
\end{document}
我尝试了这部分的不同变体
\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}
,但无法使其工作。目前,文本打印在每页上,奇数页和偶数页上。我还发现 这篇 wiki 文章 描述了“ROH”等的不同含义...而且它也很清楚,但由于某种原因它对我不起作用。我必须犯一些我现在无法犯的愚蠢错误...
谢谢您的帮助!
//编辑:
Tex 发行版:gwTeX
操作系统:Mac OS X 10.5.8
I hope also Latex questions are welcome here on Stackoverflow since it's not really programming related.
I have a problem in defining the correct style for the header using the fancyhdr
package. What I'd like to achieve is to have
- On odd pages on the left side the following text "My paper title"
- On even pages on the right side the text "Firstname Surname"
(Replaced with the correct text of course).
At the moment I have the following "test" Latex document:
\documentclass[a4paper,12pt,T2A,oneside]{article}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage[pdfborder=0 0 0]{hyperref}
%define the header
\pagestyle{fancy}
\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}
\begin{document}
\title{My title \\}
\author{\small{Firstname Surname}}
\date{June 9, 2009}
\maketitle
\section{Introduction}
blablabla asdfasdf asdf ads fad sf
adsfadsf a fdasfd asfd
\subsection{This is a subsection}
Some text\ldots
\pagebreak
some further text
\pagebreak
some additional text
% Stop your text
\end{document}
I tried different variations of this part
\fancyhf{}
\fancyhf[ROH,LEH]{Firstname Surname}
\fancyhf[REH,LOH]{\bfseries My paper title}
but I can't make it work. At the moment the text is printed on each page, odd and even. I also found this wiki article which describes the different meanings of "ROH" etc... and it's also clear, but for some reason it doesn't work for me. I must make some silly mistake which I can't get right now...
Thx for any help!
//Edit:
Tex distribution: gwTeX
OS: Mac OS X 10.5.8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的
\documentclass[a4paper,12pt,T2A,oneside]{article}
指定oneside
- 即单面文章 - 因此所有标题都会由 fancyhdr 打印在所有页面上。将其更改为twoside
:请参阅 这篇文章了解有关使用此选项时可能需要如何更改页面边框的信息。
Your
\documentclass[a4paper,12pt,T2A,oneside]{article}
specifiesoneside
- that is one sided article - so all headers would get printed on all pages by fancyhdr. Change that totwoside
:See this article for information on how you might have to change page borders when using this option.
我遇到的另一个问题与
fancyhdr
没有直接关系,但可能仍然令人感兴趣的是如何修改节标题的格式。这两个链接对我帮助很大:
Another problem I encountered, which isn't directly related to
fancyhdr
, but may still be of interest is how to modify the formatting of section headers.These two links helped me a lot: