我如何偶尔使用标准格式引用而不是简写

我如何偶尔使用标准格式引用而不是简写

我使用的是 biblatex 1.9 和 biber 2.9。我使用作者-年份引用样式。我的一些条目有简写。在某些情况下,我想对这些条目使用标准引用样式,而不是打印简写。我没有找到执行此操作的引用命令。我现在使用变通方法

\parentext{\citeauthor{entryname}, \citeyear{entryname}}

有没有更好的方法?

MWE:

\begin{filecontents}{refs.bib}
@MISC{ABC,
  AUTHOR     = {Alain B. Cedaire},
  SHORTHAND  = {ABC},
  TITLE      = {Alfabet},
  YEAR       = {2020},
}
\end{filecontents}
\documentclass{article}
\usepackage{hyperref}
\usepackage[citestyle=authoryear-comp,hyperref,backend=biber]{biblatex}
  \addbibresource{refs.bib}
\begin{document}
  Wanted formats, ideally hyperlinked:
  \begin{itemize}
    \item \parentext{\citeauthor{ABC}, \citeyear{ABC}}
    \item \citeauthor{ABC} \parentext{\citeyear{ABC}}
  \end{itemize}

  Available formats:
  \begin{itemize}
    \item[cite:] \cite{ABC}
    \item[textcite:] \textcite{ABC}
    \item[parencite:] \parencite{ABC}
  \end{itemize}

  \printbibliography
\end{document}

答案1

我们可以创建一个新的命令,shorthand暂时“忘记”该字段,从而产生“正常”的引用

\DeclareCiteCommand{\citenoso}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\parencitenoso}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:postnote}}

\citenosoauthoryear-icomp是宏的精确副本,并在引用钩中添加了该\cite行。\clearfield{shorthand}%

平均能量损失

\documentclass{article}
\usepackage[style=authoryear-icomp]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\citenoso}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\parencitenoso}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:postnote}}

\begin{document}
\cite{kant:kpv,kant:ku,baez/article} vs \citenoso{kant:kpv,kant:ku,baez/article} and 
\cite{kant:kpv,kant:ku,baez/article}
\printbibliography
\end{document}

在此处输入图片描述


对于偶尔使用的情况,您也可以使用\AtNextCitekey{\clearfield{shorthand}}并引用该条目。例如

\AtNextCitekey{\clearfield{shorthand}}\cite{kant:kpv}

重新authoryear-comp定义是

\DeclareCiteCommand{\citenoso}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencitenoso}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\clearfield{shorthand}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{postnote}}

(有时命令的定义\cite在不同的风格中会有非常细微的差异,这就是这里发生的情况:postnotevs cite:postnote。)

相关内容