I have read the question and answers about the "-continued" heading. The code given in the answers doesn't help me. Thats why I am posting a follow-up-question here.
I want to re-display the section-titles, but I am using a longtable. (I need to write a document, which consists only of longtables. And I really need the section-titles to reappear. Using a headline does not work in my case.)
I have a longtable over (at least) two pages. And I want to re-display the current section-title. My problem is, that the longtable is continued in the same line as the re-displayed section-title. Here is the latex-code I am using:
\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{everyshi}% http://ctan.org/pkg/everyshi
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage{environ}% http://www.ctan.org/pkg/environ
\usepackage{longtable}
\makeatletter
\let\@section@title@\relax% Sectional heading storage
\patchcmd{\@sect}% <cmd>
{\@xsect}% <search>
{\gdef\@section@title@{% Store sectional heading
{\noindent#6\@svsec#8\normalfont\ \smash{(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
\newdimen\currtabheight
\newdimen\pt@saved
\let\ltx@tabular\tabular
\let\ltx@endtabular\endtabular
\providecommand{\env@tabular@save@env}{}
\providecommand{\env@tabular@process}{}
%Patching the tabular envionment
\RenewEnviron{tabular}[1]{%
\setbox0=\hbox{% measure the height of the tabular
\ltx@tabular{#1}
\BODY
\ltx@endtabular
}
\currtabheight=\ht0 \advance\currtabheight by \dp0%
\pt@saved=\the\pagetotal% store the current pagetotal value
\advance\pt@saved by \currtabheight% add the height of the current tabular
\ifdim\pt@saved>\pagegoal% the tabular will cause a pagebreak
\global\@tab@pagebreaktrue
\fi
\ltx@tabular{#1}% printing the tabular
\BODY
\ltx@endtabular
}
%Doing the old shipout trick with the addtional declared conditionals
\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}{\@sectionpagetrue\ltx@section}
\makeatother
\begin{document}
\section{A section}
\lipsum[1-1]
\begin{longtable}{|l| l|}
KILLED & LINE!!!! \kill
\caption[An optional table caption ...]{A long table\label{long}}\\
\hline\hline
\multicolumn{2}{@{*}c@{*}}%
{ This part appears at the top of the table}\\ \hline
\endfirsthead
\multicolumn{2}{@{*}c@{*}}%
{ This part appears at the top of every other page}\\ \hline\hline
\endhead
\endfoot
\endlastfoot
columns are specified& in the \\
same way as in the tabular& environment.\\
Lots of lines& like this.\\
...
Lots of lines& like this.\\
\end{longtable}
\lipsum[2-2]
\section{Second section}
\begin{tabular}{l}
AAAAAAAAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAAAAAAA
\end{tabular}
\lipsum[7-8]
\end{document}
As you can see, LaTeX starts the second part of the longtable in the title-continued line:

Unfortunately I don't know LaTeX well enough to solve the problem. Can someone help me, please?
(I already looked at answers to these similiar questions:
Re-displaying section headings after page-breaks
How to generate a "<section> continued" heading after page-break?
Re-displaying section headings after page-breaks (with titlesec))

font changes ...\thesection~section (continued)before\endhead– Ulrike Fischer May 26 '14 at 16:22I try to explain, what I want to do. It is a bit complicated, so I will choose a different but similiar example. Say, I want to display a lot of data about school-classes (e.g. name of teacher, number of students) for a lot of schools. (It is so much data for a class, that I must use the longtable-environment.) Since longtables cant be nested, I decided to use the section-title for the school and longtables for the school-classes. I hope, this explains what I want to do.
– Anja May 27 '14 at 07:40