將一位和兩位腳註標記與 KOMA 右對齊

將一位和兩位腳註標記與 KOMA 右對齊

基於這個答案對於我的問題文本中的腳註標記應為上標襯線圖形,但腳註中的腳註標記應為全尺寸舊式圖形,我有以下程式碼用於格式化腳註的外觀:

\documentclass{article}
\usepackage{fontspec} % Unicode
    \setmainfont{Libertinus Serif}
    \newfontfamily\footfont{Libertinus Serif}[% for footnote markers in the footnote
        Numbers = {Monospaced, OldStyle}]
\usepackage{scrextend} % KOMA script
    \newcommand*\footnotemarkspace{1em} % set distance of the footnote text from the margin
    \deffootnote{\footnotemarkspace}% use distance from above
        {\parindent}% paragraph indent in footnotes (footnotes should never have paragraphs!)
        {\makebox[\footnotemarkspace][l]{\footfont\thefootnotemark.}} % footfont with period for footnote marks in footnote

\begin{document}
Foobar\footnote{First footnote}\footnote{Second footnote}\footnote{Third footnote}\footnote{Fourth footnote}\footnote{Fifth footnote}\footnote{Sixth footnote}\footnote{Seventh footnote}\footnote{Eighth footnote}\footnote{Ninth footnote}\footnote{Tenth footnote}\footnote{Eleventh footnote}\footnote{Twelfth footnote}
\end{document}

當我到達文本中的第十個腳註時,即當腳註標記從一位數字變為兩位數時,出現問題。上面程式碼的輸出是這樣的:

在此輸入影像描述

問題是footnotemarkspace設定從左邊距到腳註文字的距離,沒有參數來設定從腳註標記的右邊緣到文字的距離。

在我看來,最好的解決方案是右對齊腳註標記,以便個位數與兩位數具有相同的右邊緣,這將允許距腳註標記右邊緣的距離統一到正文。理想情況下,兩位數腳註標記的左邊緣應與文件文字區域的左邊緣對齊。

我怎樣才能做到這一點?之前已經問過同樣的問題,但在這種情況下,問題和建議的答案都不使用 KOMA 腳本,我在本例中使用的是 KOMA 腳本。

答案1

你必須放大\footnotemarkspace。然後您可以在 的最後一個參數中使用命令r的選項。\makebox\deffootnote

\documentclass{article}
\usepackage{fontspec} % Unicode
\setmainfont{Libertinus Serif}
\newfontfamily\footfont{Libertinus Serif}[% for footnote markers in the footnote
  Numbers = {Monospaced, OldStyle}]

\usepackage{scrextend} % KOMA script
\KOMAoptions{footnotes=multiple}% maybe you want to use this option?
\newcommand*\footnotemarkspace{1.5em} % set distance of the footnote text from the margin
\deffootnote{\footnotemarkspace}% use distance from above
  {\parindent}% paragraph indent in footnotes (footnotes should never have paragraphs!)
  {\makebox[\footnotemarkspace][r]{\thefootnotemark.\ }} % footfont with period for footnote marks in footnote

\begin{document}
Foobar
\footnote{First footnote}\footnote{Second footnote}%
\footnote{Third footnote}\footnote{Fourth footnote}%
\footnote{Fifth footnote}\footnote{Sixth footnote}%
\footnote{Seventh footnote}\footnote{Eighth footnote}%
\footnote{Ninth footnote}\footnote{Tenth footnote}%
\footnote{Eleventh footnote}\footnote{Twelfth footnote}
\end{document}

在此輸入影像描述

或者你可以使用類似的東西

\makebox[\footnotemarkspace][l]{\footfont\phantom{99}\llap{\thefootnotemark}.}

在此輸入影像描述

代碼:

\documentclass{article}
\usepackage{fontspec} % Unicode
\setmainfont{Libertinus Serif}
\newfontfamily\footfont{Libertinus Serif}[% for footnote markers in the footnote
  Numbers = {Monospaced, OldStyle}]

\usepackage{scrextend} % KOMA script
\KOMAoptions{footnotes=multiple}% maybe you want to use this option?
\newcommand*\footnotemarkspace{1.5em} % set distance of the footnote text from the margin
\deffootnote{\footnotemarkspace}% use distance from above
  {\parindent}% paragraph indent in footnotes (footnotes should never have paragraphs!)
  {\makebox[\footnotemarkspace][l]{\footfont\phantom{99}\llap{\thefootnotemark}.}} % footfont with period for footnote marks in footnote

\begin{document}
Foobar
\footnote{First footnote}\footnote{Second footnote}%
\footnote{Third footnote}\footnote{Fourth footnote}%
\footnote{Fifth footnote}\footnote{Sixth footnote}%
\footnote{Seventh footnote}\footnote{Eighth footnote}%
\footnote{Ninth footnote}\footnote{Tenth footnote}%
\footnote{Eleventh footnote}\footnote{Twelfth footnote}
\end{document}

斯韋雷編輯

我只是想在這裡演示第一個程式碼範例無法將兩位數腳註標記中的第一個數字與文件文字區域的左邊距對齊,因此需要手動調整:

在此輸入影像描述

而第二個程式碼範例,使用\phantom\llap確實將兩位數的左邊緣與左邊距對齊:

在此輸入影像描述

如果需要這種左對齊,那麼使用\phantom和的程式碼\llap可能是正確的選擇。

相關內容