
¿Cómo titlesec
funciona el paquete? Nunca he llamado \sectionbreak
explícitamente en mi código, pero parece que \sectionbreak
se llama en el medio\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}
Respuesta1
Según la página 8 de latítulossecmanual, \sectionbreak
se aplica después de cada comando de sección. Si recorre el código del paquete, en titlesec.sty
, encontrará dos instancias de:
\@ifundefined{#6break}%
{\addpenalty{\@secpenalty}}%
{\csname#6break\endcsname}%
Aquí, #6
el nombre del comando de sección, es decir, uno de section
, subsection
, o . En el caso especial en el que el código anterior dice:subsubsection
paragraph
subparagraph
#6
section
si
sectionbreak
no está definido, agregue una\@secpenalty
penalización y si está definido, agregue\sectionbreak
Si desea que esto suceda cuando compila su archivo, entonces, por ejemplo, puede agregarlo \typeout{Adding a section break!!!}
a la definición del \sectionbreak
comando (ver más abajo) y luego mirar en el archivo de registro: compilar el archivo en la terminal y mirar el producción.
\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}