引文格式和 hyperref 包
我在文档中使用 hyperref 包。 它所做的事情之一是根据目录在我的 pdf 中创建书签。 某些章节标题包含对引文的引用
\section{Some title \citep{BibTeXkey}}
书签的标签看起来像
Some title BibTeXkey
但我希望它
Some title (Author, year)
就像文本和目录中显示的那样。 所以只有书签被搞乱了。
我使用了序列 pdflatex
、bibtex
、pdflatex
、pdflatex
来编译文档。
如何更改书签标签以使用与目录中相同的格式?
I'm using the hyperref package in my document. One of the things that it does is create bookmarks in my pdf, based on the table of contents. Some section titles contain a reference to a citation
\section{Some title \citep{BibTeXkey}}
The label of the bookmark then looks like
Some title BibTeXkey
But I would like it to be
Some title (Author, year)
Just like it is displayed in the text and the table of contents. So only the bookmarks are messed up.
I used the sequence pdflatex
, bibtex
, pdflatex
, pdflatex
to compile the document.
How do I change the bookmark label to use the same format as in the table of contents?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每当我遇到 pdf 书签无法正常工作的问题时,解决方案通常是使用
\texorpdfstring
。 它允许您使节标题包含一些非文本材料(如链接或一些符号),并指定 pdf 书签中应显示的内容,其中不能包含符号。 输入生成部分标题“带有 LaTeX 符号的部分”,但该部分的 pdf 书签是“带有纯文本版本的部分”。
就您而言,最简单的事情可能是
不幸的是,这意味着您必须手动粘贴“
(作者,年份)
”,这有点烦人,但如果你的参考书目条目不会改变(这可能不应该改变),并且你不会改变你的引用约定。如果您确实想避免手动输入“
(作者,年份)
”,您可以尝试使用\show
命令尝试找出\citep
如何生成其输出。 但我警告您,这种方法不适合胆小的人:在这种情况下,我认为您最终会查看aux
文件,更不用说blg
、brf
和bbl
文件。Whenever I'm having an issue with the pdf bookmarks not working properly, the solution is usually to use
\texorpdfstring
. It allows you to make a section title contain some non-text material (like a link or some symbols) and specify what should appear in the pdf bookmark, which cannot contain symbols. The inputproduces the section title "The section with LaTeX symbols", but the pdf bookmark for the section is "The section with plain text version".
In your case, the easiest thing to do is probably
Unfortunately, this means that you have to paste "
(Author, year)
" in by hand, which is a little annoying, but not a big deal if your bibliography entry doesn't change (which is probably shouldn't) and you don't change your citation conventions.If you really want to avoid having to type in "
(Author, year)
" by hand, you can try using the\show
command to try to figure out how\citep
produces it's output. But I warn you that this approach is not for the faint of heart: in this case, I think you'll end up looking through theaux
file, not to mention theblg
,brf
, andbbl
files.这可以通过包
bibentry
轻松完成。请注意,根据样式,上面的代码不一定会给出您想要的结果,即(作者,年份)。 如果您使用不同的样式,您可以使用以下命令完成相同的任务
This can be done easily with the package
bibentry
Notice that depending on the style, the above code will not necessarily give you the desired outcome, which is (Author, year). If you are using a different style, you can accomplish the same with