
如何cls
根據與節相關的標題或標籤定義檔案中的節樣式?除了知道將使用標題/標籤的最小子集之外,我無法控制 tex 檔案的內容。
例如,我希望「toppart」中的內容分為兩列,「middlepart」中的內容的字體大小為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
部門的需求。