
私は LaTeX の初心者です。論文を書いていて、目次を編集しようとしています。番号付けにはローマ数字を使用しています。
残念ながら、目次では、ローマ数字 IV の後のピリオドの前のスペースが大きすぎます (「IV」と「.」の後は、「I」と「.」の後よりも大きいです)。他のローマ数字 (I、II、III) の前のスペースも小さくせずに、スペースを小さくする方法を知っている人はいますか?
\documentclass[11pt]{book}
\usepackage[]{titletoc}
\usepackage[newparttoc]{titlesec}
\titleformat{\part}[display]{}{\partname\nobreakspace\thepart}{0mm}{}
\titlecontents{part}
[0cm]
{}
{\hfil\normalfont\large\bfseries
\thecontentslabel\mdseries .\bfseries ~\hfil
\normalfont\large\bfseries}
{}
{\normalsize\dotfill\scriptsize\bfseries\thecontentspage}
[]
\begin{document}
\tableofcontents
\part{Part}
\part{Part}
\part{Part}
\part{Part}
\end{document}
答え1
問題は、 と の間のフォントの変更であり\thecontentslabel
、.
カーニングが適用されないことを意味します。
およびを含むボックスの幅を測定し\bfseries\thecontentslabel.
、\bfseries\thecontentslabel\kern0pt.
幅の差を使用して部品番号とピリオドの間を手動でカーニングするなどの操作を行うことができます。
答え2
解決策を見つけました。見た目は良くありませんが、機能します。
\documentclass[11pt]{book}
\usepackage[]{titletoc}
\usepackage[newparttoc]{titlesec}
\titleformat{\part}[display]{}{\partname\nobreakspace\thepart}{0mm}{}
\titlecontents{part}
[0cm]
{}
{\hfil\normalfont\large\bfseries
\thecontentslabel\mdseries .\bfseries ~\hfil
\normalfont\large\bfseries}
{}
{\normalsize\dotfill\scriptsize\bfseries\thecontentspage}
[]
\begin{document}
\tableofcontents
\part{Part}
\part{Part}
\part{Part}
\titlecontents{part}
[0cm]
{}
{\hfil\normalfont\large\bfseries
\thecontentslabel\mdseries $\!$.\bfseries ~\hfil
\normalfont\large\bfseries}
{}
{\normalsize\dotfill\scriptsize\bfseries\thecontentspage}
[]
\part{Part}
\part{Part}
\titlecontents{part}
[0cm]
{}
{\hfil\normalfont\large\bfseries
\thecontentslabel\mdseries .\bfseries ~\hfil
\normalfont\large\bfseries}
{}
{\normalsize\dotfill\scriptsize\bfseries\thecontentspage}
[]
\part{Part}
\end{document}