
セクションのタイトルまたはセクションに関連付けられたラベルに基づいて、ファイル内のセクション スタイルを定義するcls
にはどうすればよいでしょうか。タイトル/ラベルの最小限のサブセットが使用されること以外は、tex ファイルのコンテンツを制御できません。
たとえば、「toppart」内のコンテンツを 2 列にし、「middle part」内のコンテンツのフォント サイズを 8pt にし、「bottompart」内のコンテンツのフォントの色を赤にします。
\documentclass{article}
\begin{document}
\section{toppart}\label{toppart} %%%%%%
This is stuff at the top.
\section{middlepart}\label{middlepart} %%%%%%
This is stuff in the middle.
\section{endpart}\label{endpart} %%%%%%
This is stuff at the end.
\end{document}
明確に言うと、 で終わる行が必ず表示されます%%%%%%
。
答え1
環境を使用するのが最善策だと思います。以下は、セクションのコード例ですtoppart
。
% secprob2.tex SE 519788 Different setting within named sections
\documentclass{article}
\usepackage{multicol}
\usepackage{lipsum}
\newenvironment{toppart}{%
\section{toppart}\label{toppart}
\begin{multicols}{2}}%
{\end{multicols}}
\begin{document}
\section{Normal section}
\lipsum[1]
\begin{toppart}
\lipsum[1]
\end{toppart}
\section{Another regular section}
There is a section~\ref{toppart}.
\lipsum[1]
\end{document}
もちろん、これを拡張して、toppart
環境で異なるセクションのタイトルとラベルを有効にすることもできます。
middlepart
あなたのセクションとセクションに対応する同様の環境を考案するのはあなた次第ですendpart
。