要使用 \textcite 引用内联标准,需要进行哪些修改

要使用 \textcite 引用内联标准,需要进行哪些修改

我正在尝试在文档文本中引用一个标准。关于这个主题如何在 BibLaTeX 中引用标准(ISO等)?我创建了一个适合我需要的 labelalpha 和一个参考书目条目,但我无法修改 textcite 命令。

这里是 MWE:

\documentclass{article}

\begin{filecontents}{Biblio.bib}
@standard{ASI1234_1,
 year = {1999},
 title = {somethings special in the world, that has to be defined},
 urldate = {2012-09-10},
 number = {1234-1},
 date = {1999-04},
 type = {ASI},
 version = {1999-04},
 organization = {{ASI}}
}
\end{filecontents}

%%Definition einer Normenklasse für Biblatex
\begin{filecontents}{standards.dbx}
%Modifikation für Normen in Biblatex
\DeclareDatamodelEntryfields[standard]{number,type}
\end{filecontents}

%Pakete für das Literaturverzeichnis mit BibLatex und Einstellung
\usepackage[
    style=alphabetic,
%   style=draft,
    backend=biber,
    datamodel=standards]{biblatex}
\addbibresource{Biblio.bib}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %et al. statt u.a.
%\DefineBibliographyStrings{ngerman}{and={\&}} % und zu & machen
\renewcommand*{\labelalphaothers}{} %Zeichen für mehrere Authoren in Abkürzung löschen

%Label für Standard
    \DeclareLabelalphaTemplate[standard]{
     \labelelement{ %
      \field{type} %
      } %
      \labelelement{ %
        \field{number} %
      } %
      \labelelement{ %
        \literal{:} %
      } %
      \labelelement{ %
        \field{year} %
      } %
    } %
%Eintrag Bibliographie    
    \DeclareBibliographyDriver{standard}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printfield{type}%
      \setunit{\addspace}\newblock%
      \printfield{number}%
      \setunit{\addcolon}\newblock%
      \printfield{year}%
      \iffieldundef{month}{%
        \setunit{\addspace}\newblock}%
        {\setunit{\addperiod}}%
      \printfield{month} %
      \setunit*{\addspace}\newblock %
      \usebibmacro{title}%
   \usebibmacro{finentry}}

\begin{document}
Blablablabba \textcite[10-12]{ASI1234_1} Balbabab
\printbibliography
\end{document}

在此处输入图片描述

我想仅针对 entrytype 标准修改 textcite 命令。我发现 textcite 命令首先检查 labelname 字段,如果该字段为空,它将使用 labeltitle 字段。这就是为什么使用 textcite 命令会打印完整标题的原因。labeltitle 字段按特定顺序分析几个标题字段。因为我有大量标准,所以在 .bib 文件中定义短标题不是一个好选择。是否可以动态创建用户定义的短标题,以便 textcite 命令使用它而不是完整标题?

结果应如下所示:ASI 1234 [ASI1234:1999, S. 10-12]

答案1

它看起来像一个工作\DeclareSourcemap

\documentclass{article}

\begin{filecontents}{Biblio.bib}
@standard{ASI1234_1,
 year = {1999},
 title = {somethings special in the world, that has to be defined},
 urldate = {2012-09-10},
 number = {1234-1},
 date = {1999-04},
 type = {ASI},
 version = {1999-04},
 organization = {{ASI}}
}
\end{filecontents}

%%Definition einer Normenklasse für Biblatex
\begin{filecontents}{standards.dbx}
%Modifikation für Normen in Biblatex
\DeclareDatamodelEntryfields[standard]{number,type}
\end{filecontents}

%Pakete für das Literaturverzeichnis mit BibLatex und Einstellung
\usepackage[
    style=alphabetic,
%   style=draft,
    backend=biber,
    datamodel=standards]{biblatex}
\addbibresource{Biblio.bib}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %et al. statt u.a.
%\DefineBibliographyStrings{ngerman}{and={\&}} % und zu & machen
\renewcommand*{\labelalphaothers}{} %Zeichen für mehrere Authoren in Abkürzung löschen

