5

I am using biblatex 1.9 with biber 2.9. I use the author-year citation style. Some of my entries have shorthands. On certain occasions, I would like to use the standard citation style for these entries, instead of printing the shorthand. I did not find a citation command for doing this. I now use the workaround

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

Is there a better approach?

An 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}
equaeghe
  • 5,976
  • 4
  • 30
  • 36

1 Answers1

5

We can create a new command that "forgets" the shorthand field for the time being, resulting in a "normal" citation

\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}}

\citenoso is an exact copy of authoryear-icomp's \cite macro with the line \clearfield{shorthand}% added to the citation hook.

MWE

\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}

enter image description here


For the occasional use, you could also go with \AtNextCitekey{\clearfield{shorthand}} and then cite the entry. Like

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

With authoryear-comp the redefinition is

\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}}

(Sometimes the definition of the \cite commands vary across different styles in very minute ways, this is what happens here: postnote vs cite:postnote.)

moewe
  • 175,683
  • Nice, so an intermediate solution \newcommand*{\citenosh}[2][]{\AtNextCitekey{\clearfield{shorthand}}\cite[#1]{#2}} is also possible. – equaeghe Feb 24 '15 at 22:11
  • 1
    @equaeghe Yes, it is possible but brings with it some drawbacks: The first is that one - in defining the command as you did above - gives away control about pre-notes, that can be fixed by \newcommand*{\citenosh}{\AtNextCitekey{\clearfield{shorthand}}\cite}, but more importantly, try the \citenoso{kant:kpv,kant:ku} from above and compare with \citenosh{kant:kpv,kant:ku}. – moewe Feb 25 '15 at 06:46
  • Hmm, I get the error ! Package biblatex Error: Bibliography macro 'cite:postnote' undefined.. – equaeghe Feb 25 '15 at 11:17
  • @equaeghe Oh, my bad, my MWE uses authoryear-icomp while you use authoryear-comp where the redefinitions must be slightly changed. – moewe Feb 25 '15 at 17:45
  • @equaeghe I have now added the appropriate definition for the authoryear-comp style. – moewe Feb 25 '15 at 17:47
  • @equaeghe Did the update help? BTW if this answer helped you and answered your question to your satisfaction, you might consider accepting and/or up-voting it. – moewe Feb 26 '15 at 07:58