This is a follow-up question to the answer in https://tex.stackexchange.com/a/63847/243868
I want to add "Section name (continued)" at the top of the page when a section continues on multiple pages. I tried using the code suggested in the above answer, but it does not print any text at the page breaks.
Here's a MWE. What should I change in order to re-display the section title at the necessary page breaks?
%%%%%%%%%%%%%%%%%basic document setup%%%%%%%%%%%%%%%%%
\documentclass[american, 10pt]{article}
\usepackage{calc}
\reversemarginpar
\usepackage[paper=letterpaper, marginparwidth=1.3in, marginparsep=.05in, margin=1in, includemp]{geometry}
\usepackage{hyperref}
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%custom section formatting%%%%%%%%%%%%%%%%
% Usage: \section{section name}
\renewcommand{\section}[1]{\pagebreak[3]%
\vspace{2\baselineskip}%
\phantomsection\addcontentsline{toc}{section}{#1}%
\noindent\llap{\scshape\smash{\parbox[t]{\marginparwidth+6pt}{\hyphenpenalty=10000\raggedright #1}}}%
\vspace{-\baselineskip}\par}
\renewcommand{\subsection}[2][0]{%
\begin{bf}
\vspace{#1\baselineskip} #2 \vspace{4pt}\par
\end{bf}}%
%%%%%%%%%%%%%%%%copied from original post%%%%%%%%%%%%%%%%
\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
{\noindent#6@svsec#8\normalfont\ \smash{(continued)}}\par\bigskip}@xsect}% <replace>
{}{}% <success><failure>
\EveryShipout{%
\ifdim\pagetotal>\pagegoal% There is content overflow on this page
\aftergroup@section@title@% Reprint/-insert sectional heading
\fi%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{lipsum}
\begin{document}
\section{Section 1}
\lipsum[1-10]
\section{Section 2}
\lipsum[1-5]
\end{document}