1

I am using Biblatex and have used the following code to create two different classes of footnotes, one with the citation and a regular foot note


\DeclareNewFootnote{A}
\DeclareNewFootnote{B}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\makeatletter \newtoggle{cbx@togcite}

% Citation number superscript in brackets \renewcommand@makefntext[1]{% \iftoggle{cbx@togcite} {@textsuperscript{\normalfont[@thefnmark]}\enspace #1} {@textsuperscript{\normalfont@thefnmark}\enspace #1}% \global\togglefalse{cbx@togcite}}

% Citation number superscript in brackets (for babel french) \ifdef{@makefntextFB}{% \renewcommand@makefntextFB[1]{% \iftoggle{cbx@togcite} {@textsuperscript{\normalfont[@thefnmark]}\enspace #1} {@textsuperscript{\normalfont@thefnmark}\enspace #1}% \global\togglefalse{cbx@togcite}}}{}

% See https://tex.stackexchange.com/a/71566/35864 \let\cbx@savelist@empty \newcounter{cbx@inst@iter} \newcounter{cbx@inst@lastonpage} \setcounter{cbx@inst@lastonpage}{0}

\AtDataInput{% \csnumgdef{cbx@instcount@\thefield{entrykey}}{-1}}

% user-level citation command \DeclareCiteCommand{\sfcite}[\cbx@superscript] {\usebibmacro{cite:init}% \let\multicitedelim\supercitedelim \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}% \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}} {\usebibmacro{citeindex}% \usebibmacro{cite:super:foot}% \usebibmacro{cite:comp}} {} {\usebibmacro{cite:dump}}

% save instcount, save key and last inline instcount if seen first on page \newbibmacro*{cite:super:foot}{% \xdef\cbx@key{\thefield{entrykey}}% \ifsamepage{\value{instcount}}{\csuse{cbx@instcount@\cbx@key}} {} {\listxadd{\cbx@savelist}{\cbx@key}% \ifnumequal{\value{cbx@inst@lastonpage}}{0}% {\defcounter{cbx@inst@iter}{\value{instcount}}% \loop\ifnum\value{cbx@inst@iter}>0 \ifsamepage{\value{instcount}}{\value{cbx@inst@iter}} {\ifcsundef{blx@fnpage@\the\value{cbx@inst@iter}} {\setcounter{cbx@inst@lastonpage}{\value{cbx@inst@iter}}} {}% \stepcounter{cbx@inst@iter}} {\setcounter{cbx@inst@iter}{0}}% \repeat} {}}% \csnumgdef{cbx@instcount@\cbx@key}{\value{instcount}}}

\newrobustcmd*{\cbx@superscript}[1]{% \mkbibsuperscript{\mkbibbrackets{#1}}% \cbx@footnote}

% defer citation footnotes to last inline reference instance on page \newrobustcmd*{\cbx@footnote}{% \ifboolexpr{ not test {\ifdefempty{\cbx@savelist}} and test {\ifnumequal{\value{instcount}}{\value{cbx@inst@lastonpage}}} } {\cbx@sortlist@init% \let\do\cbx@do \dolistloop{\cbx@sortlist}% \global\let\cbx@savelist@empty \setcounter{cbx@inst@lastonpage}{0}} {}}

% print footnotes in 'sorting' order \def\cbx@do#1{% \ifinlist{#1}{\cbx@savelist} {\begingroup \blx@resetdata \blx@getdata@cite{#1}% \blx@setoptions@type\abx@field@entrytype \blx@setoptions@entry \blx@execute \blx@beglang \toggletrue{cbx@togcite}% \footnotetextA[\thefield{labelnumber}]{\blx@driver\abx@field@entrytype}% \blx@endlang \endgroup} {}}

% access internal list of sorted entry keys \def\cbx@sortlist@init{% \global\letcs{\cbx@sortlist} {blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}} \let\cbx@sortlist@empty \makeatother

\newbibmacro{string+doiurlisbn}[1]{% \iffieldundef{doi}{% \iffieldundef{url}{% \iffieldundef{isbn}{% \iffieldundef{issn}{% #1% }{% \href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}% }% }{% \href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}% }% }{% \href{\thefield{url}}{#1}% }% }{% \href{https://doi.org/\thefield{doi}}{#1}% }% }

\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn} {\mkbibemph{#1}}}

This code is taken from This post

However when I cite using \sfcite no footnote number appears in th superscript I get the errors that cite:init, cite:comp and cite:dump are undefined I thought this may be what is causing the problem

If it is relavant I am using the following options on biblatex

\usepackage[backend=bibtex, bibstyle=nature, citestyle = authoryear, natbib=true ,subentry, mcite, citetracker, pagetracker=page]{biblatex}

Also the entire citation appears in the footnote the same way as it does in the bibliography but I would like in the authoryear style but I cannot figure out what I need to change

Here is a MWE

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{xcolor}
\usepackage{manyfoot}
\usepackage[autostyle=true]{csquotes}
\usepackage[backend=bibtex, bibstyle=nature, citestyle = authoryear, natbib=true ,subentry, mcite, citetracker, pagetracker=page]{biblatex}
\usepackage{hyperref}

\DefineBibliographyStrings{ngerman}{ andothers = {\textit{et~al\adddot}} }

\DeclareNewFootnote{A} \DeclareNewFootnote{B}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\makeatletter \newtoggle{cbx@togcite}

% Citation number superscript in brackets \renewcommand@makefntext[1]{% \iftoggle{cbx@togcite} {@textsuperscript{\normalfont[@thefnmark]}\enspace #1} {@textsuperscript{\normalfont@thefnmark}\enspace #1}% \global\togglefalse{cbx@togcite}}

% Citation number superscript in brackets (for babel french) \ifdef{@makefntextFB}{% \renewcommand@makefntextFB[1]{% \iftoggle{cbx@togcite} {@textsuperscript{\normalfont[@thefnmark]}\enspace #1} {@textsuperscript{\normalfont@thefnmark}\enspace #1}% \global\togglefalse{cbx@togcite}}}{}

% See https://tex.stackexchange.com/a/71566/35864 \let\cbx@savelist@empty \newcounter{cbx@inst@iter} \newcounter{cbx@inst@lastonpage} \setcounter{cbx@inst@lastonpage}{0}

\AtDataInput{% \csnumgdef{cbx@instcount@\thefield{entrykey}}{-1}}

% user-level citation command \DeclareCiteCommand{\sfcite}[\cbx@superscript] {\usebibmacro{cite:init}% \let\multicitedelim\supercitedelim \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}% \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}} {\usebibmacro{citeindex}% \usebibmacro{cite:super:foot}% \usebibmacro{cite:comp}} {} {\usebibmacro{cite:dump}}

% save instcount, save key and last inline instcount if seen first on page \newbibmacro*{cite:super:foot}{% \xdef\cbx@key{\thefield{entrykey}}% \ifsamepage{\value{instcount}}{\csuse{cbx@instcount@\cbx@key}} {} {\listxadd{\cbx@savelist}{\cbx@key}% \ifnumequal{\value{cbx@inst@lastonpage}}{0}% {\defcounter{cbx@inst@iter}{\value{instcount}}% \loop\ifnum\value{cbx@inst@iter}>0 \ifsamepage{\value{instcount}}{\value{cbx@inst@iter}} {\ifcsundef{blx@fnpage@\the\value{cbx@inst@iter}} {\setcounter{cbx@inst@lastonpage}{\value{cbx@inst@iter}}} {}% \stepcounter{cbx@inst@iter}} {\setcounter{cbx@inst@iter}{0}}% \repeat} {}}% \csnumgdef{cbx@instcount@\cbx@key}{\value{instcount}}}

\newrobustcmd*{\cbx@superscript}[1]{% \mkbibsuperscript{\mkbibbrackets{#1}}% \cbx@footnote}

% defer citation footnotes to last inline reference instance on page \newrobustcmd*{\cbx@footnote}{% \ifboolexpr{ not test {\ifdefempty{\cbx@savelist}} and test {\ifnumequal{\value{instcount}}{\value{cbx@inst@lastonpage}}} } {\cbx@sortlist@init% \let\do\cbx@do \dolistloop{\cbx@sortlist}% \global\let\cbx@savelist@empty \setcounter{cbx@inst@lastonpage}{0}} {}}

% print footnotes in 'sorting' order \def\cbx@do#1{% \ifinlist{#1}{\cbx@savelist} {\begingroup \blx@resetdata \blx@getdata@cite{#1}% \blx@setoptions@type\abx@field@entrytype \blx@setoptions@entry \blx@execute \blx@beglang \toggletrue{cbx@togcite}% \footnotetextA[\thefield{labelnumber}]{\blx@driver\abx@field@entrytype}% \blx@endlang \endgroup} {}}

% access internal list of sorted entry keys \def\cbx@sortlist@init{% \global\letcs{\cbx@sortlist} {blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}} \let\cbx@sortlist@empty \makeatother

\newbibmacro{string+doiurlisbn}[1]{% \iffieldundef{doi}{% \iffieldundef{url}{% \iffieldundef{isbn}{% \iffieldundef{issn}{% #1% }{% \href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}% }% }{% \href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}% }% }{% \href{\thefield{url}}{#1}% }% }{% \href{https://doi.org/\thefield{doi}}{#1}% }% }

\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn} {\mkbibemph{#1}}}

\begin{filecontents}{\jobname.bib} @article{Frank1953, author = {Frank, F. C.}, title = {On spontaneous asymmetric synthesis}, journal = {Biochim. Biophys. Acta}, year = {1953}, volume = {11}, pages = {459-463}, doi = {10.1016/0006-3002(53)90082-1}, url = {http://www.sciencedirect.com/science/article/pii/0006300253900821}, }

@article{Kagan1986, author = {Puchot, C. and Samuel, O. and Dunach, E. and Zhao, S. and Agami, C. and Kagan, H. B.}, title = {Nonlinear effects in asymmetric synthesis. Examples in asymmetric oxidations and aldolization reactions}, journal = {J. Am. Chem. Soc.}, year = {1986}, volume = {108}, number = {9}, pages = {2353-2357}, doi = {10.1021/ja00269a036}, } @article{Soai1995, author = {Soai, Kenso and Shibata, Takanori and Morioka, Hiroshi and Choji, Kaori}, title = {Asymmetric autocatalysis and amplification of enantiomeric excess of a chiral molecule}, journal = {Nature}, year = {1995}, volume = {378}, number = {6559}, pages = {767-768}, doi = {10.1038/378767a0}, } @article{Brown2001, author = {Blackmond, Donna G. and McMillan, Christopher R. and Ramdeehul, Shailesh and Schorm, Andrea and Brown, John M.}, title = {Origins of Asymmetric Amplification in Autocatalytic Alkylzinc Additions}, journal = {J. Am. Chem. Soc.}, year = {2001}, volume = {123}, number = {41}, pages = {10103-10104}, doi = {10.1021/ja0165133}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document} \tableofcontents \newpage \section{Title} \null\vfill\noindent Vanilla footnote.\footnoteB{Vanilla footnote text.} First citation.\sfcite{Frank1953} First citation.\sfcite{Kagan1986} Vanilla footnote.\footnoteB{Vanilla footnote text.} First ``multi'' citation.\sfcite{Frank1953,Kagan1986,Soai1995} \newpage \section{Title} \null\vfill\noindent Second citation.\sfcite{Frank1953} Vanilla footnote.\footnoteB{Vanilla footnote text.} Second citation.\sfcite{Soai1995} Second citation.\sfcite{Kagan1986}\footnoteB{Vanilla footnote text.} First citation.\sfcite{Brown2001} \newpage \printbibliography \end{document}

This has been complied on overleaf using the pdfLaTeX compiler, I tried using biber as a backend however then I get the error Citation is undefined it just puts the reference name in the superscript,the footnote and bibliography disappear entirely

Prakrut
  • 11
  • Welcome to TeX.SE. Please post the MWE as in executable format – GowriSaro Mar 07 '23 at 13:11
  • 1
    A MWE Has been added to the main post thanks! – Prakrut Mar 07 '23 at 13:23
  • Thank you for the response! I am using OverLeaf so I think it shouldn't be a problem. And setting the backend to biber makes things worse – Prakrut Mar 07 '23 at 13:47
  • @Dai Bowen sorry I wasnt more specific I recompiled from scratch after changing the backend to biber and like I said the authoryear now shows up in the superscript , the footnotes and the bibliography completely disappear. I tried it again but got the same result it seems biber canot find the citations at all I get the error that the citation is undefined – Prakrut Mar 07 '23 at 14:07
  • Ah, your MWE compiles fine with style=chem-angew, so this is probably coming from changes to the styles that ship with biblatex so they no longer provide the cite:init etc bib macros. – Dai Bowen Mar 07 '23 at 16:59
  • @Dai Bown That seems to make sense though I cannot seem to find a workaround or fix, could you please suggest asolution? – Prakrut Mar 08 '23 at 10:43
  • @Prakrut I had a go rewriting some of the macros based on what I found in http://mirrors.ctan.org/macros/latex/contrib/biblatex/latex/cbx/authoryear.cbx but I'm not too familiar with biblatex's internals and couldn't figure out all the errors, I'll try and come back later, or somebody else with more experience may swing by. – Dai Bowen Mar 08 '23 at 18:55

0 Answers0