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.

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.