combining \definetyping and \definebuffer
Hi, I’d like to use a custom buffer ("MyBuffer") to use a custom typing style ("MyCode"). How does that work? """ \usemodule[visual] \definetyping[MyCode] \setuptyping[MyCode][ option=tex, numbering=file, ] \definebuffer[MyBuffer] \startMyBuffer \fakewords{10}{20} \stopMyBuffer \starttext \startMyCode \fakeword \stopMyCode \getMyBuffer \typeMyBuffer \stoptext """ Hraban
Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not executed) with colour coding on the keyword and line numbered; then the block text fakewords from the visual module; then the \fakewords macro shown (again not executed) as per the default for typing. What were you exepcting if not this? (onTeXt ver: 2023.07.18 22:07 LMTX)
On 29 Jul 2023, at 20:09, Henning Hraban Ramm
wrote: Hi, I’d like to use a custom buffer ("MyBuffer") to use a custom typing style ("MyCode"). How does that work?
""" \usemodule[visual]
\definetyping[MyCode]
\setuptyping[MyCode][ option=tex, numbering=file, ]
\definebuffer[MyBuffer]
\startMyBuffer \fakewords{10}{20} \stopMyBuffer
\starttext
\startMyCode \fakeword \stopMyCode
\getMyBuffer
\typeMyBuffer
\stoptext """
— Bruce Horrocks Hampshire, UK
Am 29.07.23 um 22:06 schrieb Bruce Horrocks:
Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not executed) with colour coding on the keyword and line numbered; then the block text fakewords from the visual module; then the \fakewords macro shown (again not executed) as per the default for typing.
The setup for MyCode is not applied to \typeMyCode, and I don’t know how it could; something like \typeMyBuffer[MyCode] doesn’t work. Hraban
Am 29.07.23 um 22:06 schrieb Bruce Horrocks:
Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not executed) with colour coding on the keyword and line numbered; then the block text fakewords from the visual module; then the \fakewords macro shown (again not executed) as per the default for typing.
The setup for MyCode is not applied to \typeMyBuffer, and I don’t know how it could; something like \typeMyBuffer[MyCode] doesn’t work. Hraban
I'm on mobile now so I can't type out a complete solution, but I think that what you're looking for is in this file: https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/documentation/un... It doesn't exactly do what you specifically asked for, but I think that it's pretty similar to your end goal. There's a .tex file with example usage in the same folder and a link to the compiled PDF from the main repo page. Thanks, -- Max
Am 29.07.23 um 22:49 schrieb Max Chernoff:
I'm on mobile now so I can't type out a complete solution, but I think that what you're looking for is in this file:
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/documentation/un...
It doesn't exactly do what you specifically asked for, but I think that it's pretty similar to your end goal. There's a .tex file with example usage in the same folder and a link to the compiled PDF from the main repo page.
Thank you! Well, I’m sure it’s in there, and it’s an impressive module, but I don’t understand the code – too many commands I never heard of. I’ll try again tomorrow when my head hopefully hurts less and there won’t be concerts on both sides of my quarter… Hraban
On 7/29/2023 10:35 PM, Henning Hraban Ramm wrote:
Am 29.07.23 um 22:06 schrieb Bruce Horrocks:
Your example seems to work: I see the \getbuffer[MyBuffer] command typed (not executed) with colour coding on the keyword and line numbered; then the block text fakewords from the visual module; then the \fakewords macro shown (again not executed) as per the default for typing.
The setup for MyCode is not applied to \typeMyBuffer, and I don’t know how it could; something like \typeMyBuffer[MyCode] doesn’t work.
These commands inherit from buffer, so \setupbuffer will work. But as I need to prevent you to come up with some ugly hack (after all your upocoming book should be hack free) ... ... attached an extension that supports inheritance (via category), still honors 'buffer' otherwise and accepts an optional category instead of settings. take your choice ... You can put the patch in cont-new.mkxl assuming you wikify it too. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am 29.07.23 um 23:16 schrieb Hans Hagen:
On 7/29/2023 10:35 PM, Henning Hraban Ramm wrote:
The setup for MyCode is not applied to \typeMyBuffer, and I don’t know how it could; something like \typeMyBuffer[MyCode] doesn’t work.
These commands inherit from buffer, so \setupbuffer will work. But as I need to prevent you to come up with some ugly hack (after all your upcoming book should be hack free) ...
;-D I’m not sure my book will even go so deep, it’s already too big and will never contain everything I’d like it to. For the code examples therein I used some hacks (getting rid of them one by one), but I’m working on a module (more like a LaTeX-style document class) for DANTE’s DTK, to be able to write my articles about ConTeXt in ConTeXt and have them included as PDFs. For other authors, I’d like the syntax to be as simple as possible (using generic ConTeXt macros), so I use \setuptyping for the general style with a background box. But that conflicts with the setups for special cases like code and result side by side. I guess I’ll also include this in the CGJ setup.
... attached an extension that supports inheritance (via category), still honors 'buffer' otherwise and accepts an optional category instead of settings. take your choice ...
You can put the patch in cont-new.mkxl assuming you wikify it too.
Thank you! Will do. I guess it’ll be in the next upload, too? Hraban
participants (4)
-
Bruce Horrocks
-
Hans Hagen
-
Henning Hraban Ramm
-
Max Chernoff