After reading basics about catcode I started to use conditionals to autoset the preamble.
Surprisingly when sandwiching the command I do get the error Undefined control sequence. \if@oneside, also there is @ within the command:
\makeatletter % ??? why does it only work without catcode sandwich
\if@oneside\newcommand{\onetwoside}{oneside} \else\newcommand{\onetwoside}{twoside}\fi % Autoset var for later according to choosen layout
\makeatother
Using the if directly works fine. Where to read up on this?
\if@twoside; never heard of\if@oneside. – campa Apr 11 '16 at 14:24\makeatletterthe conditional is always false because it tests (with\if) if@andoare the same. With\makeatletteryou get notified that\if@onesideis not defined. – cgnieder Apr 11 '16 at 14:29