0

Using Gonzalo Medina's code and trying to include one A3-page, I cannot suppress the page style using \thispagestyle{empty} or cleardoublepage=plain. Please give me a hint.

The code:

\documentclass[DIV=calc,pagesize]{scrreprt}
\usepackage[a5paper,vmargin=2cm]{geometry}
\usepackage{background}
\usepackage{etoolbox}
\usepackage{graphicx,xcolor}
\usepackage{totcount}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{afterpage}

% to have access to the total number of sections
\regtotcounter{section}

% every section starts on a new page
\pretocmd{\section}{\clearpage}{}{}

% auxiliary lengths for the height of the frame and the width of each tab
\newlength\mylen
\newlength\mylena

% style for the section tabs
\tikzset{
tab/.style={
  text width=\mylena,
  draw=gray,
  thick,
  rectangle,
  rounded corners=12pt,
  align=center,
  text width=53pt,
  inner sep=0pt,
  fill=gray!20,
  font=\sffamily\LARGE
  }
}
% style for the current section tab
\tikzset{selectedtab/.style={tab,color=white,fill=gray!90}}

% the page number is showed in the background material
\pagestyle{empty}

\AtBeginDocument{
% calculation of the width for each tab
\setlength\mylen{\dimexpr\textheight+2cm\relax}
\ifnum\totvalue{section}>0
\setlength\mylena{\dimexpr\mylen/\totvalue{section}\relax}
\fi

% the main part; as background material we place the border, 
% the section (current and other) tabs and the page number 
\backgroundsetup{
scale=1,
color=black,
angle=0,
opacity=1,
contents= {
  \begin{tikzpicture}[remember picture, overlay]
  \node[
    inner sep=0pt,
    text width=\the\dimexpr\textwidth+1.5cm\relax
  ] 
    at (current page.center) (border) {\rule{0pt}        {\dimexpr\textheight+2cm\relax}};
  \foreach \valsection in {0,...,\numexpr\totvalue{section}-1\relax}
  {
    \node[
      \ifnum\thesection<\numexpr\valsection+1\relax 
    tab%
  \else 
  \ifnum\thesection>\numexpr\valsection+1\relax 
    tab%
  \else selectedtab%
  \fi\fi,
  minimum height=\mylena
  ] 
  at ([yshift=-(0.5+\valsection)*\mylena]border.north east) 
  (tab-\valsection) 
  {\hspace*{25pt}\rotatebox{-90}{%
    \hyperlink{sec:\valsection}{Section \the\numexpr\valsection+1\relax}%
    }
  };
  }
      \node[
    draw=gray,
    line width=2pt,
    rectangle,
    rounded corners=10pt,
    inner sep=0pt,
    text width=\the\dimexpr\textwidth+1.5cm\relax,
    fill=white
  ] 
    at (current page.center) 
    {\rule{0pt}{\dimexpr\textheight+2cm\relax}};
  \node[font=\LARGE\sffamily,fill=white] 
    at (border.south) 
    {\makebox[3em][c]{\thepage}};
\end{tikzpicture}}
  }
}

\begin{document}

\section{Section One}
\hypertarget{sec:0}{}
\lipsum[1-3]
\section{Test Section Two}
\hypertarget{sec:1}{}
\lipsum[1-2]


\clearpage
\afterpage{% 
\KOMAoptions{paper=a3,paper=landscape}%,cleardoublepage=plain}
\recalctypearea
%\thispagestyle{empty}
\areaset{\dimexpr \textwidth+.5\paperwidth}{\textheight}
\noindent\begin{minipage}{\textwidth}
\rule{\textwidth}{\dimexpr\textheight-3\baselineskip\relax}
\captionof{figure}{Some notes...}
\end{minipage}

\clearpage
\KOMAoptions{paper=a4,paper=portrait}
\areaset{\dimexpr \textwidth-\paperwidth}{\textheight}
\recalctypearea\clearpage

}



\section{Test Section Three}
\hypertarget{sec:2}{}
\lipsum[1-2]
\section{Test Section Four}
\hypertarget{sec:3}{}
\lipsum[3]

\end{document}

And the result is:

enter image description here

2 Answers2

1

