ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX?
       [not found] <mailman.440.1641107345.1172.ntg-context@ntg.nl>
@ 2022-01-02 10:30 ` Benjamin Buchmuller via ntg-context
  2022-01-02 10:47   ` How to make \def accept block or buffer as part of (long) command argument Benjamin Buchmuller via ntg-context
  2022-01-02 11:43   ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Hans Hagen via ntg-context
  0 siblings, 2 replies; 7+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-01-02 10:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Benjamin Buchmuller

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* How to make \def accept block or buffer as part of (long) command argument
  2022-01-02 10:30 ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Benjamin Buchmuller via ntg-context
@ 2022-01-02 10:47   ` Benjamin Buchmuller via ntg-context
  2022-01-02 11:19     ` Hans Hagen via ntg-context
  2022-01-02 11:43   ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Hans Hagen via ntg-context
  1 sibling, 1 reply; 7+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-01-02 10:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Benjamin Buchmuller

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make \def accept block or buffer as part of (long) command argument
  2022-01-02 10:47   ` How to make \def accept block or buffer as part of (long) command argument Benjamin Buchmuller via ntg-context
@ 2022-01-02 11:19     ` Hans Hagen via ntg-context
  2022-01-02 13:14       ` Benjamin Buchmuller via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2022-01-02 11:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Benjamin Buchmuller

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX?
  2022-01-02 10:30 ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Benjamin Buchmuller via ntg-context
  2022-01-02 10:47   ` How to make \def accept block or buffer as part of (long) command argument Benjamin Buchmuller via ntg-context
@ 2022-01-02 11:43   ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2022-01-02 11:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Taco Hoekwater
  Cc: Hans Hagen, Benjamin Buchmuller

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make \def accept block or buffer as part of (long) command argument
  2022-01-02 11:19     ` Hans Hagen via ntg-context
@ 2022-01-02 13:14       ` Benjamin Buchmuller via ntg-context
  2022-01-02 13:43         ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-01-02 13:14 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Benjamin Buchmuller, mailing list for ConTeXt users

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 <j.hagen@xs4all.nl> 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
> -----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make \def accept block or buffer as part of (long) command argument
  2022-01-02 13:14       ` Benjamin Buchmuller via ntg-context
@ 2022-01-02 13:43         ` Hans Hagen via ntg-context
  2022-01-02 17:06           ` Benjamin Buchmuller via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2022-01-02 13:43 UTC (permalink / raw)
  To: Benjamin Buchmuller; +Cc: Hans Hagen, mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make \def accept block or buffer as part of (long) command argument
  2022-01-02 13:43         ` Hans Hagen via ntg-context
@ 2022-01-02 17:06           ` Benjamin Buchmuller via ntg-context
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Buchmuller via ntg-context @ 2022-01-02 17:06 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Benjamin Buchmuller, mailing list for ConTeXt users

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 <j.hagen@xs4all.nl> 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
> -----------------------------------------------------------------

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-02 17:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.440.1641107345.1172.ntg-context@ntg.nl>
2022-01-02 10:30 ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Benjamin Buchmuller via ntg-context
2022-01-02 10:47   ` How to make \def accept block or buffer as part of (long) command argument Benjamin Buchmuller via ntg-context
2022-01-02 11:19     ` Hans Hagen via ntg-context
2022-01-02 13:14       ` Benjamin Buchmuller via ntg-context
2022-01-02 13:43         ` Hans Hagen via ntg-context
2022-01-02 17:06           ` Benjamin Buchmuller via ntg-context
2022-01-02 11:43   ` Dangerous bends symbol in manfnt.afm accidentally chopped by LMTX? Hans Hagen via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).