9

Is there a way to allocate the e-tex marks with names, similar to things like \newtoks? It shouldn't be too hard to implement, I just want to know if it exists already.

To be clear: e-tex makes available a bunch of more page marks, accessible with the primitive \marks<number>. I'm looking for a command which can be used as

\newmarks\thingy

to then produce the commands \thingymark{<text for mark>}, \topthingy, \botthingy, and \firstthingy for accessing them.

2

1 Answer 1

9

If you're talking LaTeX, then \newmarks is there:

> latexdef newmarks

\newmarks:
macro:->\e@alloc \marks \e@alloc@chardef {\count 256}\m@ne \e@alloc@top 

However \newmarks\thingy requires usage like

\marks\thingy{the mark text}
\topmarks\thingy
\botmarks\thingy
\firstmarks\thingy

It's not difficult to build upon this:

\newcommand{\newmarksname}[1]{%
  \expandafter\newmarks\csname #1\endcsname
  \expandafter\edef\csname marks#1\endcsname{\marks\csname #1\endcsname}%
  \expandafter\edef\csname top#1\endcsname{\noexpand\topmarks\csname #1\endcsname}%
  \expandafter\edef\csname bot#1\endcsname{\noexpand\botmarks\csname #1\endcsname}%
  \expandafter\edef\csname first#1\endcsname{\noexpand\firstmarks\csname #1\endcsname}%
}

and then, after \newmarksname{thingy} you'll have either the same syntax above but also

\marksthingy{the mark text}
\topthingy
\botthingy
\firstthingy

Adjust the interface to suit.

2
  • When you set the mark, it's also as \marks\thingy?
    – A Gold Man
    Commented Oct 13, 2017 at 11:44
  • @AGoldMan Oh, yes; I'll add the interface also for that.
    – egreg
    Commented Oct 13, 2017 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .