Hi Bruce,
Thanks for sharing your work; it will be very useful to me.
Fabrice

Le jeu. 8 oct. 2026 à 01:00, Bruce Horrocks <[email protected]> a écrit :
>
>
>
> > On 6 Oct 2026, at 08:59, Fabrice C <[email protected]> wrote:
> >
> > Hi,
> > Wolfgang suggested some code to me for inserting a Python script. It
> > worked perfectly until today.
> > Thanks
> > Fabrice
>
> Hi Fabrice,
>
> Rather than put \hskip{5ex} or similar at the beginning of each line, I use a 
> typing environment for source code listings as then I can easily cut and 
> paste the code from the original source file.
>
> %======
> \definefont [fntPython] [name:texgyrecursor at 12pt]  %[line=14pt]
> \definelinenumbering [lnPython] [location=text,style={\small\tt}]
> \definetyping [PythonListing] [style=\fntPython,escape=yes]
>
> \starttext
> The code is as follows:
> \startnarrower\startlinenumbering[lnPython]\startPythonListing[numbering=line]
> # Write Fibonacci series up to n
> def fib(n):
>     a, b = 0, 1
>     while a < n:
>         print(a, end=' ')
>         a, b = b, a+b
>     print()
> \stopPythonListing\stoplinenumbering\stopnarrower
> \stoptext
> %======
>
> --
> Bruce Horrocks
> Hampshire, UK
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to