LaTeX forum ⇒ LaTeX Beginner's GuideCatching error messages

Questions and answers about the LaTeX Beginner's Guide
topsquark
Posts: 71
Joined: Wed Oct 05, 2022 10:30 pm

Catching error messages

Postby topsquark » Mon Oct 02, 2023 10:12 pm

I have occasionally seen lines of code that appear to catch errors and then the program alters the situation to deal with it, rather that let the error shut the code down.

Trouble is, when I search for where I saw it, I get just about every language but TikZ.

As a quick example of what I am trying to do, I'm making a projectile motion code and I want the code to catch if there's an error in the data, that the object will not reach the target. This would entail taking the square root of a negative number. Now, I don't have to get fancy: I can just calculate the discriminant and do an ifthenelse to stop the error before it happens. But if an error could be caught, it might be a useful debugging tactic to have handy.

A link to an example would probably be enough. I just need to see how to structure the code first. Then I can come back and ask any specific questions as needed. I'm just looking for a starting point.

Thanks!

-Dan

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics

Return to “LaTeX Beginner's Guide”

Who is online

Users browsing this forum: No registered users and 3 guests