如何確保腳註的首字母始終大寫?

如何確保腳註的首字母始終大寫?

我的朋友有一個問題,他\footcite與 一起使用authorstyle-icomp並想要“同上”之類的東西。 (德語 ebd)當它們位於 . 的開頭時要大寫footnote。此外,他的參考書目還包括阿拉伯姓氏,如“al-Kabir”,如果 afootnote以這些姓氏開頭,也需要大寫。大致如此:腳註始終必須以大寫字母開頭。

我嘗試用​​我在以下位置找到的巨集來解決問題https://stackoverflow.com/questions/2818119/automatically-capitalize-first-letter-of-first-word-in-a-new-sentence-in-latex( \uppercasesingleletter),不幸的是 (a) 仍然將所有內容大寫,並且 (b) 不允許將其自身整合到更新的footnote命令中。

這是最小的不起作用的範例:

\documentclass{scrartcl}

\usepackage{csquotes}
\usepackage{polyglossia}
\setmainlanguage[spelling=new]{german}

\def\uppercasesingleletter#1{\uppercase{#1}}

\let\oldfootnote\footnote
% compiles, but doesn't do anything
\renewcommand\footnote[1]{\oldfootnote{\uppercasesingleletter{#1}}}
% does not compile in the first place
% \renewcommand\footnote[1]{\oldfootnote{\uppercasesingleletter{#1}}}

\begin{filecontents}{test.bib}
    @book{ali:title:2008,
    title = {Ali's Title},
    author = {Ali, Jamal},
    date = {2008}
    }

    @book{azzayn:title:1965,
    title = {Az-Zayn's Title},
    editor = {az-Zayn, Ahmad},
    date = {1965}
    }
\end{filecontents}

\usepackage[backend=biber,citestyle=authoryear-icomp]{biblatex}
\addbibresource{test.bib}

\DeclareFieldFormat*{citetitle}{\emph{#1}}

\begin{document}

\uppercasesingleletter{only the first letter of this should be uppercase!}

To this here I want to make a reference.\footcite[p. 14]{ali:title:2008} And another one.\footcite[p. 15]{ali:title:2008}

However, what follows needs some more explaining.\footnote{\cite[p. 16]{ali:title:2008}, compare \cite[p. 141]{azzayn:title:1965}.}

First we go back to the first source,\footcite[p. 12]{ali:title:2008} and then we can see that this is an entirely different thing though.\footcite[p. 150]{azzayn:title:1965}

\end{document}

答案1

這行不通。\uppercase是一個原語,適用於簡單文本,但不適用於任意內容,也不適用於複雜的命令,例如\cite.

在你的情況下,我也認為沒有必要使用它。在大多數情況下,腳註已經以大寫字母開頭。有\Cite command,對於 az-Zayn 您可以使用\autocap

   @book{azzayn:title:1965,
    title = {Az-Zayn's Title},
    editor = {\autocap{a}z-Zayn, Ahmad},
    date = {1965}
    }

(也可以看看Biblatex,阿拉伯名字和名字前綴的大寫

\documentclass{scrartcl}
\usepackage{csquotes}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage[backend=biber,citestyle=authoryear-icomp]{biblatex}
\addbibresource{bib.bib}

\begin{document}

\footcite[14]{ali:title:2008}\footcite[1]{ali:title:2008}

\footnote{\Cite[16]{ali:title:2008}, compare \cite[141]{azzayn:title:1965}.}

\footcites[16]{ali:title:2008}[compare][141]{azzayn:title:1965}

\footcite[12]{ali:title:2008} \footcite[150]{azzayn:title:1965}

\end{document}

順便一提:不要在後註中加上「p.」。讓 biblatex 來做吧。

在此輸入影像描述

相關內容