[tex-eplain] definexref and hanging indents

Oleg Katsitadze olegkat at gmail.com
Thu Jan 10 19:10:13 CET 2008



On Thu, Jan 10, 2008 at 12:14:31PM +0000, Adam Fenn wrote:
>
> > (It starts working if you put \smallskip
> > before \hang... _and_ a \par at the end of the section word.)
>
> Yes, that makes the hanging indentation work but it also puts the marker onto a new line.

Of course, I didn't mean that's how you should use it -- I just wanted
to prove my point :).

> In my attempt below only the argument from the last macro is passed on. Is this possible?

It doesn't work because the second \mymacro redefines the section
word.  It seems you are trying to use class words for an application
they are not intended for.  If what you want is a per-label word
instead of a per-class word, the following should work:

,----
| \input eplain
|
| \def\myref#1{%
|   \csname #1 phrase\endcsname
|   \reftie
|   \refn{#1}%
| }
|
| \def\mymacro#1#2{%
| #2
| \expandafter\def\csname #1 phrase\endcsname{#2}%
| \definexref{#1}{[marker]}{section}
| }
|
| \mymacro
| {firstref}
| {My first ref}
|
| \mymacro
| {secondref}
| {My second ref}
|
| \myref{firstref}
| \myref{secondref}
|
| \bye
`----

But if instead you want a section word, but which changes after using
a certain reference, then... well, it's going to be trickier :).  Let
me know if you actually need this.


Also note that there's a probably spurious space in your \mymacro:

> \def\mymacro#1#2{%
> #2
  ^^^
> \def\sectionword{#2}%
> \definexref{#1}{[marker]}{section}
> }

Maybe you'd need `#2%' there.

Cheers,
Oleg


More information about the tex-eplain mailing list