You do not use a pagestyle for the border. Therefore \thispagestyle{empty} does not suppress the border.

You could load package scrlayer and define a layer pagestyle. With class scrreprt I would do this for chapters.

\documentclass[DIV=calc,pagesize]{scrreprt}
\usepackage[a5paper,vmargin=2cm]{geometry}
\usepackage{tikz}% loads also xcolor and graphicx
\usepackage{totcount}
\usepackage{lipsum}

\usepackage{afterpage}
\usepackage{hyperref}

% to have access to the total number of sections
\regtotcounter{chapter}

% auxiliary length for the width of each tab
\newlength\mylena

\tikzset{
  tab/.style={% style for the section tabs
    text width=\mylena,
    draw=gray,
    thick,
    rectangle,
    rounded corners=12pt,
    align=center,
    text width=53pt,
    inner sep=0pt,
    fill=gray!20,
    font=\sffamily\LARGE,
    overlay
  },
  selectedtab/.style={% style for the current section tab
    tab,
    color=gray!90,
    text=white
  },
  pagenumber/.style={% style for the page number
    font=\LARGE\sffamily,
    fill=white,
    text width=3em,
    align=center
  }
}

\usepackage{scrlayer}
\DeclarePageStyleByLayers{border}{border.odd}
\pagestyle{border}
\renewcommand\chapterpagestyle{border}

\DeclareNewLayer[
  background,
  oddpage,
  textarea,
  addvoffset=-1cm,
  addhoffset=-.75cm,
  addheight=2cm,
  addwidth=1.5cm,
  contents={%
  \ifnum\totvalue{chapter}>0
    \setlength\mylena{\dimexpr\layerheight/\totvalue{chapter}\relax}%
  \fi
    \begin{tikzpicture}
      \pgfdeclarelayer{background}
      \pgfsetlayers{background,main}
      \node[
        draw=gray,
        fill=white,
        inner sep=0pt,
        minimum width=\layerwidth-\pgflinewidth,
        minimum height=\layerheight-\pgflinewidth,
        rounded corners=10pt,
        line width=2pt
      ](border){};
      \node[pagenumber]at (border.south){\thepage};
      \begin{pgfonlayer}{background}
        \foreach \valchapter in {0,...,\numexpr\totvalue{chapter}-1\relax}{%
          \node[
            \ifnum\value{chapter}<\numexpr\valchapter+1\relax 
              tab%
            \else 
              \ifnum\value{chapter}>\numexpr\valchapter+1\relax 
                tab%
              \else
                selectedtab%
              \fi
            \fi,
            minimum height=\mylena-\pgflinewidth
          ] at ([yshift=-(0.5+\valchapter)*\mylena]border.north east)
          {\hspace*{25pt}\rotatebox{-90}{%
              \hyperlink{chap:\valchapter}{\chaptername\ \the\numexpr\valchapter+1\relax}%
            }
          };
        }
      \end{pgfonlayer}
    \end{tikzpicture}%
  }
]{border.odd}

\begin{document}
\tableofcontents
\chapter{Chapter One}
\hypertarget{chap:0}{}
\lipsum[1-3]
\chapter{Test Chapter Two}
\hypertarget{chap:1}{}
\lipsum[1-2]

\clearpage
\afterpage{% 
  \KOMAoptions{paper=a3,paper=landscape,DIV=10}
  \thispagestyle{empty}
  \noindent\begin{minipage}{\textwidth}
    \rule{\textwidth}{\dimexpr\textheight-3\baselineskip\relax}
    \captionof{figure}{Some notes \ldots}
  \end{minipage}
  \clearpage
}

\chapter{Test Chapter Three}
\hypertarget{chap:2}{}
\lipsum[1-2]
\chapter{Test Chapter Four}
\hypertarget{chap:3}{}
\lipsum[3]
\end{document}

enter image description here

Note that I have changed the code inside the argument of \afterpage.

If you remove the \thispagestyle{empty} for the A3 page you would get:

enter image description here

esdd
  • 85,675
0

Your "MWE" is not very minimal, and also not working, as it generates error messages.

But to get rid of the background on the A3 page you have to add

\NoBgThispage 

on that page as the background documentation says.