[texhax] in-section references

martin f krafft madduck at madduck.net
Wed Oct 3 14:45:28 CEST 2007

also sprach Donald Arseneau <asnd at triumf.ca> [2007.10.03.1304 +0100]:
> > If I do that, I just get a runaway argument error. But I can use
> > standard "printf" debugging with \typeout, read on...
> They have to work, wherever \typeout would work.  The problem is
> \typeout doesn't report the real definition because it expands.
> You could do:
> \typeput{\meaning\curref; \meaning\refpart}

I assume you mean \typeout instead of \typeput, then this is what
I get now:

  DEBUG: macro:->\protect \ref
  {section:deb-term-maintainer}macro:->3\hbox {}mac
  ro:->3.1\hbox {}macro:->3.1.0\hbox {}macro:->\hbox {}

So I guess the \protect prevents the expansion? Is there a way I can
"unprotect" it in the \ifx statements?

> >   #1 section 
> >   #2 3.1.1
> NO!  #2 = \ref{some-term} !


> Try \protected at edef\curref{#2}, but I suspect that gives
> differences from the plain characters "3.1.1".

I tried that before and it makes no difference: with hyperref
loaded, it'll be \ref{...}, if I do not load hyperref, then it is
expanded and the whole thing works.

> > \newcommand{\rrefx}[3]{%
> >   \protected at edef\curchapter{\thechapter\hbox{}}%
> >   \protected at edef\cursection{\thesection\hbox{}}%
> >   \protected at edef\cursubsection{\thesubsection\hbox{}}%
> >   \protected at edef\cursubsubsection{\thesubsubsection\hbox{}}%
> >   \protected at edef\curref{#2}%
> >   \def\refsame{#3}%
> >   \def\refother{#1~#2}%
> \show\curref
> \show\cursubsection

  \typeout {DEBUG: \meaning\curref \meaning\curchapter \meaning\cursecti...

yields a compilation error:

  ! Argument of \show has an extra }.
  <inserted text> 

> > so the \ref is substituted later, which breaks my approach. 
> Try \edef\curref{#2}, which will expand \ref, but I suspect it
> will give an error in expansion.


  ! Use of \@rule doesn't match its definition.
  \@ifnextchar ... \reserved at d =#1\def \reserved at a {
                                                  #2}\def \reserved at b {#3}\f...
> > Am I missing something?
> Probably you are missing a pre-existing package like "smartref". 

Ah, I shall try that. However, what is a bit sad is:

  Note that the references create by smartref and byname are *not*
  hyperlink, when hyperref is active. Maybe in the future ...

Thanks for your input. Maybe I can get my simple approach working
somehow, and I'd appreciate any hints.

martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net at madduck
i must confess, I was born at a very early age.
                                                       -- groucho marx
spamtraps: madduck.bogus at madduck.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://tug.org/pipermail/texhax/attachments/20071003/62328b61/attachment.bin 

More information about the texhax mailing list