0

I'm trying to customize citations in beamer.

Let me include a minimal working example.

\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}

Here is the output I get.

enter image description here

enter image description here

I would like to customize the command \longcite in such a way that I could refer just to the family names of the authors and an abbreviated name of the journal (provided there is such a field in the respective bibliography item), e.g., CMAME in this case. Any help?

Let us assume that the bibliography item reads as follows.

@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 Answer 1

0

beamer is largely irrelevant for your request, so in the code example below I will switch to the standard article class. Of course the answer still works with beamer.

In the biblatex standard model the field for the abbreviated journal name is shortjournal and not journal_abbr. If you switch from journal_abbr to shortjournal, you can use the following idea.

The definition of \longcite is modelled more closely on the definition of cite commands of the standard styles.

\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 and Ryde, Journal of Computational Chemistry, 1998; Hughes, Cottrell, and Bazilevs, CMAME, 2005]

2
  • Thank you a lot for the very clear answer! Best regards, Riccardo
    – avati91
    Commented Jan 14, 2022 at 12:39
  • and if I want to refer to the year as the last two digits, e.g. instead of 2017 just 17. How should I proceed?
    – avati91
    Commented Jan 14, 2022 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .