我还没有找到解决这个问题的方法。在使用 BibTeX 之前,我使用 来设置参考书目的样式fancyhdr
,这种方法很有效。我能够将其直接写入参考书目环境中:
\begin{thebibliography}{9}
\setcounter{page}{5}
\thispagestyle{fancy}
\bibitem{marketing}
Armstrong, Kotler, Saunders, Wong (2007):
Grundlagen des Marketing,
Pearson Education Deutschland GmbH,
München 2007
\end{thebibliography}
我现在改用 BibTeX。检查 BibTeX 命令\bibliography{}
,我发现它“只是”从 .bbl
文件中输入文本。在那里可以找到环境定义。但这对我没有帮助。
我如何使用 定义我的参考书目的标题fancyhdr
?如果不可能,我该如何以其他方式定义它们?
如果您提供的宏能满足我的需求,请告诉我在哪里可以找到这些功能,以便我下次自己编写。我有时会通过 查找命令\show\mycommand
。有没有更有效的方法?
我已经有正确的 fancyhdr 定义,但我不知道如何将其应用到我的 BibTeX 书目中。
我想申请这个...
\pagenumbering{roman}
\setcounter{page}{5}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
... 所有内容:
\bibliography{mybibfile}
我正在使用natbib
。我的fancyhdr
定义适用于文档的其他每个部分。
更新:最小工作示例 它并不是那么简单,但是它产生了我的意思。
请注意,我习惯在开始时\romanhdr
切换到罗马页码和特定fancyhdr
布局,效果很好。我如何才能将其也添加到参考书目中?如果你编译我的文件并查看参考书目,一切都会有所不同。
LaTeX
文件:
\documentclass[12pt, a4paper, oneside, onecolumn]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[round]{natbib}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}
%%--------------------------------------------------------------------------
%% DOCUMENT-SPECIFIC
%%--------------------------------------------------------------------------
\usepackage{tabularx}
\setlength{\oddsidemargin}{1.5cm}
\setlength{\topmargin}{-0.5cm}
\setlength{\textheight}{22.5cm}
\usepackage{acronym}
\usepackage{tocloft}
\usepackage{tocbibind}
\newcommand{\chp}[1]{\chapter{#1}\thispagestyle{fancy}}
\newcommand{\romanhdr}
{
\thispagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LO]{}
\fancyhead[RE]{}
}
\newcommand{\fancyhdr}{
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
}
\begin{document}
\frontmatter
\pagenumbering{Roman}
\tableofcontents
\romanhdr
\clearpage
\chapter*{Abkürzungsverzeichnis}
\romanhdr
\addcontentsline{toc}{chapter}{Abkürzungsverzeichnis}
\clearpage
\listoffigures
\romanhdr
\clearpage
\listoftables
\romanhdr
\clearpage
\fancyhdr
\mainmatter % implies arabic pagenumbering
\chp{Introduction}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\clearpage
\backmatter
\pagenumbering{roman}
\setcounter{page}{5}
\nocite{mybook1}
\nocite{mybook2}
\nocite{mybook3}
\nocite{mybook4}
\nocite{mybook5}
\nocite{mybook6}
\nocite{mybook7}
\nocite{mybook8}
\nocite{mybook9}
\nocite{mybook10}
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}
BibTeX
文件:
@book{mybook1,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook2,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook3,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook4,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook5,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook6,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook7,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook8,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook9,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook10,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
这是对的:
这是错误的:
答案1
所以我思考下面的命令可能符合你的要求,但我不太清楚你想要什么,所以我可能错了。我认为你希望输出大致如下:
如果是这样,应该这样做:
\documentclass[12pt, a4paper, oneside, onecolumn]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[round]{natbib}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\newcommand{\plainplain}{%
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LO]{}
\fancyhead[RE]{}
}}
\newcommand{\myplain}{%
\fancypagestyle{plain}{%
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
}}
%%--------------------------------------------------------------------------
%% DOCUMENT-SPECIFIC
%%--------------------------------------------------------------------------
\usepackage{tabularx}
\setlength{\oddsidemargin}{1.5cm}
\setlength{\topmargin}{-0.5cm}
\setlength{\textheight}{22.5cm}
\usepackage{acronym}
\usepackage{tocloft}
\usepackage{tocbibind}
\usepackage{filecontents,lipsum}
\begin{filecontents}{bibliography.bib}
@book{mybook1,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook2,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook3,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook4,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook5,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook6,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook7,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook8,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook9,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook10,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
\end{filecontents}
\begin{document}
\plainplain
\frontmatter
\pagenumbering{Roman}
\tableofcontents
\clearpage
\chapter*{Abkürzungsverzeichnis}
\addcontentsline{toc}{chapter}{Abkürzungsverzeichnis}
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\myplain
\mainmatter % implies arabic pagenumbering
\chapter{Introduction}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\lipsum[1-7]
\section{New Section}
\lipsum[8-14]
\clearpage
\plainplain
\backmatter
\pagenumbering{roman}
\setcounter{page}{5}
\nocite{mybook1}
\nocite{mybook2}
\nocite{mybook3}
\nocite{mybook4}
\nocite{mybook5}
\nocite{mybook6}
\nocite{mybook7}
\nocite{mybook8}
\nocite{mybook9}
\nocite{mybook10}
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}
此功能通过重新定义页面样式来实现plain
,而不是定义其他样式然后手动应用。基本上,它提供了两个命令来在 的两个版本之间切换plain
。\plainplain
涵盖前言和后文,而\myplain
涵盖更精致的主要内容(您希望在章节的第一页使用头部规则)。这也避免了使用单独命令的需要\chp
。\chapter
将自动执行您想要的操作。这意味着参考书目在排版时会自动获得样式,因为它使用了\chapter
。另一种方法是告诉 TeX 使用\chp
作为参考书目的分段。但我认为这种方法更干净,因为它避免了在整个文档中重新应用页面样式的需要。
请注意,最好使用geometry
而不是直接调整边距等,您需要headheight
至少设置 15pt,并且您应该E
从fancyhdr
的设置中删除选项或使用twoside
。如果您不更正 headheight,您将在页面顶部得到不一致的间距。
更新:为了使整个参考书目使用与第一页相同的样式,您可以使用以下代码:
\documentclass[12pt, a4paper, oneside, onecolumn]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[round]{natbib}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % space for the rule
\newcommand{\plainplain}{%
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LO]{}
\fancyhead[RE]{}
}}
\newcommand{\myplain}{%
\fancypagestyle{plain}{%
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
}}
%%--------------------------------------------------------------------------
%% DOCUMENT-SPECIFIC
%%--------------------------------------------------------------------------
\usepackage{tabularx}
\setlength{\oddsidemargin}{1.5cm}
\setlength{\topmargin}{-0.5cm}
\setlength{\textheight}{22.5cm}
\usepackage{acronym}
\usepackage{tocloft}
\usepackage{tocbibind}
\usepackage{filecontents,lipsum}
\begin{filecontents}{bibliography.bib}
@book{mybook1,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook2,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook3,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook4,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook5,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook6,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook7,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook8,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook9,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
@book{mybook10,
title = {This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs. This is my book title that I stretch so that I get two pages of bibliography in order to show that the layout of the header differs},
author = {myauthor},
year = {2010}
}
\end{filecontents}
\begin{document}
\plainplain
\frontmatter
\pagenumbering{Roman}
\tableofcontents
\clearpage
\chapter*{Abkürzungsverzeichnis}
\addcontentsline{toc}{chapter}{Abkürzungsverzeichnis}
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\myplain
\mainmatter % implies arabic pagenumbering
\chapter{Introduction}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\lipsum[1-7]
\section{New Section}
\lipsum[8-14]
\clearpage
\plainplain
\pagestyle{plain}
\backmatter
\pagenumbering{roman}
\setcounter{page}{5}
\nocite{mybook1}
\nocite{mybook2}
\nocite{mybook3}
\nocite{mybook4}
\nocite{mybook5}
\nocite{mybook6}
\nocite{mybook7}
\nocite{mybook8}
\nocite{mybook9}
\nocite{mybook10}
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}
生成结果: