From ad5b9f1271f48d5829421952b91c2e0e77f36dd9 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 7 Sep 2020 16:33:29 +0100 Subject: [PATCH] slowbox.dtx: Typeset and measure unknown boxes. If you try to set a slow box with an unknown name, it should be typeset and measured: otherwise bootstrapping is awful. Do this. --- slowbox.dtx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/slowbox.dtx b/slowbox.dtx index f4b71a7..a2c3909 100644 --- a/slowbox.dtx +++ b/slowbox.dtx @@ -34,7 +34,7 @@ %<+package> [2003/08/27 1.0 skipping of slow boxes] % \end{meta-comment} % -% \CheckSum{222} +% \CheckSum{223} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -111,6 +111,10 @@ % \env{slowbox$*$} environment takes a tag name, just like \env{slowbox} % does. % +% However, if \package{slowbox} sees a slow box \ it's not noticed +% before, it always typesets the box contents, and saves the measurements for +% later. +% % \DescribeMacro\slowboxbegin % \DescribeMacro\slowboxend % It's useful to define your own commands environments which create slow @@ -267,20 +271,21 @@ \begingroup% \def\sb@end##1{\endgroup}% \let\sb@ignore\ignore% - \expandafter\sb@hidden\csname sb@box:#1\endcsname{#1}% + \expandafter\sb@hidden\csname sb@box:#1\endcsname{#1}{#2}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\sb@hidden} % We're given the control token and the tag name. If the control sequence is -% like |\relax| then |\csname| must have invented it and we just have to make -% something up. Otherwise we put the right stuff in a frame. Don't forget -% to write out the box dimensions to the new aux file! +% like |\relax| then |\csname| must have invented it and we should typeset it +% anyway in order to measure it. Otherwise we put the right stuff in a +% frame. Don't forget to write out the box dimensions to the new aux file! % \begin{macrocode} -\def\sb@hidden#1#2{% - \ifx#1\relax\fbox{Unknown slow box \texttt{#2}!}% - \else\edef\next@{\noexpand\sb@hidden@i#1{#2}}\expandafter\next@\fi% +\def\sb@hidden#1#2#3{% + \ifx#1\relax\def\next@{\endgroup\sb@begin@show{#2}{#3}}% + \else\edef\next@{\noexpand\sb@hidden@i#1{#2}}\fi% + \next@% } \def\sb@hidden@i#1#2#3#4{% \frameonly{#1}{#2}{#3}{Omitted \texttt{#4}}% -- 2.11.0