当我将 natbibapa 与 apacite 一起使用并插入 backrefs 时,backref 中的自定义文本会像图片中显示的那样加倍。
有什么想法,如何解决这个问题?谢谢!
以下是 MWE:
\documentclass[11pt,a4paper]{article}
\usepackage[pagebackref=true]{hyperref}
%OR \usepackage{backref}
\renewcommand*{\backref}[1]{Zitiert auf S.{\,}#1.}
\usepackage[natbibapa]{apacite}
%\usepackage{natbib}
\RequirePackage{filecontents}
\begin{filecontents}{jobname.bib}
@book{aaas1990,
author = {{American Association for the Advancement of Science [AAAS]}},
year = {1990},
title = {{Science for all Americans}},
address = {New York},
publisher = {{Oxford University Press}},
key = {AAAS}
}
\end{filecontents}
\begin{document}
I cite \citep{aaas1990}. %Problem occurs independent of the use of \cite{}, \citep{} or anything else.
\bibliography{jobname}
\bibliographystyle{apacite}
\end{document}
- hyperref 的 backref-option 或 backref-package 均出现问题。
- apacite 的 natbibapa-option 或 natbib-package 都出现了问题。
答案1
\renewcommand*{\backref}[1]{Zitiert auf S.{\,}#1.}
用。。。来代替\renewcommand*{\backrefxxx}[3]{Zitiert auf S.{\,}#1.}
。
您还可以在前言中添加以下几行,以查看该命令backref
被调用两次(我不知道为什么),但第一次调用时,其参数为空;第二次调用时,参数包含的输出\backrefxxx
:
\usepackage{xcolor}
\renewcommand*{\backref}[1]{\textcolor{red}{BACKREF[1=#1]ENDOFBACKREF}}
\renewcommand*{\backrefxxx}[3]{\textcolor{blue}{XXX[1=#1][2=#2][3=#3]ENDOFXXX}}
一个更复杂的替代方案\backref
是\backrefalt
:
\usepackage{xcolor}
\renewcommand*{\backref}[1]{} %% documentation says: use this when backref package version < 1.33
%% I have 1.38 and when \backrefalt is defined, it replaces \backref
\renewcommand*{\backrefxxx}[3]{\textcolor{blue}{XXX[1=#1][2=#2][3=#3]ENDOFXXX}}
\renewcommand*{\backrefalt}[4]{\textcolor{green}{ALT[1=#1][2=#2][3=#3][4=#4]ENDOFALT}}
请注意,传递给的第 1 和第 3 个参数是引用数(#1 是不同的反向引用页面数,#3 是总引用数)。请注意,如果 #1=0(上面的第一次调用)\backrefalt
,则不会输出任何内容:\backrefalt
\renewcommand*{\backrefalt}[4]{%
\ifcase #1 {}% %% do not output anything if the first argument is 0!!!
\or page #2% %% first argument=1 => was cited on a single page
\else pages #2% %% first argument>1 => was cited on multiple pages
\fi
}