1

I want to generate a section cont.. heading on the top of page. I got almost data from [How to generate a "<section> continued" heading after page-break?

\documentclass{article}
\usepackage{lipsum}
\usepackage{everyshi}% http://ctan.org/pkg/everyshi
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox

\makeatletter
\let\@section@title@\relax% Sectional heading storage
\patchcmd{\@sect}% <cmd>
  {\@xsect}% <search>
  {\gdef\@section@title@{% Store sectional heading
  {\centering #6 \@svsec\\#8\normalfont\ \smash{\bf (continued)}\\}\par\bigskip}\@xsect}% <replace>
  {}{}% <success><failure>
\newif\if@sectionpage %Conditional to see if we are on the page where a section has been started
\newif\if@tab@pagebreak %Conditional to check if a table will cause a pagebreak
\EveryShipout{%
  \ifdim\pagetotal>\pagegoal
    \if@sectionpage
      \if@tab@pagebreak\else\aftergroup\@section@title@\fi
    \else
      \aftergroup\@section@title@
    \fi
  \fi
  \global\@sectionpagefalse
  \global\@tab@pagebreakfalse}
%redefinition to make the sectionpage-switch work
\let\ltx@section=\section

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {-1em}%
                                   {\normalfont\Large\bfseries\centering}}


\renewcommand \thesection {Some-text \arabic{section}}  

\let\cmdsec\section
\makeatother

\begin{document}
\cmdsec{A section}\lipsum[1-4]
\cmdsec{Second section section}


\lipsum[7-14]

\section{Not to cont on next page}
{\bf This section onwards, i don't want to continue the pattern ( section name continueee....) }
\lipsum[1-4]





\end{document}

By this code,

  1. i got section cont heading continue upto the last page of my article, there is no limit. Actually i want to restrict that for a particular section. How to do that?

  2. How can i break section, centering section (like section in second page). I want to align the first two section like one in the second page (without cont... text)

Thanks in advance

Samjith
  • 490

0 Answers0