如果句子中已经提到名称,则宏可隐藏引用中的名称

如果句子中已经提到名称,则宏可隐藏引用中的名称

我正在尝试减少整个文档中使用的引用命令的数量。理想情况下,我只想使用一个:\autocites

是否有任何现成的宏可以抑制引用中的作者姓名,\autocite或者\autocites如果在引用之前的句子中已经提到了相同的名称?(APA 样式中可以接受的内容)

请查看 MWE 中的几个示例

\RequirePackage{filecontents}

\begin{filecontents*}{mybib.bib}
  @book{abraham,
    address = {New {York}, {NY}},
    title = {Computational social networks: {Tools}, perspectives and applications},
    shorttitle = {Computational social networks},
    publisher = {Springer},
    author = {Abraham, Ajith},
    year = {2012}
  }
  @book{minsky,
    address = {New {York}, {NY}},
    title = {The emotion machine: {Commonsense} thinking, artificial intelligence, and the future of the human mind},
    shorttitle = {The emotion machine},
    publisher = {Simon \& {Schuster}},
    author = {Minsky, Marvin Lee},
    year = {2006}
  }
  @article{lyall,
    title = {Explaining {Support} for {Combatants} during {Wartime}: {A} {Survey} {Experiment} in {Afghanistan}},
    volume = {107},
    number = {04},
    journal = {American {Political} {Science} {Review}},
    author = {Lyall, Jason and Blair, Graeme and Imai, Kosuke},
    month = nov,
    year = {2013},
    pages = {679--705}
  }
\end{filecontents*}

\documentclass[a4paper]{article}


% Set the values for the bibliography
\usepackage[
style=apa,
backend=biber,
isbn=false,
url=false,
doi=false,
eprint=false,
backref=false,
firstinits=false,
]{biblatex}

% Recommended by biblatex
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{xpatch}

% Set language
\usepackage[british]{babel}
\DeclareLanguageMapping{british}{british-apa}

\addbibresource{mybib.bib}

\begin{document}

\begin{enumerate}
\item Abraham wrote \autocite{abraham} but not \autocites{lyall, minsky}
  \begin{itemize}
  \item Suppress name in first citation to get as result \textbf{(\citeyear{abraham})}
  \end{itemize}

\item Ajith Abraham wrote \autocite{abraham} but not \autocites{lyall, minsky}
  \begin{itemize}
  \item Suppress name in first citation to get as result \textbf{(\citeyear{abraham})}
  \end{itemize}

\item Ajith Abraham wrote \autocites{abraham}[see also][]{minsky, abraham} but not \autocites{lyall, minsky}
  \begin{itemize}
  \item Suppress name in first citation to get as result \textbf{(\citeyear{abraham}; see also \cites{minsky, abraham})}
  \end{itemize}

\item Kosuke wrote \autocite{lyall} but not \autocites{minsky, abraham}
  \begin{itemize}
  \item Do not suppress name in first citation, although Kosuke is among authors
  \end{itemize}

\item Lyall wrote \autocite{lyall} but not \autocites{minsky, abraham}
  \begin{itemize}
  \item Do not suppress name in first citation, although Lyall is among authors
  \end{itemize}

\item Lyall et al. wrote \autocite{lyall} but not \autocites{minsky, abraham}
  \begin{itemize}
  \item Suppress name in first citation
  \end{itemize}

\end{enumerate}

\printbibliography
\end{document}

答案1

这个想法很不错,而且我认为它的好处是巨大的。但是,你无法在 (La)TeX 中实现这一点,原因很简单,因为句子不是逻辑标记的实体。(我想说,在另一个可以处理正则表达式的编程环境中,这肯定是可能的。)对于这个有点令人失望的简短回答,我感到非常抱歉。

答案2

您不使用这个包有什么特别的原因吗apacite?我不知道有任何包、宏或 APA 引用选项能像您正在寻找的那样复杂,但写作\citeyear{foo}并不比写作更费力\cite{foo}[\citeyear{foo}如果作者的名字已经写在句子主体中,而您只需要其余的引用,那么您就需要它。]。它有很多选项,您可以根据自己的特定需求进行调整。

相关内容