在 biblatex-chicago 中显示 citekey 和注释

在 biblatex-chicago 中显示 citekey 和注释

我知道在一个主题中提出两个问题是不寻常的,但它们在某种程度上是相关的:第一个是技术性的,第二个与风格有关。

第一的:我有一个.tex用作参考书目数据库的文件。它显示cite keys为红色。问题是我不能将它与注释一起使用。如果我启用语法显示cite keys,我就看不到注释。

第二:我希望注释比我用来显示参考文献的字体更小。

这是 MWE。请注意显示的部分cite keys。启用此功能后,注释将消失。

\documentclass[british]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{expl3}
\RequirePackage{fontspec}
\setmainfont{texgyretermes}[
  Ligatures = {TeX},
  Extension = {.otf},
  UprightFont = {*-regular},
  ItalicFont = {*-italic},
  BoldFont = {*-bold},
  BoldItalicFont = {*-bolditalic}
]%%
\usepackage[romanian]{babel}
\usepackage{csquotes}

\usepackage[%
  abbreviate=false,% 
  annotation, % 
  cmsbreakurl, % 
  sorting=nyt, % 
  maxnames=3, % 
  minnames=1, % 
  isbn=false, % 
  url=true, % 
  date=long, % 
  cmsdate=both, % 
  bibencoding=inputenc,%
  bibannotesep=vpar,%
  longcrossref=bib,%
  bookpages=true,%
  doi=true,%
  related=true,%
  notes]%
{biblatex-chicago}

% Show citekeys at the end of reference

