我想改变\citetitle
特定源类型的行为,即standardisodin
(我从这里)。
我已经设法根据自己的喜好获得了正确的参考书目顺序,但我不知道如何调整它以在文档中引用标题。
附带问题:Type
和Number
也应该用斜体吗?我喜欢我打算使用的版本,除非它有什么根本性的错误。
编辑
我也很乐意手动打印出其他字段,所以我会写一些类似的东西
\print{Type}{abc}~\print{Number}{abc}:~\citetitle{abc}
或者。
图片
平均能量损失
\documentclass[
a4paper,
12pt,
]{scrartcl}
%%%Tipps: https://tex.stackexchange.com/questions/12806/guidelines-for-customizing-biblatex-styles/13076#13076
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[
language=auto,
style=authoryear-ibid,
backend=biber,
hyperref=true,
dashed=false,
isbn=false,
doi=false,
maxcitenames=2,
maxbibnames=99,
sorting=nyt,
firstinits=true,
uniquename=init,
uniquelist=false,
autocite=footnote,
ibidtracker=true,
date=comp,
mincrossrefs=1,
]{biblatex}
\usepackage{xpatch}
%definition of new source type: Standard (ISO, DIN, or other guidelines)
\DeclareDatamodelEntrytypes{standardisodin}
\DeclareDatamodelEntryfields[standardisodin]{type,number}
\DeclareBibliographyDriver{standardisodin}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\printfield{type}\addspace%
\printfield{number}\addcolon\addspace%
\usebibmacro{title}\addspace%
\newunit\newblock
\usebibmacro{location+date}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\usebibmacro{related}%
\usebibmacro{finentry}}
\begin{filecontents}{\jobname.bib}
@Standardisodin{abc,
Title = {Metallische Werkstoffe -- Zugversuch -- Teil 2: Pr{"u}fverfahren bei erhöhter Temperatur},
Author = {{DIN Deutsches Institut für Normung e.~V.}},
Date = {2011-05},
Location = {Berlin},
Number = {6892-2},
Type = {DIN EN ISO},
Year = {2011},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
\listfiles
\begin{document}
So this is a sentence: as \verb+\citetitle{abc}+ shows, there is no \verb+Number+ nor \verb+Type+ printed:
\begin{flushleft}
\citetitle{abc}
\end{flushleft}
So now, when using \verb+\citetitle+ for this source type, I'd like to have the following output\ldots
\begin{verbatim}
[Type][space][Number][colon][space][Title]
\end{verbatim}
\ldots so it'll produce
\begin{flushleft}
DIN EN ISO 6892-2: \textit{Metallische Werkstoffe -- Zugversuch -- Teil 2: Prüfverfahren bei erhöhter Temperatur}
\end{flushleft}
in the text.
Question on the side: or should the type and number be in italics as well? I like the version I intend to use, unless there is something fundamentally wrong with it I suppose.
\end{document}
答案1
我们可以在定义中添加一点“逻辑” \citetitle
:我们检查该条目是否是标准,如果是,则打印附加信息
\DeclareCiteCommand{\citetitle}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexfield{indextitle}}
{}%
% this is new
\ifentrytype{standardisodin}
{\printfield{type}%
\setunit{\addspace}%
\printfield{number}%
\setunit{\addcolon\space}}
{}
% here ends the new stuff
\printfield[citetitle]{labeltitle}}
{\multicitedelim}
{\usebibmacro{postnote}}
作为额外的奖励,这个重新定义
\renewbibmacro*{cite}{%
\global\boolfalse{cbx:loccit}%
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}
{% this is new
\ifentrytype{standardisodin}
{\printfield{type}%
\setunit{\addspace}%
\printfield{number}}
% ... until here (save for two new curly braces below)
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}}}}
{\usebibmacro{cite:shorthand}}}
将\cite{abc}
打印“DIN EN ISO 6892-2”。
虽然 的定义\citetitle
适用于(几乎)所有(标准)样式,但 的重新定义\cite
特定于authoryear-ibid
,但该想法可以抽象并应用于其他cite
宏。
平均能量损失
\documentclass[
a4paper,
12pt,
]{scrartcl}
%%%Tipps: http://tex.stackexchange.com/questions/12806/guidelines-for-customizing-biblatex-styles/13076#13076
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{filecontents}
\usepackage[
language=auto,
style=authoryear-ibid,
backend=biber,
hyperref=true,
dashed=false,
isbn=false,
doi=false,
maxcitenames=2,
maxbibnames=99,
sorting=nyt,
firstinits=true,
uniquename=init,
uniquelist=false,
autocite=footnote,
ibidtracker=true,
date=comp,
mincrossrefs=1,
]{biblatex}
%definition of new source type: Standard (ISO, DIN, or other guidelines)
\DeclareDatamodelEntrytypes{standardisodin}
\DeclareDatamodelEntryfields[standardisodin]{type,number}
\DeclareBibliographyDriver{standardisodin}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\printfield{type}\addspace%
\printfield{number}\addcolon\addspace%
\usebibmacro{title}\addspace%
\newunit\newblock
\usebibmacro{location+date}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\usebibmacro{related}%
\usebibmacro{finentry}}
\begin{filecontents*}{\jobname.bib}
@Standardisodin{abc,
Title = {Metallische Werkstoffe -- Zugversuch -- Teil 2: Prüfverfahren bei erhöhter Temperatur},
Author = {{DIN Deutsches Institut für Normung e.~V.}},
Date = {2011-05},
Location = {Berlin},
Number = {6892-2},
Type = {DIN EN ISO},
}
\end{filecontents*}
\DeclareCiteCommand{\citetitle}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexfield{indextitle}}
{}%
\ifentrytype{standardisodin}
{\printfield{type}%
\setunit{\addspace}%
\printfield{number}%
\setunit{\addcolon\space}}
{}
\printfield[citetitle]{labeltitle}}
{\multicitedelim}
{\usebibmacro{postnote}}
\renewbibmacro*{cite}{%
\global\boolfalse{cbx:loccit}%
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}
{\ifentrytype{standardisodin}
{\printfield{type}%
\setunit{\addspace}%
\printfield{number}}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}}}}
{\usebibmacro{cite:shorthand}}}
\addbibresource{\jobname.bib}
\nocite{*}
\begin{document}
\cite{abc}
So this is a sentence: as \verb+\citetitle{abc}+ shows, there is no \verb+Number+ nor \verb+Type+ printed:
\begin{flushleft}
\citetitle{abc}
\end{flushleft}
So now, when using \verb+\citetitle+ for this source type, I'd like to have the following output\ldots
\begin{verbatim}
[Type][space][Number][colon][space][Title]
\end{verbatim}
\ldots so it'll produce
\begin{flushleft}
DIN EN ISO 6892-2: \textit{Metallische Werkstoffe -- Zugversuch -- Teil 2: Prüfverfahren bei erhöhter Temperatur}
\end{flushleft}
in the text.
Question on the side: or should the type and number be in italics as well? I like the version I intend to use, unless there is something fundamentally wrong with it I suppose.
\end{document}
关于您旁边的小问题:如果您将“DIN EN ISO 6892-2”部分也设置为斜体,我认为看起来会很奇怪,至于以这种方式引用标准是否合理:在我看来没问题:-)
。我更希望能够使用\cite
来引用条目,而不是使用\citetitle
。但是,用标准引用这些条目会很奇怪authoryear-ibid
\cite
,因为“Deutsches Institut für Normung e. V. 2011”对于标签来说真的没什么用,“DIN EN ISO 6892-2”似乎是指代它们的更常见形式(这就是上面第二个定义的用途)。