\begin{TemplatePdfSection} \usepackage{...} .... \end{TemplatePdfSection}
\DefineTemplateSection[enabled]{TemplatePdfSection} % zusammen mit \SetTemplateSection{TemplatePdfSection}{enabled}
Probiert habe ich es mit folgendem Code, aber der wirft mir sofort Fehler sobald ich Code in eine Umgebung packe. Das Paket comment ist auch nicht meine erste Wahl, aber das einzige was ich dafür kannte um es zu missbrauchen...
\documentclass[]{article} %\usepackage[latin1]{inputenc} %\input{preambel/preambel} \RequirePackage{ifthen} \makeatletter %%% --- basic missing latex code \newcommand*{\provideenvironment}{% \@ifstar {\@sprovideenvironment}{\@provideenvironment}% } \newcommand*{\@sprovideenvironment}[1]{% \@ifundefined{#1}{\newenvironment*{#1}}{\@gobbletwo}% } \newcommand*{\@provideenvironment}[1]{% \@ifundefined{#1}{\newenvironment{#1}}{\@gobbletwo}% } \makeatother \RequirePackage{comment} % \DefineTemplateSection[enabled]{TemplatePdfSection} \newcommand{\DefineTemplateSection}[2][true]{ % % create environment that does nothing \provideenvironment*{#2}{}{} % check how to handle the contents \ifthenelse{\boolean{#1}}{ % do nothing }{ % hide contents of environment \excludecomment{#2} } }% \DefineTemplateSection[false]{TemplateMath} \DefineTemplateSection[true]{TemplateFigures} % \newenvironment{TemplateMath}{}{} % \newenvironment{TemplateFigures}{}{} \begin{TemplateMath} \usepackage{amsmath} \end{TemplateMath} % \begin{TemplateFigures} \usepackage{graphicx} \end{TemplateFigures} \listfiles \begin{document} \end{document}