On avoiding the intended (but unwanted) effect of \outer

Taylor, P P.Taylor at rhul.ac.uk
Fri Oct 18 17:59:51 CEST 2019


Finding that I was continually re-using the sequence :

    \newbox \xxxbox
    \setbox \xxxbox = \hbox {...}

I thought to introduce an adjunct macro \imagebox, as in :

    \def \imagebox #1{\newbox #1\setbox #1}

such that I could thereafter write

    \imagebox \xxxbox = \hbox {...}

However, \newbox is defined with the \outer prefix and therefore cannot be used in a macro definition.  \let \outer = \relax before the definition does not help.  Victor Eijkhout [2] noted (p.~96) "[...] it is inconvenient that some of the plain macros are outer [...]. One remedy is to redefine them, without the ‘outer’ option, which is done for instance in LATEX, but cleverer tricks are possible" but failed (as far as I could see) to describe any of those cleverer tricks.  Stephan von Bechtolsheim [1] gives the canonical Knuthian definition of \outer (Vol.~III, p.~179) but also (as far as I could see) fails to offer any workaround.  Finally one suggested itself :


\def \imagebox #1{\csname newbox\endcsname #1 \setbox #1}

Thereafter I can write (e.g.)


\imagebox \logobox = \hbox {\XeTeXpdffile ../../Logos/WBH-Logo.pdf height \imageheight}

\imagebox \flagbox = \hbox {\XeTeXpdffile ../../Flags/St-Piran.pdf height \imageheight}

This would seem to be necessary and sufficient.
Philip Taylor
--------
[1] @Book
{Bechtolsheim:TP93c,
  author =       "Stephan von Bechtolsheim",
  title =        "{\TeX} in Practice: Tokens, Macros",
  publisher =    pub-SV,
  year =         "1993",
  ISBN =         "0-387-97597-7, 3-540-97597-7",
  LCCN =         "Z253.4.T47 B4 1993",
  volume =       "3",
  address =      pub-SV:adr,
  bibdate =      "Mon Oct 18 15:41:37 1993",
  acknowledgement = ack-nhfb,
}

[2] @Book
{Eijkhout:TTT92,
  author =       "Victor Eijkhout",
  title =        "{\TeX} by Topic, {A} {\TeX}nician's Reference",
  publisher =    pub-AW,
  address =      pub-AW:adr,
  year =         "1992",
  ISBN =         "0-201-56882-9",
  LCCN =         "Z253.4.T47 E38 1992",
  pages =        "vii + 307",
  bibdate =      "Tue Dec 14 22:47:52 1993",
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20191018/8646426b/attachment.html>


More information about the texhax mailing list