Re: [NTG-context] Space before/after combinations + centring

2021-11-17 Thread Hans Hagen via ntg-context

On 11/17/2021 11:50 PM, Marco Patzer via ntg-context wrote:

On Wed, 17 Nov 2021 20:17:52 +0100
Wolfgang Schuster  wrote:


2. There are no changes to adjust the vertical before and after a
combination environment.


That's unfortunate.


Local patches can also be tricky because ConTeXt tries to freeze
the definitions of many user level commands which means they can't
be redefined when you use a strict overload mode (look at the
lowlevel security manual for this feature).


An overload like mine is probably exactly what the strict overload
mode is supposed to protect against.


The most reliable way to center you combination blocks is to put
them either in a float or put a framedtext environment around it.


The project comprises several hundred source files. That's why I
stayed away from rewriting the sources in the first place. I'll try
to bulk-change the sources.
combinations are really just a way to package things, not meant for 
direct usage in the page flow


\startlinecorrection[blank]
...
\stoplinecorrection

is one way to use them, or in floats; the same is true for natural tables

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
___


Re: [NTG-context] Space before/after combinations + centring

2021-11-17 Thread Marco Patzer via ntg-context
On Wed, 17 Nov 2021 20:17:52 +0100
Wolfgang Schuster  wrote:

> 2. There are no changes to adjust the vertical before and after a
> combination environment.

That's unfortunate.

> Local patches can also be tricky because ConTeXt tries to freeze
> the definitions of many user level commands which means they can't
> be redefined when you use a strict overload mode (look at the
> lowlevel security manual for this feature).

An overload like mine is probably exactly what the strict overload
mode is supposed to protect against.

> The most reliable way to center you combination blocks is to put
> them either in a float or put a framedtext environment around it.

The project comprises several hundred source files. That's why I
stayed away from rewriting the sources in the first place. I'll try
to bulk-change the sources.

Thanks for your explanations.

Marco
___
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
___


Re: [NTG-context] Math in LMTX and definemathcommand

2021-11-17 Thread Hans Hagen via ntg-context

On 11/17/2021 10:59 PM, Otared Kavian via ntg-context wrote:

Hi Hans,

Thank you for the new upload and the rewriting of the math fonts stuff, thanks 
also to Mikael S. I did several tests on real size math projects and did not 
notice important issues.


you missed the multiple primes issue (a bit too agressive lua code 
reduction, fixed in next upload)



The two issues I noticed, show up mainly with LucidaOT, and are explained in 
the following example:


thanks, mikael collects all that


If $A \subset {\Bbb R}$ is a set, its interior is denoted by $\interior{A}$. 
Can one have the circle over $A$ slightly bigger (probbaly this is font 
dependent)?


in principle we can scale individual glyphs (and when not default users 
can add their own lfg files)

The built-in commands $\liminf$ and $\limsup$ do not work properly with 
LucidaOT (I tried other fonts and there they are fine):


hm .. (in case of lucida, also check cambria and garamond as these have 
staircase kerns too so they are somewhat similar)


