I googled about this problem with no result yet. You might discourage this, but is there a way to suppress errors?
This is an example how it should work.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\begin{document}
\ifx\foo\undefined
\else
\foo
\fi
\def\foo{anything}
\ifx\foo\undefined
\else
\foo
\fi
should equal
%\suppressUndefError
\foo
\def\foo{anything}
\foo
%\Unsuppress
\end{document}
The purpose of this is, to ease the work for layout developers for my package. If this isn't possible or a very bad idea for some reasons, the solution would be to
A) tell them to insert this by themselves
B) define a macro \def\secure@Maestro#1{\ifx#1\undefined\else #1\fi}
B doesnt work since I can't pass macros to it, which are undefined.
Edit:
For anyone who encounters the same problem, this [Trapping LaTeX error/warning] might help.
suppresserrors? That (La)TeX ignores them and goes to next content? What is wrong with\@ifundefined{foo}{}{}?? – May 27 '16 at 18:29\relax. They should behave like\relax. – MaestroGlanz May 27 '16 at 18:30\def\secure@Maestro#1{\ifx#1\undefined\else #1\fi}so that it's testing the macro that's about to be used? – David Carlisle May 27 '16 at 18:33\huge{\title}\par\author\\ \webadresswithout worrying if one of them really exists. – MaestroGlanz May 27 '16 at 18:35\providecommand{\foo};-) – May 27 '16 at 18:36\def\author{}or\def\author{\ClassError{MG}{author not set}{}to silently ignore or make a specific error rather than an undefined command error. if for example you just ignore \author you would get an error from\\about no line to end. – David Carlisle May 27 '16 at 19:19\ifx#but now the following sentence is false, b does work as you can pass it undefined macros – David Carlisle May 27 '16 at 19:21\webaddressand get no output? Btw: do you really want to type the author in \huge? – Ulrike Fischer May 27 '16 at 19:22\maketitlepagehere. – MaestroGlanz May 29 '16 at 08:04