Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX?
Hi list, using this example from the wiki, the dbend symbol appears cropped on the left side on my machine (ConTeXt ver: 2021.12.10 11:41 LMTX fmt: 2021.12.14), but not on the ConTeXt live server? Any possible reasons? \definefontsynonym [bends] [file:manfnt.afm] \startsymbolset [Dangerous Bends] \definesymbol [dbend] [\resolvedglyphdirect{bends}{n:char_7e}] \definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}] \stopsymbolset \setupsymbolset [Dangerous Bends] \starttext \symbol{dbend}\quad \symbol{lhdbend} \stoptext Thanks Benjamin
Hi list, I'm playing around with blocks and buffers again, realizing that I cannot use them inbetween a \start...\stop that I defined myself. Apparently, they work between \startsection...\stopsection and the like, so I was wondering how I should define or expand #2 in the MWE below to make TeX happily accept these useful features? Thanks a lot Benjamin \starttext \let\stopMyCommand\relax \tolerant\protected\def\startMyCommand[#1]#2\stopMyCommand{ Optional argument #1 Content #2 } \bf Here we test the command: Works \tf \startMyCommand[is optional] gets processed! \stopMyCommand \bf Here we test the block: Works \tf \defineblock[MyBlock] \beginMyBlock Block for something else. \endMyBlock \useblocks[MyBlock][criterium=text] \bf Here we test the block inside command: Fails \tf % UNCOMMENT BELOW FAILS: tex error > runaway error: end of file encountered % % \startMyCommand[is optional] % Still? % % \beginMyBlock % Block for something else. % \endMyBlock % \stopMyCommand \definebuffer[MyBuffer] \bf Here we test the buffer: Works \tf \startbuffer[MyBuffer] Buffer for something else. \stopbuffer \getbuffer[MyBuffer] \bf Here we test the buffer inside command: Fails \tf % UNCOMMENT BELOW FAILS: tex error > runaway error: end of file encountered % % \startMyCommand[is optional] % Still? % % \startbuffer[MyBuffer] % Buffer for something else. % \endbuffer % \stopMyCommand \stoptext
On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:
Hi list,
I'm playing around with blocks and buffers again, realizing that I cannot use them inbetween a \start...\stop that I defined myself. Apparently, they work between \startsection...\stopsection and the like, so I was wondering how I should define or expand #2 in the MWE below to make TeX happily accept these useful features? buffers are stored as-is so no catcode magic stored, contrary to macros
you can use \setbuffer but that doesn't solve the argument passing however, you can nest buffers so you can make other \start\stop commands buffers too and then do some at the start and (look for \defiebuffer) but it quickly becomes messy i think 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 -----------------------------------------------------------------
Thanks, Hans, for the answer, but I'm not sure if I get the point. While this is possible in ConTeXt: \startsection[title={My Title}] \beginMyBlock bla bla \endMyBlock \stopsection The following won't work (end of file error): \startMyCommand[optional={Maybe}] \beginMyBlock bla bla \endMyBlock \stopMyCommand I had hoped for a simple command/modifier like \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work in a similar way. But maybe, as Wolfgang stated here (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and blocks can't be used in commands. (To add: Even when passed as arguments during compilation?) Many Thanks again! Benjamin
On Jan 2, 2022, at 12:19, Hans Hagen
wrote: On 1/2/2022 11:47 AM, Benjamin Buchmuller via ntg-context wrote:
Hi list, I'm playing around with blocks and buffers again, realizing that I cannot use them inbetween a \start...\stop that I defined myself. Apparently, they work between \startsection...\stopsection and the like, so I was wondering how I should define or expand #2 in the MWE below to make TeX happily accept these useful features? buffers are stored as-is so no catcode magic stored, contrary to macros
you can use \setbuffer but that doesn't solve the argument passing
however, you can nest buffers so you can make other \start\stop commands buffers too and then do some at the start and (look for \defiebuffer) but it quickly becomes messy i think
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 -----------------------------------------------------------------
On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:
Thanks, Hans, for the answer, but I'm not sure if I get the point.
While this is possible in ConTeXt:
\startsection[title={My Title}]
\beginMyBlock bla bla \endMyBlock
\stopsection
The following won't work (end of file error):
\startMyCommand[optional={Maybe}]
\beginMyBlock bla bla \endMyBlock
\stopMyCommand
I had hoped for a simple command/modifier like \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work in a similar way.
But maybe, as Wolfgang stated here (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and blocks can't be used in commands. (To add: Even when passed as arguments during compilation?)
You can bet that WS is right. You really have to go dirty tex for this kind of magic: \defineblock[MyBlock] \keepblocks[MyBlock] \starttext \tolerant\def\startMyCommand[#1]% {\begingroup \setcatcodetable\notcatcodes \dostartMyCommand[#1]} \let\stopMyCommand\relax \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92 stopMyCommand}% {\endgroup % whatever #1 does \setbuffer[foo]#2\endbuffer \typebuffer[foo] \getbuffer[foo]} or \normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes {\stopMyCommand}}% {\endgroup % whatever #1 does \setbuffer[foo]#2\endbuffer \typebuffer[foo] \getbuffer[foo]} \startMyCommand[optional={Maybe}] \beginMyBlock bla bla \endMyBlock \stopMyCommand \stoptext and then of course further nesting mess ... 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 -----------------------------------------------------------------
Uff, this is indeed deep tex. Thanks a lot for the example, Hans! I still need to learn a lot. After a walk and a bit of fresh air, I found another (much easier) way around my problem. This works since I don't need to deal with #2 in any special way: \tolerant\def\startMyCommand[#1]% { \startallbeautifulcontextcommands % whatever #1 does } \tolerant\def\stopMyCommand% { \stopallbeautifulcontextcommands } Then one can do in the main files: \startMyCommand \beginMyBuffer bla bla \endMyBuffer \stopMycommand
On Jan 2, 2022, at 14:43, Hans Hagen
wrote: On 1/2/2022 2:14 PM, Benjamin Buchmuller wrote:
Thanks, Hans, for the answer, but I'm not sure if I get the point. While this is possible in ConTeXt: \startsection[title={My Title}] \beginMyBlock bla bla \endMyBlock \stopsection The following won't work (end of file error): \startMyCommand[optional={Maybe}] \beginMyBlock bla bla \endMyBlock \stopMyCommand I had hoped for a simple command/modifier like \pleaseacceptblocks\def\startMyCommand[#1]#2\stopMyCommand to have #2 work in a similar way. But maybe, as Wolfgang stated here (https://www.mail-archive.com/ntg-context@ntg.nl/msg73956.html), buffers and blocks can't be used in commands. (To add: Even when passed as arguments during compilation?)
You can bet that WS is right.
You really have to go dirty tex for this kind of magic:
\defineblock[MyBlock] \keepblocks[MyBlock]
\starttext
\tolerant\def\startMyCommand[#1]% {\begingroup \setcatcodetable\notcatcodes \dostartMyCommand[#1]}
\let\stopMyCommand\relax
\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\expandtoken\notcatcodes92 stopMyCommand}% {\endgroup % whatever #1 does \setbuffer[foo]#2\endbuffer \typebuffer[foo] \getbuffer[foo]}
or
\normalexpanded{\def\noexpand\dostartMyCommand[#1]#2\retokenized\notcatcodes {\stopMyCommand}}% {\endgroup % whatever #1 does \setbuffer[foo]#2\endbuffer \typebuffer[foo] \getbuffer[foo]}
\startMyCommand[optional={Maybe}]
\beginMyBlock bla bla \endMyBlock
\stopMyCommand
\stoptext
and then of course further nesting mess ...
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 -----------------------------------------------------------------
On 1/2/2022 11:30 AM, Benjamin Buchmuller via ntg-context wrote:
Hi list,
using this example from the wiki, the dbend symbol appears cropped on the left side on my machine (ConTeXt ver: 2021.12.10 11:41 LMTX fmt: 2021.12.14), but not on the ConTeXt live server? Any possible reasons?
\definefontsynonym [bends] [file:manfnt.afm]
\startsymbolset [Dangerous Bends] \definesymbol [dbend] [\resolvedglyphdirect{bends}{n:char_7e}] \definesymbol [lhdbend] [\resolvedglyphdirect{bends}{n:char_7f}] \stopsymbolset
\setupsymbolset [Dangerous Bends]
\starttext \symbol{dbend}\quad \symbol{lhdbend} \stoptext The lhdbend renders funny anyway. Maybe Taco is willing to have a look at it. It might actually make sense to make an opentype font and get rid of the afm/pfb here.
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 -----------------------------------------------------------------
participants (2)
-
Benjamin Buchmuller
-
Hans Hagen