Am 06.10.2026 um 17:20 schrieb Jim Diamond via ntg-context:
On Tue, Oct 6, 2026 at 09:59 (+0200), Fabrice C wrote:
Hi,
Wolfgang suggested some code to me for inserting a Python script. It
worked perfectly until today.
Thanks
Fabrice
\defineframedtext
[algorithmframe]
[width=fit,
foregroundstyle={\tt\switchtobodyfont[11pt]},
framecolor=,
rulethickness=,
location=middle,
after=,
before=,
]
\starttext
\startlinecorrection[blank]
\startmidaligned
\algorithmframe{def pyramide(n) :
\hskip 5ex S = 0
\hskip 5ex for i in range(1,n+1) :
\hskip 10ex S = \ldots
\hskip 5ex return \ldots
}
\stopmidaligned
\stoplinecorrection
\stoptext
Hi Fabrice,
did it really work "recently" ?
In any case, your algorithm is a bit too tense and needs to relax more.
Here is a working version of your document:
\defineframedtext
[algorithmframe]
[width=fit,
foregroundstyle={\tt\switchtobodyfont[11pt]},
framecolor=,
rulethickness=,
location=middle,
after=,
before=,
]
\starttext
\startlinecorrection[blank]
\startmidaligned
\algorithmframe{def pyramide(n) :
\hskip 5ex\relax S = 0
\hskip 5ex\relax for i in range(1, n+1) :
\hskip 10ex\relax S = \ldots
\hskip 5ex\relax return \ldots
}
\stopmidaligned
\stoplinecorrection
\stoptext
I hope this helps.
With LMTX you can also write \hskip{10ex} and only values within the
braces are used for the horizontal skip, be aware that spaces after the
right braces appear as additional horizontal space in the output.
Another method is to use \definehspace[<name>][<value>] to create names
skips and call them at the begin of the line with \hspace[<name>] which
will ignore extra space characters after the right bracket.
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
___________________________________________________________________________________