Search code examples
latexmiktex

LaTeX, MiKTeX, using variables


I'm still pretty new to TeX and MiKTex but I had a question. I want to be able to access a variable called VERSION that would store the current version number of my document and use that in my TeX document instead of having to hardcode the number each time. Also, I use the TeXworks application in MiKTeX to generate my PDF versions of the documents. Is there a way, using TeXworks to have it also recognize this variable when generating the PDF?

Thanks for any help!

Russ


Solution

  • You could store the version number in a macro and reuse it throughout the document:

    \documentclass{article}
    
    \newcommand{\version}{1.3}
    
    \title{test \version}
    
    \begin{document}
    
    \maketitle
    
    The current version \version\ is stable
    
    \end{document}