Am 30.08.2025 um 13:09 schrieb Hans Hagen via ntg-context:
On 8/30/2025 12:23 AM, Thangalin wrote:
\startbuffer[test]
<?xml version="1.0"?>
<document><pre>
|aaa|bbb|ccc|
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
</pre></document>
\stopbuffer
\startxmlsetups xml:setup
\xmlsetsetup{\xmldocument}{*}{-}
\xmlsetsetup{\xmldocument}{document|pre}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:setup}
\startxmlsetups xml:document
\startdocument \xmlflush{#1} \stopdocument
\stopxmlsetups
\define[2]\Verbatim{
\startxmldisplayverbatim
\setupbodyfont[#1]
\xmlflushspacewise{#2}
\stopxmldisplayverbatim
}
\startxmlsetups xml:pre
\Verbatim{TextFontIN}{#1}
\Verbatim{TextFontRM}{#1}
\Verbatim{TextFontSP}{#1}
\Verbatim{TextFontFC}{#1}
\Verbatim{TextFontLM}{#1}
\stopxmlsetups
\definefontfamily [TextFontSP] [tt] [Source Code Pro]
\definefontfamily [TextFontRM] [tt] [Roboto Mono]
\definefontfamily [TextFontIN] [tt] [Inconsolata]
\definefontfamily [TextFontFC] [tt] [Fira Code]
\definefontfamily [TextFontLM] [tt] [Luxi Mono]
\usetypescript[TextFont]
\xmlprocessbuffer{main}{test}{}
You can try with:
\define[2]\Verbatim{
\start
\showglyphs
\startxmldisplayverbatim
\obeyspaces
\xmlflushspacewise{#2}
\stopxmldisplayverbatim
\stop
}
\definefont[TestFont][inconsolata-regular.ttf]
until Wolfgang gives you the perfect answer wrt \definefontfamily.
I would [features=none] for the monospaced fonts but this is not the
reason for the wrong alignment.
Maybe we need some extra 'space/glue hack'.
The rows with spaces before/after the number have a different alignment
because *after* a normal space is inserted (the space *before* the
number is a active space where \obeyedspace is applied) and the verbatim
code changes the \spaceskip value to .5\emwidth.
% file: buff-ver.mkxl
\def\buff_verbatim_initialize_typing_two
{\spaceskip.5\emwidth\relax
...}
When you reset the \spaceskip value the alignment is correct.
\starttexdefinition Verbatim #1#2
\switchtobodyfont[#1]
\startxmldisplayverbatim
\spaceskip\zeropoint
\xmlflushspacewise{#2}
\stopxmldisplayverbatim
\stoptexdefinition
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________