\DeclareFieldFormat{entrykey}{%
  \textcolor{red}{%
    \mkbibbrackets{#1}}}

\renewbibmacro*{finentry}{%
  \setunit{\finentrypunct\addspace}%
  \printfield{entrykey}%
  \renewcommand\finentrypunct{}%
  \finentry
}

\NewBibliographyString{revisededition}
\DefineBibliographyStrings{romanian}{revisededition = {ediție revizuită}}

% divide bibliography by keywords
% see https://tex.stackexchange.com/questions/634876/biblatex-bibliography-divided-by-every-keyword

\ExplSyntaxOn
\makeatletter
\def\blx@addkeyword#1#2{%
  \seq_if_exist:cF {g_hchr_keyword_\the\c@refsection _seq}
    {
      \seq_new:c {g_hchr_keyword_\the\c@refsection _seq}
    }
  \seq_if_in:cxF {g_hchr_keyword_\the\c@refsection _seq} {\detokenize{#2}}
    {
      \seq_gput_left:cx {g_hchr_keyword_\the\c@refsection _seq} {\detokenize{#2}}
    }
  \listcsxadd{blx@keyw@\the\c@refsection @\detokenize{#2}}{#1}}

\newcommand*{\DefineKeywordTitle}[2]{%
  \csdef{keyword@title@\detokenize{#1}}{#2}}

\def\blx@bibbykeyword@i#1{%
  \ifcsundef{keyword@title@\detokenize{#1}}
    {\printbibliography[keyword=#1, title=#1]}
    {\printbibliography[keyword=#1, title=\csuse{keyword@title@\detokenize{#1}}]}}

\newcommand*{\bibbykeyword}
  {
    \seq_if_exist:cT {g_hchr_keyword_\the\c@refsection _seq}
      {
        \seq_sort:cn {g_hchr_keyword_\the\c@refsection _seq}
          {
            \str_compare:nNnTF { ##1 } > { ##2 }
              { \sort_return_swapped: }
              { \sort_return_same: }
          }

        \seq_map_function:cN {g_hchr_keyword_\the\c@refsection _seq} \blx@bibbykeyword@i
      }
  }
\makeatother
\ExplSyntaxOff

\usepackage[linkcolor=red,
            colorlinks=true,
            citecolor=black,
            bookmarksnumbered=true,
            bookmarksopen=true,
            unicode]
            {hyperref}
\usepackage{url}

\begin{filecontents}[overwrite]{\jobname.bib}
@string{oup      = {Oxford University Press}}
@string{cup      = {Cambridge University Press}}
@book{abbott:introduction,
    title        = {An introduction to narrative},
    author       = {Abbott, Porter H.},
    year         = 2002,
    location     = {Cambridge},
    publisher    = cup,
    isbn         = {0-521-65969-8},
    pagetotal    = 200,
    keywords     = {literary theory,narrativity},
    annotation   = {[A published collection of letters, in a Book entry
                  rather than Letter. References to it would be by
                  page rather than by individual letter.]}
}
@book{barnes:aristotle,
    title        = {Aristotle},
    subtitle     = {A very short introduction},
    author       = {Barnes, Jonathan},
    year         = 2000,
    location     = {Oxford},
    publisher    = oup,
    series       = {Very short introductions},
    volume       = 32,
    isbn         = {0192854089},
    pubstate     = {revisededition},
    keywords     = {philosophy},
    annotation   = {[The influence of Aristotle, the prince of philosophers, on the intellectual history of the West is second to none. In this book, Jonathan Barnes examines Aristotle's scientific researches, his discoveries in logic and his metaphysical theories, his work in psychology and in ethics and politics, and his ideas about art and poetry, placing his teachings in their historical context.]}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\bibbykeyword
\end{document}

答案1

对于用于打印输入键的biblatex-chicagobibmacro ,其定义略有不同,我们需要将其考虑在内。finentry

注释的字体大小可以\DeclareFieldFormat照常控制。

\documentclass[british]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{expl3}
\RequirePackage{fontspec}
\setmainfont{texgyretermes}[
  Ligatures = {TeX},
  Extension = {.otf},
  UprightFont = {*-regular},
  ItalicFont = {*-italic},
  BoldFont = {*-bold},
  BoldItalicFont = {*-bolditalic}
]%%
\usepackage[romanian]{babel}
\usepackage{csquotes}

\usepackage[%
  abbreviate=false,% 
  annotation, % 
  cmsbreakurl, % 
  sorting=nyt, % 
  maxnames=3, % 
  minnames=1, % 
  isbn=false, % 
  url=true, % 
  date=long, % 
  cmsdate=both, % 
  bibencoding=inputenc,%
  bibannotesep=vpar,%
  longcrossref=bib,%
  bookpages=true,%
  doi=true,%
  related=true,%
  notes]%
{biblatex-chicago}

\DeclareFieldFormat{annotation}{\small#1}%

\DeclareFieldFormat{entrykey}{%
  \textcolor{red}{%
    \mkbibbrackets{#1}}}

\renewbibmacro*{finentry}{%
  \setunit{\finentrypunct\addspace}%
  \printfield{entrykey}%
  \renewcommand\finentrypunct{}%
  \togglefalse{cms@switchdates}%
  \ifboolexpr{%
    togl {cms@annotation}%
    or
    togl {cms@cbxannote}%
  }%
    {\usebibmacro{entrytail}}%
    {}%
  \finentry}

\NewBibliographyString{revisededition}
\DefineBibliographyStrings{romanian}{revisededition = {ediție revizuită}}

% divide bibliography by keywords
% see https://tex.stackexchange.com/questions/634876/biblatex-bibliography-divided-by-every-keyword

\ExplSyntaxOn
\makeatletter
\def\blx@addkeyword#1#2{%
  \seq_if_exist:cF {g_hchr_keyword_\the\c@refsection _seq}
    {
      \seq_new:c {g_hchr_keyword_\the\c@refsection _seq}
    }
  \seq_if_in:cxF {g_hchr_keyword_\the\c@refsection _seq} {\detokenize{#2}}
    {
      \seq_gput_left:cx {g_hchr_keyword_\the\c@refsection _seq} {\detokenize{#2}}
    }
  \listcsxadd{blx@keyw@\the\c@refsection @\detokenize{#2}}{#1}}

\newcommand*{\DefineKeywordTitle}[2]{%
  \csdef{keyword@title@\detokenize{#1}}{#2}}

\def\blx@bibbykeyword@i#1{%
  \ifcsundef{keyword@title@\detokenize{#1}}
    {\printbibliography[keyword=#1, title=#1]}
    {\printbibliography[keyword=#1, title=\csuse{keyword@title@\detokenize{#1}}]}}

\newcommand*{\bibbykeyword}
  {
    \seq_if_exist:cT {g_hchr_keyword_\the\c@refsection _seq}
      {
        \seq_sort:cn {g_hchr_keyword_\the\c@refsection _seq}
          {
            \str_compare:nNnTF { ##1 } > { ##2 }
              { \sort_return_swapped: }
              { \sort_return_same: }
          }

        \seq_map_function:cN {g_hchr_keyword_\the\c@refsection _seq} \blx@bibbykeyword@i
      }
  }
\makeatother
\ExplSyntaxOff

\usepackage[linkcolor=red,
            colorlinks=true,
            citecolor=black,
            bookmarksnumbered=true,
            bookmarksopen=true,
            unicode]
            {hyperref}
\usepackage{url}

\begin{filecontents}{\jobname.bib}
@string{oup      = {Oxford University Press}}
@string{cup      = {Cambridge University Press}}
@book{abbott:introduction,
    title        = {An introduction to narrative},
    author       = {Abbott, Porter H.},
    year         = 2002,
    location     = {Cambridge},
    publisher    = cup,
    isbn         = {0-521-65969-8},
    pagetotal    = 200,
    keywords     = {literary theory,narrativity},
    annotation   = {[A published collection of letters, in a Book entry
                  rather than Letter. References to it would be by
                  page rather than by individual letter.]}
}
@book{barnes:aristotle,
    title        = {Aristotle},
    subtitle     = {A very short introduction},
    author       = {Barnes, Jonathan},
    year         = 2000,
    location     = {Oxford},
    publisher    = oup,
    series       = {Very short introductions},
    volume       = 32,
    isbn         = {0192854089},
    pubstate     = {revisededition},
    keywords     = {philosophy},
    annotation   = {[The influence of Aristotle, the prince of philosophers, on the intellectual history of the West is second to none. In this book, Jonathan Barnes examines Aristotle's scientific researches, his discoveries in logic and his metaphysical theories, his work in psychology and in ethics and politics, and his ideas about art and poetry, placing his teachings in their historical context.]}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\bibbykeyword
\end{document}

Abbott,Porter H.,《叙事导论》,剑桥:剑桥大学出版社,2002 年。[abbott:导论]。[已出版的书信集,属于书籍条目,而非信函条目。对它的引用将按页而不是按单个信件。]

相关内容