(toc)KOMA スクリプトで dynnumwidth が確実に動作しない

(toc)KOMA スクリプトで dynnumwidth が確実に動作しない

によるKOMA スクリプトのドキュメント、 -style (目次の KOMA-Script のセクション コマンドで使用されるスタイルのテンプレート)dynnumwidthのオプションは次のようになります。tocbasictoclines

dynnumwidth=switch: スイッチがスタイル でアクティブになっている場合tocline、属性numwidthは無視されます。その代わりに、前回の LaTeX 実行時に検出された最大数値幅に の値を加えた値numsepが使用されます。

ただし、最大数値幅の検出は確実に機能しないようです。次の 2 つの MWE を検討してください。

test_1.tex:

\documentclass[american]{scrartcl}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\RedeclareSectionCommands[tocdynnumwidth]{section,subsection,subsubsection}

\begin{document}
    \tableofcontents

    \addsectiontocentry{Nr.~1}{Test1}
    \addsectiontocentry{Nr.~2}{Test2}
    \addsectiontocentry{Nr.~3}{Test3}
    \addsectiontocentry{Number~4}{Test4 (long)}
\end{document}

出力:

最初の MWE: <code>dynnumwidth</code> が壊れています

test_2.tex:

\documentclass[american]{scrartcl}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\RedeclareSectionCommands[tocdynnumwidth]{section,subsection,subsubsection}

\begin{document}
    \tableofcontents

    \addsectiontocentry{Nr.~1}{Test1}
    \addsectiontocentry{Nr.~2}{Test2}
    \addsectiontocentry{Number~3}{Test3 (long)}
    \addsectiontocentry{Number~4}{Test4 (long)}
\end{document}

出力:

2 番目の MWE: <code>dynnumwidth</code> が機能しています

したがって、数値幅が短いエントリが 3 つ以上ある場合、dynnumwidth長いエントリは検出されず、numwidth小さすぎる値 (MWE 1) が選択されます。一方、数値幅が短いエントリが 2 つと長いエントリが 2 つある場合は、正しい値numwidthが決定されます (MWE 2)。これはバグでしょうか、それとも使い方がdynnumwidth間違っているのでしょうか?

TeX Live 2016/KOMA-Script v3.21を使用しています。

答え1

私は KOMA-Script の作者 Markus Kohm にバグレポートを提出しましたが、これは意図したとおりに動作していないことが確認されました。

前述の通りエスディー、バグは修正されましたプレリリース v3.22.2559変更ログより:

r2559 2016-12-02 09:03:11 +0100 キロ:

  • scrkernel-tocstyle.dtx: 欠落していた \relax を dynnumwidth
    機能の修正に追加しました

したがって、KOMA-Script リリース v3.22 では削除されます。

関連情報