In a previous question "Revision tracking on a per subsection basis" I asked about tracking revisions by section.
The answer that worked well for me was a macro that user Mike wrote.
\documentclass[a4paper]{scrbook}
\usepackage{xcolor}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\makeatletter
\newcommand*{\curr@revision}{}
\newcommand*{\curr@date}{}
\newcommand*{\curr@author}{}
% #1: revison
% #2: date
% #3: author (last modified by)
\newcommand*{\setrevision}[3]{%
\def\curr@revision{#1}%
\def\curr@date{#2}%
\def\curr@author{#3}%
}
\newcommand*{\printrevision}{%
\begingroup
\ifnum\c@section=0\relax
\let\the@sec@number\thechapter
\else
\ifnum\c@subsection=0\relax
\let\the@sec@number\thesection
\else
\let\the@sec@number\thesubsection
\fi
\fi
\addtocontents{lor}{\protect\revisionline{\the@sec@number}{\curr@revision}{\curr@date}{\curr@author}{\@currentHref}}%
\parfillskip0pt\color{gray}
last modified by: \textit{\curr@author}\dotfill
date: \textsf{\curr@date}\quad
revision: \textsf{\hbox to 2em{\hfill \curr@revision}}%
\par\endgroup\noindent
}
\newcommand*{\listofrevisions}{%
\chapter*{Revisions\@mkboth{Revisions}{Revisions}}%
\@starttoc{lor}%
}
\newcommand*{\revisionline}[5]{%
\ifx\\#5\\%
\@revisionline{#1}{#2}{#3}{#4}%
\else
\ifcase\Hy@linktoc % none
\@revisionline{#1}{#2}{#3}{#4}%
\or % (section) section number
\@revisionline{%
\hyper@linkstart{link}{#5}{#1}\hyper@linkend
}{#2}{#3}{#4}%
\or % (page) revision number
\@revisionline{#1}{%
\hyper@linkstart{link}{#5}{#2}\hyper@linkend
}{#3}{#4}%
\else % all
\@revisionline{%
\hyper@linkstart{link}{#5}{#1}\hyper@linkend
}{%
\hyper@linkstart{link}{#5}{#2}\hyper@linkend
}{%
\hyper@linkstart{link}{#5}{#3}\hyper@linkend
}{%
\hyper@linkstart{link}{#5}{#4}\hyper@linkend
}%
\fi
\fi
}
\newcommand*{\@revisionline}[4]{%
\noindent\parskip\z@\hbox to 3em{#1}\dotfill
\textit{#4}\quad\textsf{#3}\quad\hbox to 2em{\hfill#2}\par
}
\makeatother
\begin{document}
\frontmatter
\begin{titlepage}
\centering
{\Huge The big Company Manual}
\vspace{1cm}
{\Large The inner workings of some big company}
\vspace{2cm}
\begin{tabular}{ll}
Authors & Harry Bigboss\\
& Ruth Cando\\
& Amelia Nicecode
\end{tabular}
\end{titlepage}
\tableofcontents
\listofrevisions
\mainmatter
\chapter{Overview}
\section{Status of this Manual}
\subsection{Usage}
\label{sec:usage}
\setrevision{123}{2018-06-10}{Harry Bigboss}
\printrevision
This manual is for internal use only. It must never leave the company.
Those who take it out, will be fired.
\subsection{Completeness}
\setrevision{55}{2018-06-11}{Ruth Cando}
\printrevision
This manual is in a pre-release state. We are still negotiating with Harry about
the contents of \autoref{sec:usage}.
\section{Goals of the Manual}
\subsection{Introduction}
\setrevision{783}{2018-06-10}{Amelia Nicecode}
\printrevision
The manual can be used as an introduction to the procedures used in this company.
\subsection{Reference}
\setrevision{2233}{2018-06-12}{Amelia Nicecode}
\printrevision
The manual is intended to be a reference of the companies internal procedures.
\end{document}
My issue is that when I "\printrevision" after a section heading the \widowpenalty \clubpenalty don't seem to do anything and I get widow headings and orphan paragraphs in my document.
I've tried the \nowidow package and it made no difference. I've spent some time trying to figure this out but have had no luck.