GeneralStop LaTeX compile with a command?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
fenn
Posts: 5
Joined: Sun Jul 05, 2009 9:21 pm

Stop LaTeX compile with a command?

Post by fenn »

This is my first post, and forgive me if I'm asking something that's already been answered.

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

Code: Select all

 \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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Stop LaTeX compile with a command?

Post by daleif »

it should not about, it should stop on the error, if it just aborts the user will never know.

Use for example \PackageError{packagename}{error message}{help text}, for more info see

texdoc clsguide
fenn
Posts: 5
Joined: Sun Jul 05, 2009 9:21 pm

Stop LaTeX compile with a command?

Post by fenn »

Actually, I found exactly what I'm looking for:

Code: Select all

\errmessage{This is an error message!}
Thanks though.
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Stop LaTeX compile with a command?

Post by daleif »

well, pros and cons, using \PackageError or \ClassError the user will know which package or class caused the error, and may get some help as to how they should proceed.
Post Reply