
natbibapa を apacite と共に使用して backref を挿入すると、backref 内のカスタム テキストがこの図のように 2 倍になります。
問題を解決する方法について何かアイデアはありますか? ありがとうございます!
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 オプションまたは natbib パッケージの両方で発生します。
答え1
\renewcommand*{\backref}[1]{Zitiert auf S.{\,}#1.}
と置換する\renewcommand*{\backrefxxx}[3]{Zitiert auf S.{\,}#1.}
。
次の行をプリアンブルに追加すると、コマンドbackref
が 2 回呼び出される (理由はわかりません) ことがわかりますが、最初の呼び出しではパラメータは空で、2 回目にはパラメータに次の出力が含まれます\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 番目の引数は\backrefalt
引用数であることに注意してください (#1 は異なるバック参照ページの数、#3 は引用の合計数)。次の定義では、#1=0 (上記の最初の呼び出し\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
}