[tex-eplain] Treat \refn as a number?

Rodolfo Medina romeomedina at libero.it
Fri Aug 20 12:14:28 CEST 2004


Oleg Katsitadze wrote:

>On Wed, Aug 18, 2004 at 11:37:34PM +0200, Rodolfo Medina wrote:
>> I was thinking though that maybe the problem that the \IsInteger
definition
>> is able to work out,
>> i.e. to compare \refn with a number,
>> can alternatively be solved as well in the way that was suggested by
Hartmut
>> Henkel,
>> that I reported in my previous message.
>
>Seems to work.  But this will do only if you are comparing the label with a
>certain number.  In my case, I did not know what number the label could
expand
>to (it was a page number), and I needed to set a \count register to the
label's
>value.  So I'm still stuck with \IsInteger.

Hi.
The \comparemynumberwithrefn command
will compare a certain value of \mynumber,
reported by \refn, with the actual one:

%%%%%%%%%%%%%%beginning of file%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input eplain

\newcount\mynumber
\def\comparemynumberwithrefn#1{%
	\edef\tempa{\refn{#1}}\edef\tempa{\meaning\tempa}
      \edef\tempb{\the\mynumber}\edef\tempb{\meaning\tempb}%
      \ifx\tempa\tempb yes
       \else no
      \fi
}
\def\mydef{\global\advance\mynumber by 1}
\mydef\definexref{label1}{\the\mynumber}{}

\comparemynumberwithrefn{label1}

\mydef
\comparemynumberwithrefn{label1}

\bye
%%%%%%%%%%%%%%%%%%end of file%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Similarly, the \comparefoliowithrefn command
will compare a certain page number,
reported by \refn, with the actual:

%%%%%%%%%%%%%%%%%%beginnign of file%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input eplain

\def\comparefoliowithrefn#1{%
	\edef\tempa{\refn{#1}}\edef\tempa{\meaning\tempa}
      \edef\tempb{\folio}\edef\tempb{\meaning\tempb}%
      \ifx\tempa\tempb yes
       \else no
      \fi
}
%Label for the page number:
\def\pagelabel#1{\definexref{#1}{\folio}{}}

\pagelabel{label2}

\comparefoliowithrefn{label2}

\vfill\eject

\comparefoliowithrefn{label2}

\bye
%%%%%%%%%%%%%%%%%%end of file%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Can this deal with your case?
If not, could you maybe send your code?
Now I'd be curious to see
if what you need can be worked out with the \temp... \meaning procedure,
which looks more general than \IsInteger.

Best,
        Rodolfo



More information about the tex-eplain mailing list