0

I'm working on a bilingual edition using paracol and fancyhdr. I want p. 1 of each chapter to be in \pagestyle{empty}, pp. 2-3 to be in \pagestyle{plain}, and pp. 4- to be in \pagestyle{fancy}.

This MWE, which as far as I can tell ought to accomplish this completely, does the above EXCEPT that p. 3 is in \pagestyle{fancy}, not \pagestyle{plain}. What am I missing?

\documentclass[]{book}

\usepackage[utf8x]{inputenc}
\usepackage{paracol}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{afterpage}

\pagestyle{fancy}
\fancyhf{}
\fancyhf[CFE,CFO]{\thepage}
\fancyhead[CE]{\itshape\ Heading Left }
\fancyhead[CO]{\itshape\ Heading Right}

\begin{document}

\chapter{}
\thispagestyle{empty}\afterpage{\thispagestyle{plain}\afterpage{\thispagestyle{plain}}}
\newenvironment{blahparacol}[2]
{\begin{paracol}[1]*{2} 
#1\switchcolumn#2
}{\end{paracol}}
~ \clearpage % clearing the page so the first column starts on verso

\begin{blahparacol}
\switchcolumn[0]*
\vspace{1in}
                    \begin{center}
                        \huge\ Left Chapter Title \par
                    \end{center}
\vspace{.5in}
\switchcolumn
\vspace{1in}
                    \begin{center}
                        \huge\ Right Chapter Title \par
                    \end{center}
\vspace{.5in}
\switchcolumn*
\lipsum
\switchcolumn
\lipsum
\end{blahparacol}
\end{document}
1
  • I'm not sure what afterpage makes of 2 page paracol. I did test and the first \afterpage runs on page 2 while the second \afterpage runs on page 6. Commented May 15, 2020 at 15:38

1 Answer 1

1

This solution uses everypage. Whereas afterpage runs before the page is formatted, everypage runs after, which means that \thispagestyle applies to the NEXT page.

\documentclass[]{book}

\usepackage[utf8x]{inputenc}
\usepackage{paracol}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{everypage}

\newcounter{twopage}
\globalcounter{twopage}
\AddEverypageHook{\ifcase\value{twopage}% zero
  \or\thispagestyle{plain}\addtocounter{twopage}{-1}% one
  \or\thispagestyle{plain}\addtocounter{twopage}{-1}% two
  \else\addtocounter{twopage}{-1}% should not happen
  \fi}

\pagestyle{fancy}
\fancyhf{}
\fancyhf[CFE,CFO]{\thepage}
\fancyhead[CE]{\itshape\ Heading Left }
\fancyhead[CO]{\itshape\ Heading Right}

\begin{document}

\chapter{}
\thispagestyle{empty}\setcounter{twopage}{2}%
\newenvironment{blahparacol}[2]
{\begin{paracol}[1]*{2} 
#1\switchcolumn#2
}{\end{paracol}}
~ \clearpage % clearing the page so the first column starts on verso

\begin{blahparacol}
\switchcolumn[0]*
\vspace{1in}
                    \begin{center}
                        \huge\ Left Chapter Title \par
                    \end{center}
\vspace{.5in}
\switchcolumn
\vspace{1in}
                    \begin{center}
                        \huge\ Right Chapter Title \par
                    \end{center}
\vspace{.5in}
\switchcolumn*
\lipsum
\switchcolumn
\lipsum
\end{blahparacol}
\end{document}
4
  • Thank you so much! Weirdly, though, I inserted this code into mine and, though it made the headers disappear from pages 2 and 3, it also made them disappear from page 5 (and possibly past that but right now the document isn't any longer). Then I tried doing a new MWE with just your code and nothing else and the same thing happened. Any ideas about what I might be doing wrong? Commented May 16, 2020 at 1:07
  • (And thank you so much for all your help, by the way!) Commented May 16, 2020 at 1:28
  • 1
    I forgot to use \globalcounter{twopage}. Commented May 16, 2020 at 3:30
  • Thank you so much! It's perfect! Commented May 16, 2020 at 3:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .