我希望在每章末尾都有參考書目,並且在參考列表上仍然有交叉引用,說明“引用的頁面:”使用natbib
和chapterbib
包。
為了編譯文檔,我使用一個.bat
文件作為後處理器,如下所示:「按章節參考文獻」。另請使用參考流程或
pdflatex Sample.tex
bibtex Sample.tex
bibtex chp01
bibtex chp02
[...]
pdflatex Sample.tex
pdflatex Sample.tex
編譯 PDF。
請參閱下面的範例文件。
樣本.tex
\documentclass[a4paper,12pt,twoside,openright]{scrreprt}
\usepackage{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}{chp01.tex}
\blinddocument
\cite{lamport94}
\cite{knuth84}
\begingroup
\let\chapter\section
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{References}
\bibliographystyle{unsrt}
\bibliography{sample}
\endgroup
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}{chp02.tex}
\blinddocument
\cite{knuth84}
\begingroup
\let\chapter\section
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{References}
\bibliographystyle{unsrt}
\bibliography{sample}
\endgroup
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}{sample.bib}
@book{knuth84,
author = {{D}onald {E}. {K}nuth},
title = {{T}he \TeX book},
year = {1984},
series = {{C}omputers and typesetting},
volume = {A},
publisher = {{A}ddison-{W}esley}
}
@book{lamport94,
author = {{L}eslie {L}amport},
title = {\LaTeX\ -- {A} {D}ocument {P}reparation {S}ystem},
year = {1994},
publisher = {{A}ddison-{W}esley},
edition = {{S}econd}
}
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[square,comma,numbers,sort,sectionbib]{natbib}
\usepackage[sectionbib]{chapterbib}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[hyperindex,pagebackref=true,pdfusetitle,pdfa=true]{hyperref}
\hypersetup{plainpages=false,colorlinks,breaklinks,linktocpage,hypertexnames=true,naturalnames=false}
\hypersetup{linkcolor=red,citecolor=blue,filecolor=blue,urlcolor=blue}
%%%%%%% Backref
\renewcommand*{\backrefsep}{, }
\renewcommand*{\backreflastsep}{ and~}
\renewcommand*{\backreftwosep}{ and~}
\renewcommand*{\backref}[1]{} % empty definition for \backrefalt to be used, i.e. disable standard
\renewcommand*{\backrefalt}[4]{%
\vspace{-1.0mm}
\scriptsize\itshape\mbox{
\ifnum#1=1 %
\\(Cited on page~%
\else
\\(Cited on pages~%
\fi
#2)
}}
\begin{document}
\include{chp01}
\include{chp02}
\end{document}
該文件正在編譯,但缺少「引用頁面:」的參考頁面連結(見下圖)。
是否可以透過補丁或解決方法來解決該問題?
答案1
貼文裡的答案
是否可以使用單一 main.bib 檔案在每章之後進行回溯參考?
解決了我的問題。它展示瞭如何使用套件natbib
、chapterbib
、hyperref
和backref
來反向引用出現引用的頁面。
另外,命令應該是
pdflatex Sample.tex
bibtex chp01
bibtex chp02
[...]
pdflatex Sample.tex
pdflatex Sample.tex
當我這樣做時bibtex Sample.tex
,它不起作用。