Hi to all,
someone say if it is possible to define a variable in latex and after that to use it in a if instruction?
I can't find information about this..
For example i would like to define a variable called "version" and use it to include a .tex file rather than another .tex file.
Thank you for the help
General ⇒ Define Variable
NEW: TikZ book now 40% off at Amazon.com for a short time.

Define Variable
TeX does not have variables per se, and its if construct is also rather unusual. You could use something like this using macros and token comparison:
See also this and this thread.
Cheers,
Tomek
Code: Select all
\def\verA{1}
\def\verB{2}
\def\ver{1}
\ifx\ver\verA
%do something for version 1
\fi
\ifx\ver\verB
%do something for version 2
\fi
Cheers,
Tomek
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Define Variable
Hi,
the comment package provides a simple way with environments for different versions that can be excluded or included.
Stefan
the comment package provides a simple way with environments for different versions that can be excluded or included.
Stefan
LaTeX.org admin