mikael is making test (and in the meantime i'm experimenting a bit 
forther with compact fonts because all has to work in that mode 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
-
___
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
___


[NTG-context] Math in LMTX and definemathcommand

2021-11-17 Thread Otared Kavian via ntg-context
Hi Hans,

Thank you for the new upload and the rewriting of the math fonts stuff, thanks 
also to Mikael S. I did several tests on real size math projects and did not 
notice important issues.

The two issues I noticed, show up mainly with LucidaOT, and are explained in 
the following example:

\setupbodyfont[lucidaot]

\definemathstackers[MySymbol]
[voffset=-1.4\mathexheight, % -.8\mathexheight
hoffset=\zeropoint,
mathclass=ord,
topoffset=.3\mathemwidth, % poor man's italic correction
middlecommand=\mathematics]

\define[1]\interior{\mathover[MySymbol]{176}{#1}} %2218 U+00B0

\definemathcommand [Argmin]  [limop] {\mfunctionlabeltext{ArgMin}}
\definemathcommand [liminfbar]  [limop] {\underline{\mfunctionlabeltext{lim}}}
\definemathcommand [limsupbar]  [limop] {\overline{\mfunctionlabeltext{lim}}}

\starttext
If $A \subset {\Bbb R}$ is a set, its interior is denoted by $\interior{A}$. 
Can one have the circle over $A$ slightly bigger (probbaly this is font 
dependent)?

The built-in commands $\liminf$ and $\limsup$ do not work properly with 
LucidaOT (I tried other fonts and there they are fine):
\startformula
x_{n} := (-1)^n, \quad\mbox{then} \quad \liminf_{n \geq 0}x_{n} = -1, \quad 
\limsup_{n\geq 0} x_{n}= +1.
\stopformula

The commands defined above, \type{\liminfbar} and \type{\limsupbar}, behave 
correctly in all fonts I tested:
\startformula
x_{n} := (-1)^n, \quad\mbox{then} \quad \liminfbar_{n \geq 0}x_{n} = -1, \quad 
\limsupbar_{n\geq 0}x_{n} = +1,
\stopformula
but not the command \type{\Argmin} (which does not show Argmin in any font…)
\startformula
\Argmin_{x\in {\Bbb R}} (x^2 - x + 1) = {1 \over 2}.
\stopformula

\stoptext

Best regards: Otared
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Idris Samawi Hamid ادريس سماوي حامد via ntg-context
On Wed, 17 Nov 2021 08:51:03 -0700, Henning Hraban Ramm via ntg-context  
 wrote:



TeX comments will illustrate:

==
This text goes into the abridged version.

% This text will appear in the unabridged version.

And this text goes into the abridged version.

% And this text goes into the unabridged version.

And this additional text goes into the abridged version.

% And this additional text goes into the unabridged version.
==

An abridged run will ignore the commented text, and an unabridged run  
will include it.


Ok, it it’s about such small snippets, consider  
\doifmode{mode1,mode2}{Conditional text}.


I don’t think you would get shorter markup with nesting.

More possibilities see  
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.contextgarden.net%2FModesdata=04%7C01%7CIdris.Hamid%40ColoState.EDU%7C14c5b723751a4eb2bb9308d9a9e42f31%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637727619814441586%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=tljjceauaTpF%2FYlSHYhna05nmXP5ppCsMVHDj0VNBWk%3Dreserved=0


Started there before starting this thread, but the focus appears to be  
global and the one and only working example near the end is pretty trivial  
-)


But armed with the answers received here, will look at it again for ideas.


Consider variant texts:

===
Here is some text that
  contains % mode=variantone
  includes % mode=varianttwo
  is comprised of % mode=variantthree
some variants.

Here is some more text that
  features % mode=variantone
  exhibits % mode=varianttwo
  illustrates % mode=variantthree
some variants.
===

This example is to be processed to produce exactly three distinct  
results. So, e.g., "contains" and "features" belong to variantone. Etc.  
So like XML.


How about:

Here is some text that
\startmodeset
[variantone] {contains}
[varianttwo] {includes}
[variantthree]   {is comprised of}
[default]{doesn’t contain}
\stopmodeset
some variants.


Very nice, many thanks! Will experiment with this method as well,  
comparing and contrasting with blocks and Aditya's modes method.


It might be a bit annoying, but you could end the previous mode before  
starting the next.
Assuming that I'm not misunderstanding you: For a book-length project,  
that would be beyond annoying.


Well, it looks like you’ll need a lot of markup anyway.


Indeed. And that's ok, as long as the structure is simple enough.. Occam's  
razor!


Best wishes
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Idris Samawi Hamid ادريس سماوي حامد via ntg-context
On Wed, 17 Nov 2021 11:54:52 -0700, Hans Hagen via ntg-context  
 wrote:


 Blocks are a better mechanism, but I still prefer modes here because I  
find the \beginblock ... \endblock syntax to be a bit awkward in a  
context document.


it also depends on usage ... you can have blocks and delay them or reuse  
them or call them up later etc .. so you can code answers with questions  
and then call them up in an appendix


Many thanks. Will do some comparison-and-contrast tests for research  
writing with both methods. The pedagogical use of blocks will certainly  
come in handy at some point.


Best wishes
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Idris Samawi Hamid ادريس سماوي حامد via ntg-context
On Wed, 17 Nov 2021 10:56:46 -0700, Aditya Mahajan via ntg-context  
 wrote:



But you don't have to directly use the modes. The following will work:

\definestartstop[abridged]

% By default, don't show the unabridged text
\definebuffer[unabridged][local=yes, nested=yes]

\startmode[unabridged]
% In the unabridged mode, show the abridged text
\definestartstop[unabridged]
\stopmode

\starttext
\startabridged
\input knuth

\startunabridged
\startblockquote
\input ward
\stopblockquote
\stopunabridged

\input zapf
\stopabridged


Excellent, many thanks! Starting to get the feel of the matter now. Will  
put together some tests..


Best wishes
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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
___


Re: [NTG-context] Space before/after combinations + centring

2021-11-17 Thread Wolfgang Schuster via ntg-context

Marco Patzer via ntg-context schrieb am 17.11.2021 um 16:54:

Hi!

I'm in the process of converting some projects to LMTX. Combinations
lacking “”before” and “after” keys (that place content before/after
the *entire* combination, rather than the individual cell pairs), I
came up with the following ugliness – which worked for longer than
it deserved:

[...]

I added vertical spacing and mid-aligned the content without having
to change the sources, that was the idea. However, this fails in
LMTX:

   Undefined control sequence \pack_combinations_start

Does LMTX offer finer control over the combinations or do I have to
rewrite the sources files (to either use floats or surround the
combinations with the required commands)?


1. Your changes don't work anymore because LMTX handles optional 
arguments in a different way than MkIV. As a result of this change a few 
commands have disappeared.


2. There are no changes to adjust the vertical before and after a 
combination environment. Local patches can also be tricky because 
ConTeXt tries to freeze the definitions of many user level commands 
which means they can't be redefined when you use a strict overload mode 
(look at the lowlevel security manual for this feature).


The most reliable way to center you combination blocks is to put them 
either in a float or put a framedtext environment around it.


Wolfgang

___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Hans Hagen via ntg-context

On 11/17/2021 6:56 PM, Aditya Mahajan via ntg-context wrote:

On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد wrote:


Hi Aditya,

Many thanks; see below:

On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context
 wrote:


On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد via ntg-context
wrote:


Dear gang,

For creating/authoring content in ConTeXt: Can modes or the like be used
for content control? For example, someone wants to write at least two
versions of a book managed from a single file. So, e.g., we may have

a) abridged content
b) unabridged content - includes a)
c) abridged content + translation
d) unabridged content + translation
[:]

