I would like to modify the layout of some "special" chapters in my document, but afterwards reset to the layout I used before, i.e.
\documentclass{report}
\usepackage{titlesec}
\begin{document}
\chapter{Normal Chapter}
\section{Normal Section}
\subsection{Normal Subsection}
% ask for current lay out:
\titlespacing*{\chapter}{0pt}{-40pt}{10pt}
\titleformat{\chapter}{\centering\Large\bf}{}{0pt}{}{}
\titleformat{\section}{\large\bf}{}{0pt}{}
\titleformat{\subsection}{\normalsize\it}{}{0pt}{}
\chapter{Special Chapter}
\section{Special Section}
\subsection{Special Subsection}
% reset to initial lay out
\chapter{Normal Chapter Again}
\section{Normal Section Again}
\subsection{Normal Subsection Again}
\end{document}
How can I define variables that store the current settings and subsequently use them to reset?
Best Answer
You can group to limit the scope:
You can aldo define a new command to store your new settings, and then use this command inside a group as before:
Defining a similar command for the standard layout, you can now switch styles using the two commands without having to explicitly group: