新的 cite 命令吞掉标点符号

新的 cite 命令吞掉标点符号

我定义了一个新的 cite 命令来shorttitle代替author-year组合。问题是它会吞掉后面的标点符号。

我尝试使用\DeclareCitePunctuationPosition,但无济于事。

我怎样才能解决这个问题?

\documentclass{article}
\usepackage{biblatex-chicago}

\DeclareCiteCommand{\citeabbr}
{\usebibmacro{cite:init}%
  \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\textit{\printfield{shorttitle}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
  
\DeclareCitePunctuationPosition{\citeabbr}{r} % doesn't work

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Howlett1975,
  title = {Dictionary of Medieval Latin from British Sources},
  shorttitle = {DMLBS},
  editor = {Howlett, D.R.},
  date = {1975/2013},
  publisher = {Oxford University Press},
  location = {Oxford},
  addendum = {DMLBS},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\usepackage{hyperref}    

\begin{document}
  \citeabbr[s.v.]{Howlett1975}; this cite command has swallowed my semicolon.
\end{document}

在此处输入图片描述

答案1

biblatex有一个非常复杂的系统来避免不良的双重标点或标点冲突。

特别biblatex是会抑制句末句号(句号)后的任何标点符号。因此 '.;' 变为 '.'。“问题”在于您不想抑制表示缩写的点后的逗号或分号,因此 'sv;' 完全没问题,不需要简化为 'sv'。由于 '.' 本质上有两个功能,因此您必须帮助biblatex并在键入 时告诉它您的意思.。默认情况下,biblatex假定 a.是句号。如果您想输入缩写点,您可以说\adddot或只是.\isdot

因此,下面可以正常显示“sv;”。

\documentclass{article}
\usepackage{biblatex-chicago}

\DeclareCiteCommand{\citeabbr}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\printfield[emph]{shorttitle}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\begin{filecontents}{\jobname.bib}
@book{Howlett1975,
  title = {Dictionary of Medieval Latin from British Sources},
  shorttitle = {DMLBS},
  editor = {Howlett, D.R.},
  date = {1975/2013},
  publisher = {Oxford University Press},
  location = {Oxford},
  addendum = {DMLBS},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\usepackage{hyperref}

\begin{document}
  \citeabbr[s.v.\isdot]{Howlett1975}; this cite command has swallowed my semicolon.
\end{document}

DMLBS,sv;这个cite命令已经吞掉了我的分号。


如果.文章注释结尾的所有 s 都是缩写点,你可以通过修改postnote字段格式来自动执行此操作(原始定义可以在 中找到chicago-notes.cbx

\DeclareFieldFormat{postnote}{% Changed for page compression option
  \ifboolexpr{%
    togl {cms@comprange}%
    and
    test {\ifpages{#1}}%
  }%
  {\iffieldundef{pagination}%
    {\mkcomprange{#1}}%
    {\mkcomprange[{\mkpageprefix[pagination]}]{#1}}}%
  {\iffieldundef{pagination}%
    {#1}%
    {\mkpageprefix[pagination]{#1}}%
   \isdot}}%

\isdot这样,您就不必每次在后记中使用时都书写s.v.。但这当然意味着.后记末尾的句号不会被识别。


如果您经常使用s.v.,您可能希望为其定义一个方便的命令,以避免需要\isdot

\documentclass{article}
\usepackage{biblatex-chicago}

\DeclareCiteCommand{\citeabbr}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\printfield[emph]{shorttitle}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\NewBibliographyString{sv}
\DefineBibliographyStrings{english}{
  sv = {s\adddot v\adddot},
}
\newcommand*{\sv}{\bibstring{sv}}

\begin{filecontents}{\jobname.bib}
@book{Howlett1975,
  title = {Dictionary of Medieval Latin from British Sources},
  shorttitle = {DMLBS},
  editor = {Howlett, D.R.},
  date = {1975/2013},
  publisher = {Oxford University Press},
  location = {Oxford},
  addendum = {DMLBS},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\usepackage{hyperref}


\begin{document}
  \citeabbr[\sv]{Howlett1975}; this cite command has swallowed my semicolon.
\end{document}

相关内容