Skip to main content
Corrected material on \DeclareAutoCiteCommand, expanded example
Source Link
Audrey
  • 29.5k
  • 2
  • 114
  • 167

The \autocite command depends on both the autocite option setting and various citation commands. The latter is determined (in part) by the citestyle option settings. In biblatex.sty you can see how these options are handled. The value passed tofor citestyle is stored explicitly:

But the value passed tofor autocite isn't; it is instead used to identify a control sequence name: using some commands from the biblatex and etoolbox packages.

This makes sense becauseThe control sequences \autociteblx@acite@plain can later be redefined with, \DeclareAutoCiteCommandblx@macite@plain, blx@acite@inline, etc. Here's anare defined in biblatex.def by:

\DeclareAutoCiteCommand{plain}{\cite}{\cites} \DeclareAutoCiteCommand{inline}{\parencite}{\parencites} \DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites} \DeclareAutoCiteCommand{superscript}[l]{\supercite}{\supercites} 

Below is a very simple example of how you could create a format that depends on the definitionautocite and citestyle options. It uses some commands from etoolbox and is constructed assuming the above generic definitions. These can later be redefined and expanded with further use of \autocite\DeclareAutoCiteCommand:. So the test here isn't particularly comprehensive or robust to changes in the citation style.

\documentclass{article} \usepackage[autocite=inline]\usepackage[style=authoryear,autocite=footnote]{biblatex} \bibliography{biblatex-examples} \makeatletter \newrobustcmd{\mkautoformat\mkbibautoformat}[1]{% \cslet{cbx@autocite}{\autocite}% \ifcsequal{cbx@autocite}{blx@acite@inline} {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} } {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@footnote} {\iffootnote {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} }   {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\mkbibfootnote{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@superscript} {\mkbibsuperscript{#1}} {#1}}}} \makeatother \begin\DeclareCiteCommand{document\autociteyear}[\mkbibautoformat] \mkautoformat {Format\boolfalse{citetracker}%  based on autocite\boolfalse{pagetracker}%  \usebibmacro{prenote}} {\printfield{year}} {\multicitedelim} {\usebibmacro{postnote}} \begin{document} \null\vfill \footnote{\autociteyear{companion}\autocite{companion}} \end{document} 

enter image description here

The \autocite command depends on both the autocite and citestyle option settings. In biblatex.sty you can see how these options are handled. The value passed to citestyle is stored explicitly:

But the value passed to autocite isn't; it is instead used to identify a control sequence name:

This makes sense because \autocite can later be redefined with \DeclareAutoCiteCommand. Here's an example of how you could create a format that depends on the definition of \autocite:

\documentclass{article} \usepackage[autocite=inline]{biblatex} \bibliography{biblatex-examples} \makeatletter \newrobustcmd{\mkautoformat}[1]{% \cslet{cbx@autocite}{\autocite}% \ifcsequal{cbx@autocite}{blx@acite@inline} {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} } {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@footnote} {\mkbibfootnote{#1}} {\ifcsequal{cbx@autocite}{blx@acite@superscript} {\mkbibsuperscript{#1}} {#1}}}} \makeatother \begin{document} \mkautoformat{Format based on autocite} \autocite{companion} \end{document} 

The \autocite command depends on the autocite option setting and various citation commands. The latter is determined (in part) by the citestyle option. In biblatex.sty you can see how these options are handled. The value for citestyle is stored explicitly:

But the value for autocite isn't; it is instead used to identify a control sequence name using some commands from the biblatex and etoolbox packages.

The control sequences blx@acite@plain, blx@macite@plain, blx@acite@inline, etc. are defined in biblatex.def by:

\DeclareAutoCiteCommand{plain}{\cite}{\cites} \DeclareAutoCiteCommand{inline}{\parencite}{\parencites} \DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites} \DeclareAutoCiteCommand{superscript}[l]{\supercite}{\supercites} 

Below is a very simple example of how you could create a format that depends on the autocite and citestyle options. It uses some commands from etoolbox and is constructed assuming the above generic definitions. These can later be redefined and expanded with further use of \DeclareAutoCiteCommand. So the test here isn't particularly comprehensive or robust to changes in the citation style.

\documentclass{article} \usepackage[style=authoryear,autocite=footnote]{biblatex} \bibliography{biblatex-examples} \makeatletter \newrobustcmd{\mkbibautoformat}[1]{% \cslet{cbx@autocite}{\autocite}% \ifcsequal{cbx@autocite}{blx@acite@inline} {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} } {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@footnote} {\iffootnote {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} }   {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\mkbibfootnote{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@superscript} {\mkbibsuperscript{#1}} {#1}}}} \makeatother \DeclareCiteCommand{\autociteyear}[\mkbibautoformat]  {\boolfalse{citetracker}%  \boolfalse{pagetracker}%  \usebibmacro{prenote}} {\printfield{year}} {\multicitedelim} {\usebibmacro{postnote}} \begin{document} \null\vfill \footnote{\autociteyear{companion}\autocite{companion}} \end{document} 

enter image description here

Source Link
Audrey
  • 29.5k
  • 2
  • 114
  • 167

The \autocite command depends on both the autocite and citestyle option settings. In biblatex.sty you can see how these options are handled. The value passed to citestyle is stored explicitly:

\define@key{blx@opt@ldt}{citestyle}{% \def\blx@cbxfile{#1}} 

But the value passed to autocite isn't; it is instead used to identify a control sequence name:

\DeclareBibliographyOption{autocite}{% \ifcsundef{blx@acite@#1} {\blx@error {Autocite command '#1' undefined} {The autocite command '#1' has not been defined by the\MessageBreak selected citation style}} {\letcs\autocite{blx@acite@#1}% \letcs\autocites{blx@macite@#1}}} 

This makes sense because \autocite can later be redefined with \DeclareAutoCiteCommand. Here's an example of how you could create a format that depends on the definition of \autocite:

\documentclass{article} \usepackage[autocite=inline]{biblatex} \bibliography{biblatex-examples} \makeatletter \newrobustcmd{\mkautoformat}[1]{% \cslet{cbx@autocite}{\autocite}% \ifcsequal{cbx@autocite}{blx@acite@inline} {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}} or test {\ifdefstring{\blx@bbxfile}{alphabetic}} } {\mkbibbrackets{#1}} {\mkbibparens{#1}}} {\ifcsequal{cbx@autocite}{blx@acite@footnote} {\mkbibfootnote{#1}} {\ifcsequal{cbx@autocite}{blx@acite@superscript} {\mkbibsuperscript{#1}} {#1}}}} \makeatother \begin{document} \mkautoformat{Format based on autocite} \autocite{companion} \end{document}