In LaTeX, how can I define a string variable whose content is used instead of the variable in the compiled PDF?
Let\'s say I\'m writing a tech doc on a software and
Use \def
command:
\def \variable {Something that's better to use as a variable}
Be aware that \def
overrides preexisting macros without any warnings and therefore can cause various subtle errors. To overcome this either use namespaced variables like my_var
or fall back to \newcommand
, \renewcommand
commands instead.