雙重自訂 Backref-Text,同時使用 natbib 或 natbibapa 與 apacite

雙重自訂 Backref-Text,同時使用 natbib 或 natbibapa 與 apacite

當我將 natbibapa 與 apacite 一起使用並插入反向引用時,反向引用中的自訂文字會加倍,如下圖所示。

微量元素

有什麼想法,如何解決問題?謝謝!

這是一個 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-package 的 backref-option 都會出現問題。
  • 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 和 backrefxxx 的參數

更複雜的替代品\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}}

backrefalt 和 backrefxxx 的參數

請注意,傳遞給的第一個和第三個參數\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
}

相關內容