Beamer 中的问题:如何自定义引文

Beamer 中的问题:如何自定义引文

我正在尝试在 beamer 中自定义引文。

让我提供一个最小的工作示例。

\documentclass[8pt]{beamer}
\usepackage[english]{babel}



\usepackage[style=alphabetic,backend=bibtex,doi=false,isbn=false,url=false]{biblatex}
%\setbeamertemplate{bibliography item}[text]
\addbibresource{bibliografia.bib}

\DeclareCiteCommand{\longcite}{}{\textcolor{magenta}{[\scriptsize   %
        \printnames[author]{author}, \printfield{journaltitle}, \printfield{year}]}}{;}{}%  



%------------------------------ slides aspect ----------------------------------------
\usetheme{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage[scale=2]{ccicons}

\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}

\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{background canvas}{bg=white}

\begin{document}
    


\begin{frame}
\frametitle{Frame}
\begin{itemize}
\item \emph{Isogeometric analysis}~\cite{MR2152382}
\item \emph{Isogeometric analysis}~\longcite{MR2152382}
\end{itemize}
\end{frame}

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



\end{document}

这是我得到的输出。

在此处输入图片描述

在此处输入图片描述

我想自定义命令 \longcite,以便我可以仅引用作者的姓氏和期刊的缩写名称(前提是相应的参考书目项目中有这样的字段),例如在本例中为 CMAME。有什么帮助吗?

我们假设书目项目内容如下。

@article{MR2152382,
    author = {Hughes, Thomas J. R. and Cottrell, J. Austin and Bazilevs, Yuri},
    date-added = {2021-07-30 11:49:08 +0200},
    date-modified = {2022-01-14 13:02:42 +0100},
    doi = {10.1016/j.cma.2004.10.008},
    fjournal = {Computer Methods in Applied Mechanics and Engineering},
    issn = {0045-7825},
    journal = {Comput. Methods Appl. Mech. Engrg.},
    journal_abbr = {CMAME},
    mrclass = {65D17 (65N30 74S05)},
    mrnumber = {2152382},
    number = {39-41},
    pages = {4135--4195},
    title = {Isogeometric analysis: {CAD}, finite elements, {NURBS}, exact geometry and mesh refinement},
    url = {https://doi.org/10.1016/j.cma.2004.10.008},
    volume = {194},
    year = {2005},
    bdsk-url-1 = {https://doi.org/10.1016/j.cma.2004.10.008}}

答案1

beamer与您的请求基本无关,因此在下面的代码示例中,我将切换到标准article类。当然,答案仍然适用于beamer

biblatex标准模型中,期刊名称缩写的字段为shortjournal而不是journal_abbr。如果从 切换journal_abbrshortjournal,则可以使用以下想法。

的定义\longcite更紧密地模仿了标准风格的引用命令的定义。

\documentclass{article}
\usepackage[english]{babel}
\usepackage{xcolor}

\usepackage[
  backend=bibtex,
  style=alphabetic,
  doi=false,isbn=false,url=false,
]{biblatex}

\newbibmacro{longcite}{%
  \printnames{labelname}%
  \setunit{\addcomma\space}%
  \iffieldundef{shortjournal}
    {\printfield{journaltitle}}
    {\printfield[journaltitle]{shortjournal}}%
  \setunit{\addcomma\space}%
  \printdate
}

\newcommand*{\mkbibsmallcolouredbrackets}[1]{%
  \textcolor{magenta}{%
    \mkbibbrackets{%
      {\scriptsize #1}%
    }%
  }%
}

\DeclareCiteCommand{\longcite}[\mkbibsmallcolouredbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{longcite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\begin{filecontents}{\jobname.bib}
@article{MR2152382,
  author       = {Hughes, Thomas J. R. and Cottrell, J. Austin and Bazilevs, Yuri},
  doi          = {10.1016/j.cma.2004.10.008},
  fjournal     = {Computer Methods in Applied Mechanics and Engineering},
  journal      = {Comput. Methods Appl. Mech. Engrg.},
  shortjournal = {CMAME},
  number       = {39-41},
  pages        = {4135--4195},
  title        = {Isogeometric Analysis:
                  {CAD}, Finite Elements, {NURBS}, Exact Geometry
                  and Mesh Refinement},
  volume       = {194},
  year         = {2005},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{sigfridsson,MR2152382}

ipsum \longcite{sigfridsson,MR2152382}


\printbibliography
\end{document}

Lorem [SR98;HCB05] ipsum [Sigfridsson 和 Ryde,《计算化学杂志》,1998 年;Hughes、Cottrell 和 Bazilevs,CMAME,2005 年]

相关内容