scrrprt TOC で使用されるフォント

scrrprt TOC で使用されるフォント

scrrprt ドキュメントでは、全体的にプロポーショナルな旧スタイルの数字を使用していますが、目次のページには等幅の行番号を使用したいと考えています。

chapterentrypagenumber最上位レベルではフォントを使用できますが、sectionentrypagenumber記事でのみ使用できます (最上位レベルであるため)。残りの数字にはどのフォントが使用されていますか?

ここに簡単なテスト ドキュメントがあります。黒い数字のフォントを変更するにはどうすればよいでしょうか。

\documentclass{scrreprt}
\usepackage{xcolor}
\setkomafont{chapterentrypagenumber}{\color{red}}
\setkomafont{disposition}{\color{teal}}
\begin{document}
{\color{blue}\tableofcontents}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\end{document}

ここに画像の説明を入力してください

また、これらのために使用できる簡単なデバッグスイッチはありますか?ドキュメントに使用されているコマフォントの名前を入力するだけですか?試してみました

\renewcommand{\usekomafont}[2]{(#1:#2)}

しかし、私が気づいていないフォントの変更がいくつか起こっていることは明らかです。 ここに画像の説明を入力してください

答え1

KOMA バンドルの tocstyle パッケージと pagenumberhook を使用します。

\documentclass{scrreprt}
\usepackage{xcolor, tocstyle}
\setkomafont{chapterentrypagenumber}{\color{red}}
\setkomafont{disposition}{\color{teal}}
\settocstylefeature{pagenumberhook}{\sffamily{}}
\begin{document}
{\color{blue}\tableofcontents}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\end{document}

私は\sffamilyフォントコマンドとして使用しましたが、他のものを使用したい場合もあるかもしれません。


編集

雨の日なので、何か色付きのものが欲しかったので、KOMAscript がどの程度のナンセンスさを維持できるかを知るために、これを試してみました。

\documentclass[x11names]{scrreprt}
\usepackage{xcolor, blindtext}
\usepackage{tocstyle}
\usetocstyle{KOMAlike}

\addtokomafont{chapterentrypagenumber}{\color{purple}}
\addtokomafont{chapter}{\color{purple}}

\addtokomafont{chapterentry}{\Large\color{purple}}
%\addtokomafont{disposition}{\color{Snow4}}
\settocstylefeature{entryhook}{\color{Wheat4!70!black}\bfseries}
 \settocstylefeature{pagenumberhook}{\rlap{\color{Wheat1}\hspace{-0.3em}\rule[-0.6ex]{0.6em}{2.5ex}\color{Wheat3}\rule[0.1ex]{0.6em}{2.5ex}}\bfseries\sffamily\color{teal}}

\begin{document}
 \tableofcontents
% \chapter{Chapter}
% \section{Section}
% \subsection{Subsection}

\blinddocument

\blinddocument

\end{document}

そして、とてもかわいい目次が表示されます: 内容-カラー

関連情報