
Como titlesec
funciona o pacote? Nunca chamei \sectionbreak
explicitamente em meu código, mas parece que \sectionbreak
é chamado entre\section
\documentclass[fleqn]{report}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage \setcounter{equation}{0}}
\begin{document}
\section{One}
\begin{equation} 2+2=3.99 \end{equation}
\begin{equation} \pi^2=9.86 \end{equation}
\section{Two}
\begin{equation} E=mc^2 \end{equation}
\begin{equation} v=\frac{e}{t} \end{equation}
\subsection{Two \& One}
\begin{equation} 2+2=22 \end{equation}
\end{document}
Responder1
De acordo com a página 8 dotítulosecmanual, \sectionbreak
é aplicado após cada comando de seção. Se você percorrer o código do pacote, em titlesec.sty
, encontrará duas instâncias de:
\@ifundefined{#6break}%
{\addpenalty{\@secpenalty}}%
{\csname#6break\endcsname}%
Aqui, #6
o nome do comando de seccionamento, então um de section
, subsection
, subsubsection
ou . No caso especial quando o código acima diz:paragraph
subparagraph
#6
section
se
sectionbreak
não estiver definido, adicione uma\@secpenalty
penalidade e, se estiver definido, adicione\sectionbreak
Se você quiser ver isso acontecendo ao compilar seu arquivo, por exemplo, você pode adicionar \typeout{Adding a section break!!!}
à definição do \sectionbreak
comando (veja abaixo) e então olhar no arquivo de log - em compile o arquivo no terminal e veja o saída.
\documentclass[fleqn]{report}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage \setcounter{equation}{0}\typeout{Adding a section break!!!}}
\begin{document}
\section{One}
\begin{equation} 2+2=3.99 \end{equation}
\begin{equation} \pi^2=9.86 \end{equation}
\section{Two}
\begin{equation} E=mc^2 \end{equation}
\begin{equation} v=\frac{e}{t} \end{equation}
\subsection{Two \& One}
\begin{equation} 2+2=22 \end{equation}
\end{document}