One can author and organize this in XML - pre-ConteXt - but perhaps one
prefers to write in ConTeXt (take advantage of shortcuts etc.). So maybe

\defineparagraphs[unabridged]
\defineparagraphs[abridged]
\defineparagraphs[translation]

Then one authors the complete work in a single project, but you can
produce a variety of versions, depending on the mode chosen:

\definemode[unabridged]
etc.

Can one do this in context?


Yes!

This is what I do (for solutions in homework assignments):

\definebuffer[solution][local=yes,nested=yes]

\startmode[solution]
\defineenumeration[solution][fancy setup...]
\stopmode

Then, in the main tex file:


\startsolution
...
\stopsolution


By default, gives the version without solution. Compile with --mode=solution
to get the version with solution. The same thing should work in your case by
defining two modes: unabridged and translation. And then use
--mode=unabridged,translate etc to get multiple modes.


Here's a working sample:

===
% \definebuffer[unabridged]
% \definebuffer[abridged]

\setupwhitespace[big]

\starttext
\startmode[unabridged]
\input knuth

\startblockquote
\input ward
\stopblockquote

% \startmode[abridged]
% \input knuth
% \stopmode
\stopmode

\startmode[abridged]
\input knuth
\stopmode

% \startmode[abridged]
% \input zapf
% \stopmode
\stoptext
===

Unfortunately - as pointed out on the wiki - modes cannot be nested.


But you don't have to directly use the modes. The following will work:

\definestartstop[abridged]

% By default, don't show the unabridged text
\definebuffer[unabridged][local=yes, nested=yes]

\startmode[unabridged]
% In the unabridged mode, show the abridged text
\definestartstop[unabridged]
\stopmode

\starttext
\startabridged
\input knuth

\startunabridged
\startblockquote
\input ward
\stopblockquote
\stopunabridged

\input zapf
\stopabridged

Blocks are a better mechanism, but I still prefer modes here because I find the 
\beginblock ... \endblock syntax to be a bit awkward in a context document.
it also depends on usage ... you can have blocks and delay them or reuse 
them or call them up later etc .. so you can code answers with questions 
and then call them up in an appendix



-
  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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Aditya Mahajan via ntg-context
On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد wrote:

