
現在のプロジェクトでは、ドキュメントを 3 つの部分にする必要があります。最初と最後の部分では、デフォルトのセクション分割を使用しますが、中間部分では、 の下のセクション レベルに別のスタイルを適用する必要があります\part
。このスタイルには、 と同様の別のページが必要なので、次のようにを使用すること\part
を検討しました。titlesec
\titleclass
\titleclass{\mysection}{page}[\part]
ただし、これにより、\chapter
ドキュメントの他の部分で通常どおり機能するために必要なセクション レベルなどがシフトされます。セクション レベルを以前の値にリセットする方法はありますか? または、目的を達成するための別の方法はありますか?
を使用することを検討しました\titleformat{\chapter}...
が、実行中の章番号(最初の部分から継続するはず)を含むいくつかの設定を最後にリセットするという問題が残り、その方法もよくわかりません。
答え1
質問を誤解しているかどうかはわかりませんが、ドキュメントの本文内のセクション見出しの形式を再定義しても問題はありません。ここでは \section を使用して行っていますが、章やパートなどについても同じことができます。
再定義後の見出しは新しい形式になります (再度再定義するまで)。
私はフォーマットの例として tcolorbox を使用しているだけです。好きなものを使用できます。
\documentclass[10pt]{article}
\usepackage[explicit]{titlesec}
\usepackage[most]{tcolorbox}
%original definition
\titleformat{\section}
{\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
{}{0pt}
{\begin{tcolorbox}[]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of original definition
\begin{document}
\section{A section}
Bla bla
\section{Another section}
\subsection{A Subsection}
%another definition
\titleformat{\section}
{\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
{}{0pt}
{\begin{tcolorbox}[
enhanced,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
interior code={\fill[overlay,cyan!30] (frame.north west) rectangle (frame.south east);},
]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of other definition
\section{Another section with a difference}
\subsection{Another subsection}
\end{document}