\chapter、\section などのデフォルトの書式設定を取得するにはどうすればよいですか?

\chapter、\section などのデフォルトの書式設定を取得するにはどうすればよいですか?

titlesecセクションと章の見出しにいくつかの変更を加えるために使用したいのですが、titleformat変更を加えるだけでなく、書式設定全体を再定義します (たとえば、色を変更したいだけの場合)。

完全に再定義するのではなく、変更するにはどうすればいいでしょうかtitlesec? これは可能ですか?

そうでない場合、どうすれば現在\chapter、などの書式を設定して\section、それを複製して変更を加えることはできますか?


サンプル文書の要求に対する応答として、最も基本的なものは次のようになります。

\documentclass{article}
\begin{document}
\section{Hello World}
Hello world!
\end{document}

\sectionただし、特定の構成について単に「知る」のではなく、現在のフォーマットを見つける (たとえば、印刷する) 方法に興味があります。

答え1

タイトルの色などの単純な変更には、 のライト バージョンを使用できますが、パラメータの値 (フォント サイズ、太さ、形状) が何であるかを(または、または)\titleformatで確認する必要があります。article.clsreportbook

次に例を示します。

\documentclass[a4paper]{article}
\usepackage[svgnames]{xcolor}
\usepackage{titlesec}
\titleformat*{\section}{\color{IndianRed}\normalfont\bfseries\Large}

\begin{document}

\section{A short title}
This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

\end{document} 

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

答え2

標準クラスは次のように定義されます(titlesec 参照、セクション8.2)

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titleformat{\subparagraph}[runin]
{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
\titlespacing*{\chapter}     {0pt}{50pt}{40pt}
\titlespacing*{\section}     {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection}   {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph}   {0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}

答え3

試してみて

\documentclass{scrartcl}
\usepackage{xcolor}
\addtokomafont{section}{\color{red}}
\begin{document}
\section{Hello World}
Hello world!
\end{document}

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

関連情報