TransWikia.com

Citing/Referring: How to have a parencite without bracket ( )?

TeX - LaTeX Asked on March 4, 2021

How can I have a reference without a ( ) and with ( )?

For example:

1. Table 1: Spich et al, 2010

A text is written by (Spich et al, 2010).

Should I create another name instead of using the same parencite?

My MWE:

DeclareCiteCommand{parencite}[mkbibparens]
  {renewcommand*{postnotedelim}{addcolonspace}%
   usebibmacro{cite:init}%
   usebibmacro{prenote}}
  {usebibmacro{citeindex}%
   printtext[bibhyperref]{usebibmacro{cite}}}
  {multicitedelim}
  {usebibmacro{postnote}}

One Answer

Usually (e.g. in the biblatex standard styles without modifications that say otherwise), cite gives the result that parencite would give you, just without the parentheses.

documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage{babel}
usepackage{csquotes}

usepackage[backend=biber, style=authoryear]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
Lorem autocite{sigfridsson}
ipsum parencite{sigfridsson}
dolor cite{sigfridsson}

printbibliography
end{document}

Lorem (Sigfridsson and Ryde 1998) ipsum (Sigfridsson and Ryde 1998) dolor Sigfridsson and Ryde 1998

So the first thing I would try is cite.

Without having seen your code I can't tell if that will work as you hoped it would, though. It is hard to say what the most elegant way to achieve the result you want to see is in your setup, but the following should work provided the definition of parencite from the question does the right thing. You can simply copy the definition of parencite, give it a new name and drop the [mkbibparens], which produces the parentheses.

documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage{babel}
usepackage{csquotes}

usepackage[backend=biber, style=authoryear-comp]{biblatex}

DeclareCiteCommand{parencite}[mkbibparens]
  {renewcommand*{postnotedelim}{addcolonspace}%
   usebibmacro{cite:init}%
   usebibmacro{prenote}}
  {usebibmacro{citeindex}%
   printtext[bibhyperref]{usebibmacro{cite}}}
  {multicitedelim}
  {usebibmacro{postnote}}

DeclareCiteCommand{nparencite}
  {renewcommand*{postnotedelim}{addcolonspace}%
   usebibmacro{cite:init}%
   usebibmacro{prenote}}
  {usebibmacro{citeindex}%
   printtext[bibhyperref]{usebibmacro{cite}}}
  {multicitedelim}
  {usebibmacro{postnote}}

addbibresource{biblatex-examples.bib}

begin{document}
Lorem autocite[381]{sigfridsson}
ipsum parencite[382]{sigfridsson}
dolor nparencite[383]{sigfridsson}
sit cite[384]{sigfridsson}

printbibliography
end{document}

Lorem (Sigfridsson and Ryde 1998: p. 381) ipsum (Sigfridsson and Ryde 1998: p. 382) dolor Sigfridsson and Ryde 1998: p. 383 sit Sigfridsson and Ryde 1998, p. 384

Correct answer by moewe on March 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP