GeneralHow to require a variable to be set?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
sschuberth
Posts: 2
Joined: Fri May 07, 2010 12:15 pm

How to require a variable to be set?

Post by sschuberth »

Hi,

I'm currently writing my own little style (sty) file for the title page of my thesis (article document class). I'd like to introduce several new commands / variables, e.g. "\thesistype", that need to be set when using my style. It seems I somehow need to introduce these new required variables to LaTeX, even though I'm not setting them in the style file, but just using / inserting them via "\@thesistype".

So my question is, how can I tell LaTeX that my style requires a variable / command named "\thesistype" to be set, without actually setting it? The "\(re)newcommand" / "\providescommand" stuff only seems to be suitable if I'd like to actually set the value of the variable / command, not just check for its presence.

I've seen constructs like

Code: Select all

\def\department#1{\gdef\@department{#1}}
\def\@department{\@latex@warning@no@line{No \noexpand\department given}!!!\noexpand\department!!!}
but a) I don't understand how this works (Could some one explain it to my?) and b) I'm not sure all if this is the correct / recommended way to achieve what I want.

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

Post Reply