jlreq icon indicating copy to clipboard operation
jlreq copied to clipboard

目次と索引の見出し命令は固有名になっていたほうがよい?

Open kmuto opened this issue 4 years ago • 2 comments

現状で目次見出しは\tableofcontents 定義内で \chapter*{\contentsname}、索引見出しは \theindex 定義内で \section*{\indexname} となっているのですが、本文用にchapterやsectionの見た目をたとえばRenewTobiraHeadingなどに変更したときに目次や索引の表現も変わることになります。

本文側で\chapter じゃない独自のものを使えばいいという話ではあるのですが、目次や索引の見出しのほうを\chapter\sectionではない固有の名前にするのはいかがでしょうか。

kmuto avatar Sep 29 '21 12:09 kmuto

標準クラスファイルに合わせたものだと思います.うーん,ちょっと悩んでみます.一応,一時的に変更するという抜け道はあります.

\documentclass{jlreq}
% フックを使う.それなりに新しいLaTeXが必要.
\AddToHook{cmd/tableofcontents/before}{
  \SaveHeading{section}{\savesection}% 現在の\sectionを保存
  \ModifyHeading{section}{font=\normalfont}% \section変更
}
\AddToHook{cmd/tableofcontents/after}{
  \savesection% 復帰
}
% もちろんこうしてもよい
%\makeatletter
%\let\orig@tableofcontents=\tableofcontents
%\def\tableofcontents{%
%  \SaveHeading{section}{\savesection}% 現在の\sectionを保存
%  \ModifyHeading{section}{font=\normalfont}% \section変更
%  \orig@tableofcontents
%  \savesection% 復帰
%}
%\makeatother
\begin{document}
\tableofcontents
\section{あ}
\end{document}

abenori avatar Sep 30 '21 11:09 abenori

試しに

\jlreqsetup{
  tableofcontents_heading = {\mysection{\contentsname}},
  theindex_heading = {\mysection{\contentsname}},
}

とできるようにしてみました.(もちろん\mysectionは別途定義しておく必要があります.) df2d437

abenori avatar May 18 '22 02:05 abenori