2

I am wondering if there is a way to automatically set a symbol (eg. ) somewhere at the end of an odd page every time a section is being continued on the following even page?

Manually this could be done by putting eg. \vfill\hfill$\triangleright$ after the last line of the odd page. But that doesn't work when the bottom line is full. And it's still no solution for a long document. And no solution at all when page breaks might still move.

So I thought maybe of something like a mark that appears next to the page number, something like this red triangle here: exemplary mark

Any idea how to create this?

Here's an MWE in which I left all the packages I am using in my document, in order to early recognize any conflicts.

\documentclass[10pt,twoside,titlepage,headsepline,headings=small,BCOR=8mm]{scrbook}
\usepackage{scrlayer-scrpage}
\usepackage{cmap}
\usepackage{ulem}
\usepackage[utf8]{inputenc}
\usepackage[vietnamese=nohyphenation]{hyphsubst}
\usepackage[vietnamese,polish]{babel}
\usepackage[T5,T1]{fontenc}
\usepackage{longtable}
\usepackage{lmodern}
\usepackage{makeidx}
\usepackage[columns=2,itemlayout=abshang,initsep=1.8em plus 0.2em minus 0.2em]{idxlayout}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage[defaultlines=2,all]{nowidow}

\usepackage{lipsum}

\KOMAoptions{paper=24cm:17cm,DIV=14} \setlength{\parindent}{0pt} \setlength{\parskip}{1.2ex plus 0.8ex minus 0.4ex} \setlength{\marginparwidth}{0pt} \setlength{\marginparsep}{0pt} \addtolength{\textheight}{0.4cm} \addtolength{\headsep}{-0.4cm} \addtolength{\topmargin}{-0.2cm} \renewcommand{\chapterheadstartvskip}{\vspace{-\topskip}}

\preto{\addsec}{\vspace{\baselineskip}} \hfuzz=2pt \flushbottom

\clearmainofpairofpagestyles \ihead[]{} \chead[]{} \ohead[]{\sffamily\leftmark} \ifoot[]{} \cfoot[]{} \ofoot[]{} \pagestyle{scrheadings}

\begin{document} \mainmatter \ofoot[\pagemark]{\pagemark} \raggedbottom \chapter{Chapter}
\addsec{Section 1} \lipsum[5]
\lipsum[4]
\addsec{Section 2} \lipsum[4]
\addsec{Section 3} \lipsum[8]
\lipsum[6]
\addsec{Section 4} \lipsum[3]
\lipsum[8]
\lipsum[7]
\addsec{Section 5} \lipsum[4]
\lipsum[3]
\lipsum[2]
\addsec{Section 6} \lipsum[8]
\lipsum[8]
\lipsum[1]
\addsec{Section 7} \lipsum[9]
\end{document}

Dominik
  • 483

1 Answers1

2

I wanted to do the same, searched for days and finally came up with a solution that might work for most cases (I haven't tested exhaustively, please double check for every page and write a comment if something looks wrong).

So we want a way to find out if a section continues to the next page and, if so, add a special mark, like this:

enter image description here

My solution is based on adding a different footnote depending if it is at the end of a section, and the trick is: we check, at the time the footnote is being made, whether the current section starts in a page that is ahead of the page being printed:

  • If the current section starts on a page that is greater than the page being printed, that means that we just started a new section, and it'll be printed on the next page (the current one is full). In this case, we don't add the mark.
  • If the current section has started on a previous page or in the current page, this means the current section will continue on the next page (otherwise, we would have a new section before the page break). In this case, we print the mark.

In order to do this, I set a counter to keep the starting page of the current section, as suggested by this answer.

Here's how it goes:

\documentclass[12pt, oneside]{article}
\usepackage[paperwidth=12cm, paperheight=18cm, top=2.2cm, bottom=2cm, left=1.6cm, right=1.6cm]{geometry}
\usepackage{ifthen}
\usepackage{lipsum}

% Allow to get the start page of current section \newcounter{currentsection} \renewcommand{\thecurrentsection}{\roman{currentsection}} \let\latexsection\section \RenewDocumentCommand{\section}{sO{#3}m}{% \stepcounter{currentsection}% \xdef\currentsectionlabel{css-\thecurrentsection}% \IfBooleanTF{#1} {\latexsection*{#3}} {\latexsection[#2]{#3}\label{\currentsectionlabel}}% } \newcommand{\currentsectionpage}{\pageref{\currentsectionlabel}}

% Configure footnote \usepackage{fancyhdr} \fancyhf{} \fancyfoot[C]{\thepage} \pagestyle{fancy}

\fancyfoot[R]{ % If you have 'twoside' and only want it in the odd pages, change R to RO. \ifthenelse{\thepage<\currentsectionpage}{}{\bf continued $\triangleright$}}

\begin{document}

\section{Title} \lipsum[1-2]

\section{Title} \lipsum[1]

\section{Title} \lipsum[1]

\section{Title} \lipsum[1-4]

\fancyfoot[R]{} % Never print 'continued' on last page

\end{document}

Important: remember you may need to compile it twice so the page references are calculated correctly.

Raphael
  • 564