# Alter geometry for 2 pages after new chapter

Within a twoside, twocolumn document, I'm trying to create a new chapter command, which alters the page geometry for the left-side page the chapter is started on and the right-side page after. Both pages should get a large header section to place a two-page spread image on the chapter double-page. However, it's likely that the text is not limited to those two pages, so any other pages afterwards can go back to a proper, text-focused geometry.

Most questions I've found here regarding that topic differ insofar that they only require a changed geometry for a single page, not two consecutive pages.

I have found a solution to restore my geometry at the beginning of the next chapter (as a safety net), and in fact a solution for the question I'm proposing here, but that solution also breaks the floats I'm using in my document (also added in the code).

The sample code has the above answer implemented (difference being that my document is twocolumn, which alters the behavior of \afterpage). It does do what I want, but it also breaks my floats. If I comment out the lines, the floats work fine, but obviously the geometry doesn't work.

\documentclass[a4paper, 11pt, twocolumn, twoside]{book}
\usepackage{lipsum}

\usepackage{geometry}
\usepackage[many]{tcolorbox}
\usepackage{fancyhdr}
\usepackage{changepage}
\usepackage{xcolor}
\usepackage{afterpage}
\usepackage{etoolbox}
\usepackage{pagecolor}

\strictpagecheck

\geometry{a4paper,
top=0cm,
bottom=7mm,
footskip=23mm,
left=20mm,
right=15mm
}

\makeatletter

\pagestyle{fancy}

%To reset my page layout at the beginning of a new chapter, just in case.
\cspreto{chapter}{\cleardoublepage\restoregeometry\restorepagecolor}

%To make new chapters start on the left-hand side.
\renewcommand*\cleardoublepage{\clearpage\if@twoside
\ifodd\c@page \hbox{}\newpage\if@twocolumn\hbox{}%
\newpage\fi\fi\fi}

\fancypagestyle{story}{
\fancyhf{}
\Huge\leftmark
\fi
}
\fancyfoot[LE]{
\LARGE\thepage\hspace{1cm}\Large\leftmark
}
\fancyfoot[RO]{
\Large\leftmark\hspace{1cm}\LARGE\thepage
}
}

%Example of the float that breaks with the current solution.
\newenvironment{twocolumnbox}{
\checkoddpage
\ifoddpage
\begin{tcolorbox}[
enhanced,
top=4mm,
bottom=4mm,
left=25mm,
right=5mm,
opacityframe=1,
opacityback=1,
colback=red,
colframe=black,
coltext=black,
text width=\textwidth-7mm,
boxrule=2mm,
arc is angular,
arc=6mm,outer arc=7mm,
float*=h!tb,
every float=\hspace*{-32mm}
]
\else
\begin{tcolorbox}[
enhanced,
top=4mm,
bottom=4mm,
left=5mm,
right=25mm,
opacityframe=1,
opacityback=1,
colback=red,
colframe=black,
coltext=black,
text width=\textwidth-7mm,
boxrule=2mm,
arc is angular,
arc=6mm,outer arc=7mm,
float*=h!tb
]
\fi
}{\end{tcolorbox}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTION IN QUESTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\storychapter}[1]{
\cleardoublepage
\newpagecolor{gray}
\pagestyle{story}
\newgeometry{
top=0cm,
bottom=7mm,
footskip=23mm,
left=20mm,
right=15mm
}
\par\refstepcounter{chapter}% Increase section counter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CURRENT SOLUTION ATTEMPT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\afterpage{\afterpage{\afterpage{\afterpage{
%This works, but it also breaks my floats.
% \/
%\globaldefs=1 \restoregeometry
%\globaldefs=0
}}}}
}

\makeatother

\pagecolor{white}

\begin{document}
\pagestyle{empty}
\begin{titlepage}
\begin{center}
{\Huge\bfseries Title}
\end{center}
\end{titlepage}
\chapter{Test}
\lipsum
\lipsum
\storychapter{Storytest}
\lipsum
\lipsum
\lipsum
\lipsum[1-5]
\chapter{NewTest}
\lipsum
\begin{twocolumnbox}
\lipsum[1-3]
\end{twocolumnbox}
\lipsum
\lipsum
\lipsum
\lipsum
\lipsum

\end{document}


I'm wondering if there's a better (or working with the floats) solution for my issue. Apart from anything else, that use of \afterpage and globals feels rather dirty.

Edit:

I have altered the design by utilizing the repeating nature of the headercode from fancyhdr and put the resetting of the values in there, so the geometry gets reset back to normal on the odd page after the new chapter, to be used by the next even page. That entirely skips the need for afterpage and removing the code from the text body removed some dirty side effects with floats.

\fancypagestyle{story}{
\fancyhf{}
\Huge\leftmark
\fi
}
\global\setlength{\textheight}{237mm}
}
\fancyfoot[LE]{
\LARGE\thepage\hspace{1cm}\Large\leftmark
}
\fancyfoot[RO]{
\Large\leftmark\hspace{1cm}\LARGE\thepage
}
}


Original Solution:

I've managed to solve the issue by ignoring the geometry package and just re-setting the relevant layout values myself.

\afterpage{\afterpage{\afterpage{
\global\setlength{\textheight}{237mm}
\afterpage{