> Hi Aditya,
> 
> Many thanks; see below:
> 
> On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context
>  wrote:
> 
> > On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد via ntg-context
> > wrote:
> > 
> > > Dear gang,
> > > 
> > > For creating/authoring content in ConTeXt: Can modes or the like be used
> > > for content control? For example, someone wants to write at least two
> > > versions of a book managed from a single file. So, e.g., we may have
> > > 
> > > a) abridged content
> > > b) unabridged content - includes a)
> > > c) abridged content + translation
> > > d) unabridged content + translation
> > > [:]
> > > 
> > > One can author and organize this in XML - pre-ConteXt - but perhaps one
> > > prefers to write in ConTeXt (take advantage of shortcuts etc.). So maybe
> > > 
> > > \defineparagraphs[unabridged]
> > > \defineparagraphs[abridged]
> > > \defineparagraphs[translation]
> > > 
> > > Then one authors the complete work in a single project, but you can
> > > produce a variety of versions, depending on the mode chosen:
> > > 
> > > \definemode[unabridged]
> > > etc.
> > > 
> > > Can one do this in context?
> > 
> > Yes!
> > 
> > This is what I do (for solutions in homework assignments):
> > 
> > \definebuffer[solution][local=yes,nested=yes]
> > 
> > \startmode[solution]
> > \defineenumeration[solution][fancy setup...]
> > \stopmode
> > 
> > Then, in the main tex file:
> > 
> > 
> > \startsolution
> > ...
> > \stopsolution
> > 
> > 
> > By default, gives the version without solution. Compile with --mode=solution
> > to get the version with solution. The same thing should work in your case by
> > defining two modes: unabridged and translation. And then use
> > --mode=unabridged,translate etc to get multiple modes.
> 
> Here's a working sample:
> 
> ===
> % \definebuffer[unabridged]
> % \definebuffer[abridged]
> 
> \setupwhitespace[big]
> 
> \starttext
> \startmode[unabridged]
> \input knuth
> 
> \startblockquote
> \input ward
> \stopblockquote
> 
> % \startmode[abridged]
> % \input knuth
> % \stopmode
> \stopmode
> 
> \startmode[abridged]
> \input knuth
> \stopmode
> 
> % \startmode[abridged]
> % \input zapf
> % \stopmode
> \stoptext
> ===
> 
> Unfortunately - as pointed out on the wiki - modes cannot be nested.

But you don't have to directly use the modes. The following will work:

\definestartstop[abridged]

% By default, don't show the unabridged text
\definebuffer[unabridged][local=yes, nested=yes]

\startmode[unabridged]
% In the unabridged mode, show the abridged text
\definestartstop[unabridged]
\stopmode

\starttext
\startabridged
\input knuth

\startunabridged
\startblockquote
\input ward
\stopblockquote
\stopunabridged

\input zapf
\stopabridged

Blocks are a better mechanism, but I still prefer modes here because I find the 
\beginblock ... \endblock syntax to be a bit awkward in a context document.

Aditya___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Henning Hraban Ramm via ntg-context

> Am 17.11.2021 um 16:08 schrieb ⁨Idris Samawi Hamid ادريس سماوي حامد⁩ 
> <⁨idris.ha...@colostate.edu⁩>:
> 
>> That looks to me like flawed logic – why should content for the unabridged 
>> version appear within the abridged version?
> 
> TeX comments will illustrate:
> 
> ==
> This text goes into the abridged version.
> 
> % This text will appear in the unabridged version.
> 
> And this text goes into the abridged version.
> 
> % And this text goes into the unabridged version.
> 
> And this additional text goes into the abridged version.
> 
> % And this additional text goes into the unabridged version.
> ==
> 
> An abridged run will ignore the commented text, and an unabridged run will 
> include it.

Ok, it it’s about such small snippets, consider 
\doifmode{mode1,mode2}{Conditional text}.

I don’t think you would get shorter markup with nesting.

More possibilities see https://wiki.contextgarden.net/Modes

> Consider variant texts:
> 
> ===
> Here is some text that
>   contains % mode=variantone
>   includes % mode=varianttwo
>   is comprised of % mode=variantthree
> some variants.
> 
> Here is some more text that
>   features % mode=variantone
>   exhibits % mode=varianttwo
>   illustrates % mode=variantthree
> some variants.
> ===
> 
> This example is to be processed to produce exactly three distinct results. 
> So, e.g., "contains" and "features" belong to variantone. Etc. So like XML.

How about:

Here is some text that
\startmodeset
[variantone] {contains}
[varianttwo] {includes}
[variantthree]   {is comprised of}
[default]{doesn’t contain}
\stopmodeset
some variants.


