(I'm aware there has been a similar question before, but this one has a twist)
I wanted a verbatim macro to use which would use an unlikely character as an end-of-verbatim -marker (unlikely as in it would be unlikely to be included in the text that would become verbatim), and looked up a couple of suggestions from Appendix D of The TeXbook, until something caught my eye:
Another approach is to keep one character untouchable. For example, it’s possible to define things so that
\verbatim⟨char⟩⟨text⟩⟨char⟩
will typeset the⟨text⟩
verbatim, where the⟨text⟩
is not supposed to contain any occurrences of the repeated delimiter⟨char⟩
:\def\verbatim{\begingroup\setupverbatim\doverbatim} \def\doverbatim#1{\def\next##1#1{##1\endgroup}\next}
Now, combining this with XeTeX would allow me to use a character from the wide, wide Unicode range as the end-marker. (Based on the finding that I can do eg. \def\fi{foo}
, and it works.)
Alas, adding to the above the previously mentioned macros from Appendix D:
\def\setupverbatim{\tt\def\par{\leavevmode\endgraf} \catcode`\`=\active \obeylines\uncatcodespecials\obeyspaces} \def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
and trying it out (the fi -character is the Unicode fi-ligature),
\verbatim fi |\%_^foo{\it bar}
baz
fi
\bye
gives me an error about Missing $
, which means there is something not working with the \verbatim
macro. I just can't figure out what.