2

I'm trying to modify the numeric-comp style so in-text citations appear with parentheses rather than brackets for both \cite and \textcite i.e. [1] becomes (1) and Smith et al. [1] becomes Smith et al. (1).

This was no problem for \cite - I just changed the command:

\DeclareCiteCommand{\cite}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}

For \textcite, I assumed that I could redefine the textcite macro replacing \bibopenbracket with \bibopenparen and \bibclosebracket with \bibcloseparen, like so:

\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\usebibmacro{cite:comp}}
    {\usebibmacro{cite:dump}\cbx@tempa
    \usebibmacro{cite:init}%
 \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \addspace\bibopenparen
     \ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \usebibmacro{cite:comp}}%
  \savefield{namehash}{\cbx@lasthash}%
  \gdef\cbx@tempa{\bibcloseparen\multicitedelim}}

But when I compile (after running biber) this I get the error "Argument of \@secondoftwo has an extra }". In fact this happens even if I renew the textcite macro to be exactly as it appears in numeric-comp.cbx. Is there something I'm not understanding here, or is it a bug? And is there another way?

(I'm using TeXShop 3.21 on Mac OS X.)

Minimal example to reproduce the error:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=numeric-comp, sorting=none, backend=biber, firstinits=true, maxcitenames=1]{biblatex}

\begin{filecontents}{testref.bib}
@article{a_reference,
    Author = {Smith, A A and Jones, Z Z},
    Journal = {A Journal},
    Number = {4},
    Pages = {267--277},
    Title = {A title},
    Volume = {75},
    Year = {2008}}
\end{filecontents}



\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\usebibmacro{cite:comp}}
    {\usebibmacro{cite:dump}\cbx@tempa
     \usebibmacro{cite:init}%
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \addspace\bibopenparen
     \ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \usebibmacro{cite:comp}}%
  \savefield{namehash}{\cbx@lasthash}%
  \gdef\cbx@tempa{\bibcloseparen\multicitedelim}}

\bibliography{testref}
\begin{document}

We \textbackslash cite \cite{a_reference} and then \textbackslash textcite -\textcite{a_reference}.

\printbibliography
\end{document}

0 Answers0