I would like to define a new environment that changes the section titles via \titleformat. Obviously I have to "escape" the #1 somehow, so it is not considered to be an (undeclared) parameter to local_format_env, but a parameter to \titleformat. How do I do that?
(Omitting the [explicit] option to titlesec is not an option due to constraints not present in the example for simplicity of presentation.)
Minimal non-working example:
\documentclass{scrbook}
\usepackage[german]{babel}
\usepackage[utf8]{inputenc}
\usepackage[explicit]{titlesec}
\newenvironment{local_format_env}{
\titleformat{\section}{\normalfont\scshape\Large}{}{0pt}{#1} % <-- needs excaping
}{
\titleformat{\section}{\normalfont\Large}{}{0pt}{#1} % <-- needs escaping
}
\begin{document}
\section{Global Format}
\begin{local_format_env}
\section{Local Format}
\end{local_format_env}
\end{document}