LaTeX forum ⇒ GeneralDynamic global variable definition

LaTeX specific issues not fitting into one of the other forums of this category.
MoJan
Posts: 1
Joined: Sun Oct 27, 2024 5:02 am

Dynamic global variable definition

Postby MoJan » Sun Oct 27, 2024 5:11 am

Hi,

I want to define a global variable whose name is dynamic and assigned by using a counter.
This is my code but it does not work. Moreover, I do not know how to ask latex to write the in the aux file the current value of the counter and not just \themycounter because the value of the counter changes through the document.

\documentclass{article}
\usepackage{globalvals}

\begin{document}

\newcounter{mycounter}
\setcounter{mycounter}{10}

\useVal{key10}

% somewhere else
\defVal{key\themycounter}{test test \themycounter}

\end{document}


Thank you for your time.

Recommended reading 2024:

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

Return to “General”

Who is online

Users browsing this forum: No registered users and 9 guests