I'm beginning to learn LaTeX and I need some help with counters.
My goal is to store the value a certain counter reaches at some point in the document and use it later. This is my attempt:
\documentclass{article}
\begin{document}
\section{title}
text
\let\myvalue\thesection
\section{title}
text
\myvalue
\end{document}
but \myvalue
prints 2 instead of 1.
I read this: What is the difference between \let and \def? but let does not seem to store the value at the definition time in my case.
What am I doing wrong?
\myvalue
after the second section. The declaration\let\myvalue\thesection
is just the definition of what\myvalue
is. I suppose you want something similar to the referencing command. – azetina Nov 14 '13 at 21:03\myvalue
for? If it's for saying something like “As we say in Section 1”, then you should add\label{sec:whatever}
(with a more meaningful string instead ofsec:whatever
, of course) and say, when you need it,As we saw in Section~\ref{sec:whatever}
. – egreg Nov 14 '13 at 21:09