I have the following problem. I am writting my thesis and I need to change the page format from A4 to A3 to include a figure. After this, I would like to return to the original format.
However, an undesirable page break appears always at the end on the first page after the format change. I do not know how to eliminate it or why this problem appears.
I hope you can help me. Thanks you very much in advance.
\documentclass[listof=flat,a4paper,12pt,headsepline,bibliography=totoc,listof=totoc,index=totoc,cleardoublepage=empty,numbers=noenddot,headings=normal]{scrreprt}
% hack for KOMA package
\usepackage{scrhack}
% allow sophisticated control structures
\usepackage{ifthen}
% languages
\usepackage[ngerman,english]{babel}
\selectlanguage{english} % change to ngerman for a German thesis
% character encoding
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
% page layout
\usepackage[paper=a4paper,left=50mm,right=20mm,top=20mm,bottom=20mm]{geometry}
% page header layout
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\renewcommand{\partpagestyle}{empty}
\renewcommand{\chapterpagestyle}{scrheadings}
\setkomafont{pagenumber}{\slshape}
\ihead[]{\headmark}
\chead{}
\ohead[]{\emph{\pagemark}}
\ifoot{}
\cfoot[]{}
\ofoot{}
\automark[section]{chapter}
\renewcommand{\sectfont}{\normalfont \bfseries} % header font
% paragraph formatting
\setlength{\parindent}{0cm}
\setlength{\parskip}{6pt plus 2pt minus 2pt}
% fonts
\usepackage{times} % use times as default font
\usepackage{pifont} % enable special PostScript fonts
% use colors
\usepackage{color}
% linespacing
\usepackage{setspace}
%possible penalties for layouting
%\binoppenalty=10000
%\relpenalty=10000
%\interfootnotelinepenalty=10000
%\brokenpenalty=10000
%\clubpenalty=10000
%\widowpenalty=10000
%\hyphenpenalty=5000
%\tolerance=3000
% numbering
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\usepackage{chngcntr}
\counterwithout{footnote}{chapter} % footnotes are numbered throughout the text
% fancy math
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
% sophisticated enumerations
\usepackage{enumerate}
% fancy tables
\usepackage{booktabs}
% algorithms & code listings
\usepackage[english,vlined,algoruled]{algorithm2e}
\usepackage{listings}
% graphics & charts
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
% Load float package, for enabling floating extensions
\usepackage{float}
% allow rotations
\usepackage{rotating}
% hyperlinks in PDF-document
\usepackage[colorlinks=true,linkcolor=black,citecolor=black,anchorcolor=black,urlcolor=black,pdftex]{hyperref}
% set the bibliography style
\usepackage[round]{natbib}
\bibliographystyle{bibliography/biblio_style}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{amsmath}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\lipsum[7-15]
Figure \ref{Big figure}.
\afterpage{
\clearpage
\KOMAoptions{paper=A3, paper=landscape, pagesize}
\addtolength{\hoffset}{-3.5cm}
\recalctypearea
\begin{figure}[h]
\includegraphics[height=1.25\textheight,width=1.25\textwidth,keepaspectratio]{images/leon.JPEG}
\caption{Big picture}
\label{Big picture}
\end{figure}
\clearpage
\KOMAoptions{paper=A4, paper=portrait, pagesize}
\recalctypearea
}
\lipsum[1-15]
\end{document}
\clearpage\KONAoptions{...}
with\afterpage{\clearpage\KOMAoptions{...}}
INSIDE the first\afterpage
.