>> It might be a bit annoying, but you could end the previous mode before 
>> starting the next.
> Assuming that I'm not misunderstanding you: For a book-length project, that 
> would be beyond annoying.

Well, it looks like you’ll need a lot of markup anyway.

HTH
Hraban

___
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
___


[NTG-context] Space before/after combinations + centring

2021-11-17 Thread Marco Patzer via ntg-context
Hi!

I'm in the process of converting some projects to LMTX. Combinations
lacking “”before” and “after” keys (that place content before/after
the *entire* combination, rather than the individual cell pairs), I
came up with the following ugliness – which worked for longer than
it deserved:

\unprotect

\unexpanded\def\startcombination
  {\blank[halfline]%%
   \startalignment[middle]%%
   \dontleavehmode
   \bgroup
   \pack_combinations_push
   \dodoubleempty\pack_combinations_start}

\unexpanded\def\stopcombination
  {\bgroup\normalexpanded{\egroup{}\ntimes{{}{}}\c_pack_combinations_y}% brr
   \dostoptagged
   \egroup
   \pack_combinations_pop
   \egroup
   \stopalignment
   \goodbreak\blank[halfline]}

\protect

\starttext
  \startcombination [2*2]
\startcontent foo \stopcontent \startcaption 1 \stopcaption
\startcontent bar \stopcontent \startcaption 2 \stopcaption
  \stopcombination
\stoptext

I added vertical spacing and mid-aligned the content without having
to change the sources, that was the idea. However, this fails in
LMTX:

  Undefined control sequence \pack_combinations_start

Does LMTX offer finer control over the combinations or do I have to
rewrite the sources files (to either use floats or surround the
combinations with the required commands)?

Marco

LMTX: current version: 2021.11.16 22:36
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Taco Hoekwater via ntg-context
Hi Idris,

I think Hans was trying to point you to the blocks mechanism. Blocks *do* nest:

\defineblock[sectionblock]
\defineblock[myblock]

\startmode[variantone]
\keepblocks[sectionblock]
\keepblocks[myblock]
\stopmode

\startmode[varianttwo]
\keepblocks[sectionblock]
\stopmode

\starttext
\beginsectionblock
\section{A to B}
\beginmyblock
A is for Amy, who fell down the stairs.
\endmyblock
\beginmyblock
B is for Basil, assaulted by bears.
\endmyblock
\endsectionblock

\stoptext



— 
Taco Hoekwater  E: t...@bittext.nl
genderfluid (all pronouns)



___
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
___


[NTG-context] figure not added in current latest

2021-11-17 Thread Pablo Rodriguez via ntg-context
Hi Hans,

I have the following sample:

  \setuppapersize[S6]
  \startbuffer[flag]
  \setuppapersize[S6]
  \starttext
  \startmakeup[page][align=center]
  \dontleavehmode
  \externalfigure[uk-flag.pdf][width=.8\textwidth]
  \stopmakeup
  \stoptext
  \stopbuffer
  \starttext
  \startmakeup[page][align=center]
  \dontleavehmode
  \typesetbuffer[flag]
  \stopmakeup
  \stoptext

The image can be found at https://pdf.ousia.tk/uk-flag.pdf.

Compiling it with latest from 2021.11.11 19:24, the final PDF contains
the flag.

I’m not sure whether there was another version (before the current
latest) that I haven’t copied.

If I compile it with latest from 2021.11.16 22:36, the final PDF has no
flag. This happens even if I remove the patch for lpdf-pde.lmt you sent me.

The case above also happens when using \externalfigure with some images.

Just in case it might help, I downloaded the SVG file and ConTeXt
invoked Inkscape to convert it to PDF:

I’m afraid this might be a bug.

Many thanks for your help,

Pablo
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Idris Samawi Hamid ادريس سماوي حامد via ntg-context

Hi Hraban,

Many thanks; see below:

On Wed, 17 Nov 2021 04:32:56 -0700, Henning Hraban Ramm via ntg-context  
 wrote:


Am 17.11.2021 um 04:06 schrieb ⁨Idris Samawi Hamid ادريس سماوي حامد via  
ntg-context⁩ <⁨ntg-context@ntg.nl⁩>:





You know about \startnotmode and that you can use lists of modes?
\startmode[short,long]
Something that appears everywhere.
\stopmode
\startmode[long] % or \startnotmode[short]
Something that’s only in the long version.
\stopmode


Many thanks; will study this.


Unfortunately - as pointed out on the wiki - modes cannot be nested.

:

Why would you need that?

:

