每章末尾的参考书目 backrefalt 冲突(使用 natbib 和 chapterbib)

每章末尾的参考书目 backrefalt 冲突(使用 natbib 和 chapterbib)

我希望在每章末尾列出参考书目,并且在参考文献列表中保留交叉引用,并使用natbibchapterbib包标明“引用页数:”。

为了编译该文档,我使用.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和来反向引用出现引用的页面。chapterbibhyperrefbackref

此外,命令应该是

pdflatex Sample.tex
bibtex chp01
bibtex chp02
[...]
pdflatex Sample.tex
pdflatex Sample.tex

当我这么做的时候bibtex Sample.tex,它不起作用。

相关内容