当 Beamer 处于 tabularx 环境中时,0 显示在引用之前

当 Beamer 处于 tabularx 环境中时,0 显示在引用之前

我遵循的解决方案脚注在区块中的放置不当在我的 Beamer 中引用,以便它们确实是脚注而不是块脚注释。它工作得很好,但是,当我\sfcite{some_ref}在 中执行时tabularx,它会将其显示为0[1] Author's name, etc而不是简单地显示[1] Author's name, etc为 。有线索可以知道这是从哪里来的吗?

% !TEX TS–program = pdflatexmk

\documentclass[mathserif,english]{beamer}
\usepackage[english]{babel}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}

\AtEveryCitekey{%
    \renewbibmacro*{in:}{}%
    \clearfield{pages}%
    \clearfield{volume}%
    \clearname{journal}%
    \clearfield{journal}%
    \clearlist{journal}%
    \clearfield{eprint}%
    \clearfield{archivePrefix}%
    \clearfield{primaryClass}%
    \clearfield{url}%
    \clearlist{address}%
    \clearfield{date}%
    \clearfield{eprint}%
    \clearfield{isbn}%
    \clearfield{issn}%
    \clearlist{location}%
    \clearfield{month}%
    \clearfield{series}%
    \clearfield{booktitle}%
    \clearname{booktitle}%
}

\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}

\DeclareCiteCommand{\footfullcitetext}
  [\let\thefootnote\relax\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\mkbibbrackets{\thefield{labelnumber}}%
   \addnbspace%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\makeatletter
\let\cbx@citehook=\empty
\newtoggle{cbx@blockcite}

\renewcommand{\@makefntext}[1]{%
  \noindent\normalfont\@thefnmark#1}

\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \ifciteseen
     {\ifnumequal{\value{page}}{\csuse{cbx@page@\thefield{entrykey}}}
       {}
       {\ifnumequal{\value{framenumber}}{\csuse{cbx@frame@\thefield{entrykey}}}
          {\usebibmacro{sfcite}}
          {}}}
     {\usebibmacro{sfcite}}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{sfcite}{%
  \csnumgdef{cbx@page@\thefield{entrykey}}{\value{page}}%
  \csnumgdef{cbx@frame@\thefield{entrykey}}{\value{framenumber}}%
  \xappto\cbx@citehook{%
    \noexpand\footfullcitetext{\thefield{entrykey}}}}

\newrobustcmd*{\cbx@superscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}%
  \iftoggle{cbx@blockcite}
    {}
    {\cbx@citehook%
     \global\let\cbx@citehook=\empty}}

\BeforeBeginEnvironment{block}{\global\toggletrue{cbx@blockcite}}

\def\metabox#1{\edef\theprevdepth{\the\prevdepth}\nointerlineskip
  \vbox to0pt{#1\vss}\prevdepth=\theprevdepth}

\AfterEndEnvironment{block}
  {\metabox{%
     \global\togglefalse{cbx@blockcite}%
     \cbx@citehook%
     \global\let\cbx@citehook=\empty}}

\makeatother

\usepackage{filecontents}
\begin{filecontents*}{bib2.bib}
@article{some_ref,
  title={Reference title},
  author={Author's name},
  year={2018}
}
}
\end{filecontents*}

\addbibresource{bib2.bib}

\usepackage{tabularx}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}


\begin{document}

\begin{frame}
\frametitle{MWE frame}

The tabular here:

\begin{table}[h]
\begin{tabularx}{\textwidth}{P{0.45\linewidth}P{0.45\linewidth}}
Sample text & Other sample text\sfcite{some_ref}
\end{tabularx}
\end{table}

The same ref.\sfcite{some_ref}

\end{frame}
\begin{frame}[allowframebreaks]
        \frametitle{References}
    \printbibliography
\end{frame}


\end{document}

enter image description here

答案1

使用 smacarter 的答案Beamer 中未编号的脚注我们可以beamer通过重新定义beamer模板来获得未编号的脚注。

\documentclass[mathserif,english]{beamer}
\usepackage[english]{babel}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}


\DeclareCiteCommand{\footfullcitetext}
  [\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\mkbibbrackets{\thefield{labelnumber}}%
   \addnbspace%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\makeatletter
\let\cbx@citehook=\empty
\newtoggle{cbx@blockcite}

\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \ifciteseen
     {\ifnumequal{\value{page}}{\csuse{cbx@page@\thefield{entrykey}}}
       {}
       {\ifnumequal{\value{framenumber}}{\csuse{cbx@frame@\thefield{entrykey}}}
          {\usebibmacro{sfcite}}
          {}}}
     {\usebibmacro{sfcite}}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{sfcite}{%
  \csnumgdef{cbx@page@\thefield{entrykey}}{\value{page}}%
  \csnumgdef{cbx@frame@\thefield{entrykey}}{\value{framenumber}}%
  \xappto\cbx@citehook{%
    \noexpand\footfullcitetext{\thefield{entrykey}}}}

\newrobustcmd*{\cbx@superscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}%
  \iftoggle{cbx@blockcite}
    {}
    {\cbx@citehook%
     \global\let\cbx@citehook=\empty}}
\makeatother

\setbeamertemplate{footnote}{%
  \parindent 1em\noindent%
  \raggedright
  \insertfootnotetext\par}

\addbibresource{biblatex-examples.bib}

\usepackage{tabularx}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}


\begin{document}
\begin{frame}
\begin{table}[h]
\begin{tabularx}{\textwidth}{P{0.45\linewidth}P{0.45\linewidth}}
Sample text & Other sample text\sfcite{sigfridsson}\footnotetext{lorem}
\end{tabularx}
\end{table}

The same ref.\sfcite{sigfridsson}
\end{frame}
\end{document}

Footnotes without superfluous "0"s

相关内容