[Tex/LaTex] Stop LaTeX compile with a command

compilingmacros

Is there a way to stop the compile process through the use of a command? Something like:

 \exception{This is a user-set exception.  Compile halted.}

So when performing the compile process, the specified text string is displayed to the console, and the compile process aborts?

The reason I want to do something like this is I want to have a conditional statement that checks a user-defined parameter. If the parameter is outside a desired range, I want the user to be informed that they made a bad choice and should change it.

Thanks in advance.

Best Answer

 \PackageError{mypackage}{you did it wrong}{help text}
Related Question