biblatex
我正在尝试修改beamer
。使用这个问题和这个后续问题我已经愉快地使用了生成的代码(参见下面的 MWE)一段时间,得到了以下输出:
在准备新的演讲时,我决定采用一种不同的(更短的)引用风格,如下所示:
与“作者,期刊期刊卷,页数(年份)”。
有办法实现这个吗?我尝试使用与期刊名称相同的技巧来获取期刊卷,但我得到了! Package biblatex Error: Bibliography macro 'volume' undefined.
甚至可以有一个预定义吗citation-style
?我很感激任何想法。
MWE(注意:documentclass
此 MWE 中的 是article
,而不是beamer
,因为它不会影响此情况下的行为):
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@article{article,
author = {Vimes, Samuel},
title = {The Influence of Species Diversity in the City Watch},
journal = {Unseen University Non-Magical Journal},
volume = {4},
pages = {42--37},
date = {1988}
}
\end{filecontents}
\usepackage[backend=biber,maxcitenames=1,maxbibnames=2,
giveninits=true]{biblatex}
\addbibresource{bib.bib}
% previous citation style
\DeclareCiteCommand{\citejournal}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\ifentrytype{article}{\usebibmacro{journal}\addcomma\addspace}{}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newcommand{\cfootcite}[1]{
{\tiny{\citeauthor{#1}, \citetitle{#1}, \citejournal{#1}\citeyear{#1}}}} % to get author, title, journal, year
% attempt at new style
\DeclareCiteCommand{\citevolume}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\ifentrytype{article}{\usebibmacro{volume}\addcomma\addspace}{}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1\isdot}}
\newcommand{\cfootcitenew}[1]{
{\tiny{\citeauthor{#1}, \citejournal{#1}\citevolume{#1}(\citeyear{#1})}}} % to get author, journal, journal number, year
\begin{document}
Old style:
\cfootcite{article}
Attempt new style:
\cfootcitenew{article}
\end{document}
输出(忽略错误):
答案1
我强烈建议不要将几个高级\cite...
命令放在一起\newcommand
。(在某些情况下,这可能会导致引用跟踪的实际问题,但通常只是增加了不必要的工作量。)
创建新引文命令的常用方法是用 来定义它\DeclareCiteCommand
。通常此命令会将所有繁重的工作委托给bibmacro
。
\documentclass{article}
\usepackage[backend=biber,
maxcitenames=1,maxbibnames=2,
giveninits=true]{biblatex}
\newcommand*{\mktexttiny}[1]{{\normalsize #1}}
% the definition should of course be {{\tiny #1}},
% but \normalsize is easier to read in the MWE
\DeclareCiteCommand{\cfootcitenew}[\mktexttiny]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cfootcitenew}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newbibmacro*{cfootcitenew}{%
\printnames{labelname}%
\setunit{\addcomma\space}%
\ifentrytype{article}
{\printfield{journaltitle}%
\setunit{\addspace}%
\printfield{volume}%
\setunit{\addcomma\space}%
\printfield{pages}}
{\printfield{labeltitle}}%
\setunit{\addspace}%
\DeclareFieldFormat{date}{\mkbibparens{##1}}%
\printdate
}
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat{pages}{#1}
\begin{filecontents}[force]{\jobname.bib}
@article{article,
author = {Vimes, Samuel},
title = {The Influence of Species Diversity in the City Watch},
journal = {Unseen University Non-Magical Journal},
volume = {4},
pages = {42--37},
date = {1988},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cfootcitenew{article}
\end{document}