I have a problem, which I think can not be solved, except for workarounds. I want to pre-define pages and insert them later into the document. The problem is, that \par (if used in the pre-defined page) causes an error.
This is my MnWE:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{blindtext}
\makeatletter
%%%%makes a \page_#1 which expands to #2
\def\setpage#1#2{
\expandafter\def\csname page_#1\endcsname {
\newpage
#2
\clearpage
}
}
%%%%call the pages
\def\callpage#1{
\csname page_#1\endcsname
}
%%%%define pre-defined pages
\setpage{1}{insert Seite \par
\blindtext
}
\setpage{2}{insert Seite2 % note the implicit \par here
}
\begin{document}
Text
\callpage{1}
\callpage{2}
Wieder Text
\end{document}
I tried to redefine \par inside \setpage via
\def\par{\mbox{} \linebreak \indent}
but this is not compileable (memory error).
My \setpage-command should produce a separate page with the content of the argument #1. The argument should take anything, that can also be written between \begin{document} and \end{document}.
\long\defis your friend. That will accept\parinside the argument of the macro that has been defined with\long(in this case adding it in\long\def\setpage#1#2would be enough). In any case, since you are using LaTeX, why not\newcommand? – Manuel May 21 '16 at 15:59newcommand? Because I didn't know about this difference and I'm used to it, sincedefis shorter. – MaestroGlanz May 21 '16 at 16:02\newcommandis better – egreg May 21 '16 at 16:19