%Label für Standard
    \DeclareLabelalphaTemplate[standard]{
     \labelelement{ %
      \field{type} %
      } %
      \labelelement{ %
        \field{number} %
      } %
      \labelelement{ %
        \literal{:} %
      } %
      \labelelement{ %
        \field{year} %
      } %
    } %
%Eintrag Bibliographie    
    \DeclareBibliographyDriver{standard}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printfield{type}%
      \setunit{\addspace}\newblock%
      \printfield{number}%
      \setunit{\addcolon}\newblock%
      \printfield{year}%
      \iffieldundef{month}{%
        \setunit{\addspace}\newblock}%
        {\setunit{\addperiod}}%
      \printfield{month} %
      \setunit*{\addspace}\newblock %
      \usebibmacro{title}%
   \usebibmacro{finentry}}


\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map[overwrite]{
            \pertype{standard}
            \step[fieldsource=type, fieldset=shorttitle, origfieldval]
            \step[fieldset=shorttitle,fieldvalue={\addspace}, append]
            \step[fieldsource=number, fieldset=shorttitle, origfieldval, append]
        }
    }
}

\begin{document}
Blablablabba \textcite[10-12]{ASI1234_1} Balbabab
\printbibliography
\end{document}

在此处输入图片描述

答案2

如果你正在寻找一个真正的即时解决方案,定义

\makeatletter
\newcommand*{\redeflabeltitle}[1]{\AtNextCitekey{\csdef{abx@field@labeltitle}{#1}}}
\makeatother

在你的序言中,然后使用它作为

\redeflabeltitle{Eine tolle Norm}\textcite{ASI1234_1}

在文档中。

shorttitle但实际上,在文件中给出一个会更加干净.bib,所以事情确实是一致的。

答案3

快速破解:

\documentclass{article}

\begin{filecontents}{Biblio.bib}
@standard{ASI1234_1,
 year = {1999},
 title = {somethings special in the world, that has to be defined},
 urldate = {2012-09-10},
 number = {1234-1},
 date = {1999-04},
 type = {ASI},
 version = {1999-04},
 organization = {{ASI}}
}
\end{filecontents}

%%Definition einer Normenklasse für Biblatex
\begin{filecontents}{standards.dbx}
%Modifikation für Normen in Biblatex
\DeclareDatamodelEntryfields[standard]{number,type}
\end{filecontents}

%Pakete für das Literaturverzeichnis mit BibLatex und Einstellung
\usepackage[
    style=alphabetic,
%   style=draft,
    backend=biber,
    datamodel=standards]{biblatex}
\addbibresource{Biblio.bib}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %et al. statt u.a.
%\DefineBibliographyStrings{ngerman}{and={\&}} % und zu & machen
\renewcommand*{\labelalphaothers}{} %Zeichen für mehrere Authoren in Abkürzung löschen

%Label für Standard
    \DeclareLabelalphaTemplate[standard]{
     \labelelement{ %
      \field{type} %
      } %
      \labelelement{ %
        \field{number} %
      } %
      \labelelement{ %
        \literal{:} %
      } %
      \labelelement{ %
        \field{year} %
      } %
    } %
%Eintrag Bibliographie    
    \DeclareBibliographyDriver{standard}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printfield{type}%
      \setunit{\addspace}\newblock%
      \printfield{number}%
      \setunit{\addcolon}\newblock%
      \printfield{year}%
      \iffieldundef{month}{%
        \setunit{\addspace}\newblock}%
        {\setunit{\addperiod}}%
      \printfield{month} %
      \setunit*{\addspace}\newblock %
      \usebibmacro{title}%
   \usebibmacro{finentry}}

\makeatletter
\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\setunit{\multicitedelim}}
    {\ifentrytype{standard}{}{\ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \printdelim{namelabeldelim}\bibopenbracket}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}}%
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \ifentrytype{standard}{\printfield{type}\printfield{number}}{\usebibmacro{cite}}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibclosebracket\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}
\makeatother


\begin{document}
Blablablabba \textcite{ASI1234_1} Balbabab
\printbibliography
\end{document}

相关内容