# Is there a newmarks command?

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.

• There is `\newmarks`, but `\newmarks\thingy` requires `\topmarks\thingy`, `\botmarks\thingy` and `\firstmarks\thingy`, like for boxes. – egreg Oct 13 '17 at 11:35
• See `emarks` documentation from the `etex` package, mirror.hmc.edu/ctan/macros/latex/contrib/emarks/emarks.pdf – Steven B. Segletes Oct 13 '17 at 11:37

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
``````

• When you set the mark, it's also as `\marks\thingy`? – A Gold Man Oct 13 '17 at 11:44