What is `\@gtempa` used for?

It's a global temporary macro a (followed by b, c etc as distinct from \@tempa which is a macro for local definitions.

The naming convention comes from LaTeX2.09 which used these all over the place however by 1993 when we did latex2e far too many packages (style files) were using \@tempa so we renamed all the internal uses in the format to \reserved@a etc

compare latex2.09

\def\hline{\noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
   \@tempa\@xhline}

and latex 2e

\def\hline{%
  \noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
   \reserved@a\@xhline}

One of the early latex2e announcements explained to package writers they could use \@temp... for whatever local use they wanted but should not use \reserved@... for uses outside the format.

However global use is used more rarely so the uses of \@gtempa got left as they were (although most were eliminated altogether)

compare 2.09

\def\@cline[#1-#2]{\noalign{\global\@cla#1\relax
\global\advance\@cla\m@ne
\ifnum\@cla>\z@\global\let\@gtempa\@clinea\else
  \global\let\@gtempa\@clineb\fi

with 2e

\def\@cline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height\arrayrulewidth\hfill
  \cr
  \noalign{\vskip-\arrayrulewidth}}

so it's just a conventional name often used by packages for global definitions (\gdef, \global\let) it isn't used much of course as being used with local definitions means that if any other package code could run between your code defining it and using it, it may have been over-written for a completely differemt purpose.


\@gtempa is a temporary scratch command, meant for global purposes (often used in conjunction with \xdef), but can be overwritten easily. It's just used for temporary storage globally and throw away after that. The prefix g indicates that it is designed for global
purposes.

However \@gtempa can mean a global temporary dim register as well.

It's quite useful, this way there's no need to use another command sequence to be defined and 'consuming' the number of registers for command names

The LaTeX core is full of those \@gtempa usages and dates back to the time when there wasn't plenty of registers, i.e. the times before eTeX appeared on the stage.

In a local sense there is a bunch of similar scratch registers, such as \@tempskipa, \@tempcnta,\@tempboxa`.

The \@.. prefix is meant to keep the macro internal, i.e. it can not be accidentally accessed without using \makeatletter...\makeatother

In expl3 the \g_tmpa_<foo> 'variables' have the same meaning as \@gtempa, where foo is something like clist or seq or tl etc.

Tags:

Macros