Can you give an example for a use case?

:
That looks to me like flawed logic – why should content for the  
unabridged version appear within the abridged version?


TeX comments will illustrate:

==
This text goes into the abridged version.

% This text will appear in the unabridged version.

And this text goes into the abridged version.

% And this text goes into the unabridged version.

And this additional text goes into the abridged version.

% And this additional text goes into the unabridged version.
==

An abridged run will ignore the commented text, and an unabridged run will  
include it.


Consider variant texts:

===
Here is some text that
   contains % mode=variantone
   includes % mode=varianttwo
   is comprised of % mode=variantthree
some variants.

Here is some more text that
   features % mode=variantone
   exhibits % mode=varianttwo
   illustrates % mode=variantthree
some variants.
===

This example is to be processed to produce exactly three distinct results.  
So, e.g., "contains" and "features" belong to variantone. Etc. So like XML.


It might be a bit annoying, but you could end the previous mode before  
starting the next.


Assuming that I'm not misunderstanding you: For a book-length project,  
that would be beyond annoying.



And, as mentioned above, you can use \startmode with lists.


Will try it. Thank you again!

Best wishes
Idris
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512
___
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
___


Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-17 Thread Hans Hagen via ntg-context

On 11/17/2021 12:36 PM, Henning Hraban Ramm via ntg-context wrote:




Am 16.11.2021 um 22:18 schrieb Hans Hagen via ntg-context :



it's pretty fast and needs no lua magic, only a twisted mind


May I quote you as “ConTeXt needs a twisted mind”? ;D
How about "Context tries to untwist your tex mind". After all this is 
not really user code is it?


-
  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
___


Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-17 Thread Henning Hraban Ramm via ntg-context


> Am 16.11.2021 um 22:18 schrieb Hans Hagen via ntg-context 
> :

> it's pretty fast and needs no lua magic, only a twisted mind

May I quote you as “ConTeXt needs a twisted mind”? ;D

Hraban
___
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
___


Re: [NTG-context] Can modes be used for content control?

2021-11-17 Thread Henning Hraban Ramm via ntg-context

> Am 17.11.2021 um 04:06 schrieb ⁨Idris Samawi Hamid ادريس سماوي حامد via 
> ntg-context⁩ <⁨ntg-context@ntg.nl⁩>:
> 
> Unfortunately - as pointed out on the wiki - modes cannot be nested.

Why would you need that?

You know about \startnotmode and that you can use lists of modes?

\startmode[short,long]
Something that appears everywhere.
\stopmode

\startmode[long] % or \startnotmode[short]
Something that’s only in the long version.
\stopmode

There are also language modes (\startmode[*en]) that might be handy with 
translations.

> Furthermore, each mode is unique and there is apparently no 
> inheritance/continuance.

Can you give an example for a use case?

> What is needed is something like this
> 
> \startmode[abridged]
> \input knuth
> 
> \startmode[unabridged]
> \startblockquote
> \input ward
> \stopblockquote
> \stopmode
> 
> \input zapf
> \stopmode

That looks to me like flawed logic – why should content for the unabridged 
version appear within the abridged version?

It might be a bit annoying, but you could end the previous mode before starting 
the next.
And, as mentioned above, you can use \startmode with lists.

HTH

Hraban
___
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
___


Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-17 Thread Hans Hagen via ntg-context

On 11/16/2021 11:15 PM, Joey McCollum via ntg-context wrote:
I'm not sure if my mind is twisted enough! I can follow how Jairo's 
answer works, and that does what I need it to, but it's not as clear to 
me what the last two TeX-only approaches are doing at a low level.


Perhaps more importantly, I should clarify that for my purposes, the 
\MyOuter macro is the \currentbtxrighttext macro, which is defined in a 
separate module that I'd prefer not to modify. I want to be able to 
detect and parse the parameters of a \loc macro that a user can specify 
in a citation as follows:


```
\cite[lefttext={See}, righttext={\loc[vol=8,p=223] for further 
details}][clementinehomilies]

```

Because the locator parameters may need to be parenthesized or formatted 
differently depending on the category of the bibliography entry, they 
should be typeset separately from the plain part of the righttext. This 
is why I'd like to be able to parse the parameters and then expand the 
\loc macro itself as empty when the righttext is typeset.
in that case: just redefine \loc on the fly depending on where it's used 
and/or use keys


\cite[lefttext={See},volume=8,page=223]

or so .. imo parsing content is not really a good solution and probably 
also not reliable


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
___