Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass{report}
- \usepackage[frenchb]{babel}
- \usepackage{lipsum}
- \usepackage{environ,calc,needspace}
- \newlength\psectiontotheight
- \NewEnviron{psection}[1]{%
- \settototalheight{\psectiontotheight}{%
- \begin{minipage}{\textwidth}
- \section{#1}
- \BODY
- \end{minipage}%
- }%
- \ifdim\psectiontotheight>\textheight
- \else
- \needspace{\psectiontotheight}%
- \fi
- \addtocounter{section}{-1}%
- \section{#1}
- \BODY
- }{}
- \begin{document}
- \chapter{}
- \begin{section}{Première section}
- \lipsum[1-2]
- \end{section}
- \begin{psection}{Deuxième section}
- \lipsum[1]
- \end{psection}
- \begin{section}{Troisième section}
- \lipsum[1-5]
- \end{section}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement