BibLaTeXで、タイトルとサブタイトルをコロンで区切る方法はありますが、タイトルが疑問符で終わる場合はそうではありませんか?

Dec 09 2020

BibLaTeXでは、一部の引用スタイルで行われているように、タイトルとサブタイトルをコロンで区切りたいと思います。ただし、タイトルが引用符で終わっているかどうかを検出するメカニズムが必要subtitlepunctです。引用符で終わっている場合は、を省略してください。

§4.7.3のドキュメントには次のように書かれています。

\addcolon コンマ、セミコロン、別のコロン、またはピリオドが前に付いていない限り、コロンを追加します。

そのリストに「引用符」を追加できますか?つまり、回避する解決策はあり\isdotますか?


\documentclass{article}

\begin{filecontents}{test.bib}
    @book{testbook,
      author = {A. U. Thor},
      year = {2020},
      title = {An example title?},
      subtitle = {An example subtitle}
    }
\end{filecontents}

\usepackage{biblatex}
\addbibresource{test.bib}
\renewcommand*{\subtitlepunct}{\addcolon\space}

\begin{document}
    \nocite{testbook}
    \printbibliography
\end{document}

回答

5 moewe Dec 09 2020 at 22:38

前に\addcolon、で許容可能な句読点を宣言でき\DeclarePunctuationPairsます。デフォルト設定

\DeclarePunctuationPairs{colon}{*!?}

コロンの前に省略形のドット、感嘆符、疑問符を使用できます。他のすべての句読点の後、コロンは抑制されます。

あなたはおそらく欲しい

\documentclass{article}

\usepackage{biblatex}

\renewcommand*{\subtitlepunct}{\addcolon\space}

\DeclarePunctuationPairs{colon}{*}

\begin{filecontents}{\jobname.bib}
@book{testbook,
  author   = {A. U. Thor},
  year     = {2020},
  title    = {An example title?},
  subtitle = {An example subtitle}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  \nocite{testbook}
  \printbibliography
\end{document}

これ\DeclarePunctuationPairsは通常、言語固有であるため、通常はに住む必要があることに注意しください\DefineBibliographyExtras。これは、MWE(どちらbabelもロードしないpolyglossia)では必要ありませんが、実際のアプリケーションに非常に関連している可能性があります。詳細については、Biblatex句読点の認識を参照してください。