对于关键词字段包含特定关键词的条目,自动 \fullcite

对于关键词字段包含特定关键词的条目,自动 \fullcite

对于一篇论文,我想根据所引用条目的关键词切换引用命令的行为 \cite\footcite以便 Biblatex 使用相应条目类型的参考书目驱动程序自动输出整个文本中的源文本(而不是引用文献)的引用,以创建类似于参考书目条目的完整引用(基本上是\fullcite\footfullcite)。

.tex带有文本的文件是使用以下方式生成多重降价(以及一些后续的正则表达式)并且所有引用都是使用\citeor\footcite命令创建的。

源文本是.bib文件条目,其keywords字段包含某个关键字(“quelle”),该条目还用于使用keywordBiblatex\printbibliography命令的选项为源文本生成单独的参考书目。

有没有办法使用 Biblatex 功能自动执行此操作?

我为什么需要这个?:

  • 引用来源时使用简写通常并不合适,因为在文本上下文中直接需要更多的信息(例如信件的日期和收件人)。
  • 通过分开文献和源文本的参考书目,读者可以通过速记轻松地在相应的参考书目中查找文献,同时在单独的参考书目中找到整个作品中使用的所有来源。

最小工作示例(MWE):

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\deffootnote[2em]{2em}{2em}{%
\makebox[2em][l]{\thefootnotemark}
}
\renewcommand{\footnoterule}{}
\usepackage{xpatch}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}
\usepackage{blindtext}
\usepackage[breaklinks,pdfa]{hyperref}
\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}
\ExecuteBibliographyOptions{%
  pagetracker=true,
% citation style options
  autocite=footnote,
  citetracker=context,
  ibidtracker=constrict,
  ibidpage=false,
  labeldate=true,
  uniquename=full,
  uniquelist=true,
  sortcites=true,
% bibliography style options:
  dashed=false,
  doi=false,
  eprint=false,
  isbn=false,
  sorting=nyt,
  mergedate=basic
}
%Suppressing of specific BibTeX fields:
\AtEveryBibitem{%
  \clearname{translator}%
  \clearlist{publisher}%
  \clearfield{pagetotal}%
  \clearfield{howpublished}%
  \clearfield{issn}%
  \clearfield{lccn}%
  \clearfield{annote}%
  \clearfield{language}%
}

\defbibheading{lit}{\subsection*{Bibliografie}}
\defbibheading{quellen}{\subsection*{Quellen}}
\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}
\DeclareQuoteStyle[swiss]{german}[][]%
  {«}[]{»}[]%
  {‹}[]{›}
\hypersetup{%
  hidelinks,
  unicode
}
\usepackage{marvosym}

\begin{document}
\nocite{*}
\section*{Default behavior}
A statement regarding a source text.\footcite[Default behavior: \Frowny{}][1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[Default behavior: \Smiley{}][103]{adorno_halbbildung_1959}

\section*{Wanted behavior}
A statement regarding a source text.\footfullcite[Wanted output for source texts: ][1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[Wanted output for literature: ][103]{adorno_halbbildung_1959}

\section*{Quellen und Bibliografie}
\printbibliography[heading=quellen, keyword=Quelle]
\printbibliography[heading=lit, notkeyword=Quelle]
\end{document}
\endinput

MWE 结果(脚注): 描述性脚注来说明 MWE。

所用软件:

  • XeTeX,版本 3.14159265-2.6-0.99992(TeX Live 2015/W32TeX)
  • biblatex 2015/04/19 v3.0
  • 作者年份-同上 2015/04/19 v3.0
  • biber 版本 2.1
  • Zotero 4.0.28.7

答案1

我们可以\...cite通过关键字来分支命令\ifkeyword

\newbibmacro{full:keyw}{%
  \usedriver
    {\DeclareNameAlias{sortname}{default}}
    {\thefield{entrytype}}}

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

平均能量损失

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\deffootnote[2em]{2em}{2em}{%
\makebox[2em][l]{\thefootnotemark}
}
\renewcommand{\footnoterule}{}
\usepackage{xpatch}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}

\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}
\ExecuteBibliographyOptions{%
  pagetracker=true,
% citation style options
  autocite=footnote,
  citetracker=context,
  ibidtracker=constrict,
  ibidpage=false,
  labeldate=true,
  uniquename=full,
  uniquelist=true,
  sortcites=true,
% bibliography style options:
  dashed=false,
  doi=false,
  eprint=false,
  isbn=false,
  sorting=nyt,
  mergedate=basic
}
%Suppressing of specific BibTeX fields:
\AtEveryBibitem{%
  \clearname{translator}%
  \clearlist{publisher}%
  \clearfield{pagetotal}%
  \clearfield{howpublished}%
  \clearfield{issn}%
  \clearfield{lccn}%
  \clearfield{annote}%
  \clearfield{language}%
}

\defbibheading{lit}{\subsection*{Bibliografie}}
\defbibheading{quellen}{\subsection*{Quellen}}
\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}
\DeclareQuoteStyle[swiss]{german}[][]%
  {«}[]{»}[]%
  {‹}[]{›}
\usepackage[breaklinks,pdfa]{hyperref}
\hypersetup{%
  hidelinks,
  unicode
}


\newbibmacro{full:keyw}{%
  \usedriver
    {\DeclareNameAlias{sortname}{default}}
    {\thefield{entrytype}}}

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\begin{document}
\nocite{*}
\section*{Default behavior}
A statement regarding a source text.\footcite[1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[103]{adorno_halbbildung_1959}


\section*{Quellen und Bibliografie}
\printbibliography[heading=quellen, keyword=Quelle]
\printbibliography[heading=lit, notkeyword=Quelle]
\end{document}
\endinput

您当然可以将这个更改直接合并到citebibmacro 中,这将影响所有引用命令。

\renewbibmacro*{cite}{%
  \ifkeyword{Quelle}
    {\usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}
    {\global\boolfalse{cbx:loccit}%
     \iffieldundef{shorthand}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
          {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
             {\usebibmacro{cite:label}%
              \setunit{\addspace}}
             {\printnames{labelname}%
              \setunit{\nameyeardelim}}%
           \usebibmacro{cite:labelyear+extrayear}}}
       {\usebibmacro{cite:shorthand}}}}

MWE(缩写)

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}    

\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}

\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}

\renewbibmacro*{cite}{%
  \ifkeyword{Quelle}
    {\usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}
    {\global\boolfalse{cbx:loccit}%
     \iffieldundef{shorthand}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
          {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
             {\usebibmacro{cite:label}%
              \setunit{\addspace}}
             {\printnames{labelname}%
              \setunit{\nameyeardelim}}%
           \usebibmacro{cite:labelyear+extrayear}}}
       {\usebibmacro{cite:shorthand}}}}


\begin{document}
A statement regarding a source text.\footcite[1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[103]{adorno_halbbildung_1959}
\end{document}
\endinput

两种解决方案均能

MWE 的脚注

相关内容