\footfullcite
占用太多空间,所以我决定定义一个自己的命令。我把它叫做\footshortcite
。它只显示前置和后置选项以及作者和年份。但是,我不喜欢我的新命令在脚注中显示的大部分引文只使用行长的 1/4 或 1/3,所以我想把引文的标题放在顶部,并在 X 个字符后截断,这样脚注引文的长度就大约是整行的长度。
我尝试过xstring
但它似乎\citetitle
不能完全扩展,所以\StrLeft
对它没有影响。
我做错了什么吗?或者我是对的,这是不可能的?
\RequirePackage{filecontents}
\begin{filecontents*}{Literatur.bib}
@BOOK{denz2005,
author = {Denz, Hermann},
title = {Grundlagen einer empirischen Soziologie: Der Beitrag des quantitativen
Ansatzes},
publisher = {Lit},
location = {M\"unster},
year = {2005}
}
\end{filecontents*}
\documentclass{scrartcl}
\usepackage[style=authoryear]{biblatex}
\bibliography{Literatur}
\usepackage{optparams}
\usepackage{xstring}
\def\footshortciteintern[#1][#2]#3{%
\ifx#1\empty
% Nur Autor
\footnote{\citeauthor{#3}, \citeyear{#3}.}
\else
\ifx#2\empty
% Autor und Seite
\footnote{\citeauthor{#3}, \citeyear{#3}, #1.}
\else
% Autor, Seite und vgl.
\expandafter
\footnote{#1 \citeauthor{#3}, \StrLeft{\citetitle{#3}}{10}, \citeyear{#3}, #2.}
\fi
\fi
}
\newcommand*\footshortcite{%
\optparams{\footshortciteintern}{[\empty][\empty]}
}
\begin{document}
Hallo \footshortcite[vgl.][S.111]{denz2005}
%\footshortcite[S.111]{denz2005}
%\footshortcite{denz2005}
\end{document}
答案1
最好的选择是biblatex
。\DeclareCiteCommand
它使您能够轻松地将书目数据传递给xstring
,根据条目类型格式化标题并定义新引文命令的多引用版本。
标题截断通常可能效果不佳(见下图)。我添加了一个利用shorttitle
输入字段的替代方案。
xstring
这里使用的唯一宏是StrLeft
,因此可以在手册中找到有关该代码如何工作的详细信息biblatex
。
\documentclass{scrartcl}
\usepackage[style=authoryear]{biblatex}
\usepackage{csquotes}
\usepackage[german]{babel}
\usepackage{xstring}
\usepackage{filecontents}
\DeclareFieldFormat[article]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[book]{citetitle}{\mkbibemph{#1}}
\DeclareCiteCommand{\foottrunccite}[\mkbibfootnote]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:trunc}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newbibmacro*{cite:trunc}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}%
\iffieldundef{title}
{}
{\addcomma\addspace%
\printtext[citetitle]{\StrLeft{\thefield{labeltitle}}{10}}}}
{\usebibmacro{cite:shorthand}}}
\DeclareCiteCommand{\footshortcite}[\mkbibfootnote]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:title}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newbibmacro*{cite:title}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}%
\setunit{\addcomma\addspace}
\iffieldundef{shorttitle}
{\printfield[citetitle]{labeltitle}}
{\printfield[citetitle]{shorttitle}}}
{\usebibmacro{cite:shorthand}}}
\DeclareMultiCiteCommand{\footshortcites}[\mkbibfootnote]%
{\footshortcite}{\multicitedelim}
\DeclareMultiCiteCommand{\foottrunccites}[\mkbibfootnote]%
{\foottrunccite}{\multicitedelim}
\begin{filecontents*}{\jobname.bib}
@BOOK{denz2005,
author = {Denz, Hermann},
title = {Grundlagen einer empirischen Soziologie: Der Beitrag des quantitativen Ansatzes},
shorttitle = {Grundlagen einer empirischen Soziologie},
publisher = {Lit},
location = {M\"unster},
year = {2005}}
@ARTICLE{angenendt,
author = {Angenendt, Arnold},
title = {In Honore Salvatoris~-- Vom Sinn und Unsinn der Patrozinienkunde},
shorttitle = {In Honore Salvatoris},
journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
volume = {97},
date = {2002},
pages = {431--456}}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
Vanilla footcite.\footcite[vgl.][111]{denz2005}
Vanilla footcites.\footcites[vgl.][111]{denz2005}[456]{angenendt}
Like footcite, but with short title.\footshortcite[vgl.][111]{denz2005}
Like footcites, but with short title.\footshortcites[vgl.][111]{denz2005}[456]{angenendt}
Like footcite, but with truncated title.\foottrunccite[vgl.][111]{denz2005}
Like footcites, but with truncated title.\foottrunccites[vgl.][111]{denz2005}[456]{angenendt}
\end{document}