| 1 |
% $Id: partoken-ok.tex 60054 2021-07-25 16:07:35Z karl $ |
| 2 |
% Public domain. Originally written by Petr Olsak, 2021. |
| 3 |
% Testing \partokenname and \partokencontext primitives: successful tests. |
| 4 |
% |
| 5 |
% We want to test in iniTeX state, use "pdftex -ini partoken-test.tex" |
| 6 |
% Generating dvi output. |
| 7 |
% |
| 8 |
\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 |
| 9 |
\hsize=4in \vsize=4in \baselineskip=12pt |
| 10 |
\font\f=cmr10 \f % we want to typeset some text |
| 11 |
|
| 12 |
% Seting different partoken name |
| 13 |
\catcode`\_=11 |
| 14 |
\partokenname \_par |
| 15 |
\let \_par = \par |
| 16 |
\def\par{hello} |
| 17 |
% This empty line emits \_par (i.e., no output), no "hello": |
| 18 |
|
| 19 |
% Not-\long macro accepts \par in its argument, but does not accept \_par |
| 20 |
% (emitted here from blank line): |
| 21 |
\def\macro#1{} |
| 22 |
\macro{long test: \par} % without error |
| 23 |
% see partoken-xfail.tex for failing test. |
| 24 |
% |
| 25 |
\let \_endgraf=\_par |
| 26 |
\def \_par{PAR-TOKEN\_endgraf} |
| 27 |
% This empty line prints PAR-TOKEN (plus underfull \hbox |
| 28 |
% due to \parfillskip=0pt): |
| 29 |
|
| 30 |
% This \vskip prints Test PAR-TOKEN (plus underfull \hbox warning): |
| 31 |
Test \vskip1pt \relax |
| 32 |
% |
| 33 |
% This end-of-\vbox prints 0: Test text. (standard behavior): |
| 34 |
\vbox{\the\partokencontext: Test text.} |
| 35 |
% |
| 36 |
\partokencontext=1 |
| 37 |
% This prints 1: Test text.PAR-TOKEN (\_par called at end of \vbox): |
| 38 |
\vbox{\the\partokencontext: Test text.} |
| 39 |
% |
| 40 |
% This prints 1: no-align text (standard behavior): |
| 41 |
\halign{#\cr \noalign{\the\partokencontext: no-align text}} |
| 42 |
% |
| 43 |
\partokencontext=2 |
| 44 |
% This prints: 2: no-align textPAR-TOKEN (\_par called at end of \noalign): |
| 45 |
\halign{#\cr \noalign{\the\partokencontext: no-align text}} |
| 46 |
% |
| 47 |
% no blank line to elide final PAR-TOKEN. |
| 48 |
\end |