[NTG-context] Re: Define a new command that inherits from multiple other command options

2024-04-27 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 25.04.2024 um 10:24:

hi!

I'm new to ConTeXt. I want to define a command with sidenote function. This 
[setupsidenote] command inherits the options of [setupmargindata], 
[setupcounter] and [setupframed]. just like [setupenumeration] inherits the 
option of [setupcounter].

I've defined the following sidenote command by searching, and I know how to 
define a new option for it. But what I don't know is how to get it to inherit 
the options of other commands and perform these features correctly.

Any clue is warmly welcome.


Hi ???,

not all commands provide a way to inherit their options but the "framed" 
and "counter" mechanism supports it.


To use the framed mechanism with your own command replace 
\installcommandhandler with \installframedcommandhandler. This creates a 
command named \inherited...framed which can be customized with the 
setups of the new namespace.


 begin example
\unprotect

\installnamespace  {sidenote}
\installframedcommandhandler \sidenote {sidenote} \sidenote

\protect

\starttext

\inheritedsidenoteframed{Text in a frame!}

\setupsidenote[framecolor=red,width=8cm,height=2cm]

\inheritedsidenoteframed{Text in a frame!}

\stoptext
 end example

To use the counter mechanism with your commands you have to first use 
\installcounterassociation to create the two new commands 
\register...counter (this ensures the default counter values are used 
when you don't set anything) and \synchronize...counters (which updates 
the counter values when you use the setup of your own command).


Unlike the framed mechanism this no longer works with the root instance 
of your own commands because we create a new counter only when you 
create a instance (with \define...) of the new command.


 begin example
\unprotect

\installnamespace{sidenote}
\installcommandhandler \sidenote {sidenote} \sidenote

\installcounterassociation{sidenote}

\appendtoks
  \registersidenotecounter\currentsidenote
  \definecounter[\currentsidenote]%
\to \everydefinesidenote

\appendtoks
  \synchronizesidenotecounters
\to \everysetupsidenote

\protect

\starttext

% create a new sidenote instance with a associated counter
\definesidenote[example]

\start % use grouping to keep the sidenote instance local
\def\currentsidenote{example}% set the sidenote instance to example
\incrementcounter[example]% increment the example/sidenote counter
\convertedcounter[example]% print the example/sidenote counter
\stop

% change the number format of the example/sidenote counter
\setupsidenote[example][numberconversion=romannumerals]

\start
\def\currentsidenote{example}
\incrementcounter[example]
\convertedcounter[example]
\stop

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier schrieb am 26.04.2024 um 19:52:


I see. But there's no command that could be used to simulate an empty line?
If not, me should I perhaps try to replicate the wrapper structure from 
the XML source in context? (I'll also look into the format module of 
course.) What do you think?


Below is a different solution to your problem with works without 
\startlines because you already mark up each individual line in the poem 
which make it possible to add a linebreak in the output.


With \blank options (samepage) you can avoid pagebreaks between stanzas.

\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|poem|stanza|line}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:poem
\blank[line]
\xmlflush{#1}
\blank[back,line]
\stopxmlsetups

\startxmlsetups xml:stanza
   \xmlflush{#1}\blank[preference,line]
\stopxmlsetups

\startxmlsetups xml:line
\xmlflush{#1}\blank[samepage,none]
\stopxmlsetups

\startbuffer[test]




The
lines
are
there!


The
lines
are
there!


The
lines
are
there!



\stopbuffer

\starttext

\samplefile{lorem}

\xmlprocessbuffer{test}{test}{}

\samplefile{lorem}

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 19:04:

On 4/26/24 18:18, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:

What is wrong in my definition above?


There is nothing wrong, this is just a side effect of the scanner used
with the \do...groupempty commands. To have more control about this
behavior use the \tolerant modifier for \def to change it.


Many thanks for your reply, Wolfgang.

I tried this approach (I hope it isn’t wrong):

   \starttext
   \expanded\tolerant\def\MyCommand#_#,#_#,#_#,#_{%
 \doiftextelse{#4}%
   {#4}
   {\doiftextelse{#3}
 {#3}
 {#2}}}


The \expanded modifier is wrong (I guess you meant \unexpanded) but 
which check for the number of arguments you use doesn't matter in a 
document.


The LMTX version of the \iffourthargument etc. checks is the 
\ifarguments commands where you use \or to set a case for the number of 
argument passed.


\protected\tolerant\def\MyCommand#_#,#_#,#_#,#_%
  {\ifarguments
 % no arguments are passed
   \or
 #1% one argument is passed
   \or
 #2% two arguments are passed
   \or
 #3% three arguments are passed
   \or
 #4% four arguments are passed
   \fi}



   \MyCommand{}{second}{third}{fourth},\\
   \MyCommand{}{second}{third}{fourth} e,\\

   \MyCommand{}{second}{third},\\
   \MyCommand{}{second}{third} e,\\

   \MyCommand{}{second},\\
   \MyCommand{}{second} e,\\
   \stoptext

BTW, this is the first time I see #_ instead of #1.

There is no way to search for "#_" in the wiki.

Grepping the source, "#_" seems to be used for optional arguments
(mainly in syst-aux.mkxl).

But what are these "#_" (which don’t seem to come from TeX)?


Hans added many additions to command parameters in Luametatex and #_ 
means the argument to a commands has to be enclosed in braces while #1

allows you to pass text without it.

In the following example \CommandA take in the first case "a" as 
argument while CommandB ignores it and would only accept "{a}" with 
braces around it.


 begin example
 \def\CommandA#1{(#1)}
\tolerant\def\CommandB#_{(#1)}

\starttext

\CommandA abc\par
\CommandB abc\blank

\CommandA {ab}c\par
\CommandB {ab}c\blank

\stoptext
 end example

You can find a list with all new command parameters in lowlevel-macros.pdf.

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier schrieb am 26.04.2024 um 19:18:
Wolfgang Schuster  hat am 
26.04.2024 18:24 CEST geschrieben:

Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10:
Pablo Rodriguez via ntg-context <mailto:ntg-context@ntg.nl>> hat am 26.04.2024 17:25 CEST geschrieben:
On 4/26/24 15:33, denis.ma...@unibe.ch 
<mailto:denis.ma...@unibe.ch> wrote:
Hi, 
I’m trying to typeset a poem from XML, but I can’t figure out how to
make the inbetween key working here. 
As the source is XML, I cannot just add an empty line to start a new
group of lines inside \startlines…\stoplines. I guess, there must 
be a
command to do that, but \par seems to have no effect here. 
How can this be done? 

Hi Denis,
I must confess I don’t get which is your actual question.
\blank works here and you know that (since you included it in your 
code).

MkIV with \par works in your sample and LMTX with \par doesn’t.
I wonder whether this might be a bug in LMTX.
Just in case it might help, 
Thanks for your answer and sorry for not being clearer. I was just 
wondering why the \par seems to have no effect. (I first guessed 
that it might be related to XML, to but then realized it happens 
with context markup as well. Usually, you won't run into this 
because an empty line works, but with XML that's not am option.) As 
you've said, it looks like a bug then. 


The lines environment treats each line of the input as paragraph by 
adding \par at the end of it and adding another \par makes no 
difference here.


BTW: ConTeXt has a module for poems which can be loaded with 
\usemodule[format].


Wolfgang


Ok. I'll have a look at this module. Just two questions:
1. so did this behavior change?
2. What is inbetween referring to then? If each line is a paragraph, 
what's this group of paragraphs then? Can you manually switch to the 
next one?


The inbetween setting works because ConTeXt checks at the start of each 
line whether it's empty (in this case the value is used) or not.


When you add a \par you just end the current line/paragraph and it 
doesn't matter how many \par's you use because TeX just ignores them.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \par and \startlines

2024-04-26 Thread Wolfgang Schuster

Denis Maier via ntg-context schrieb am 26.04.2024 um 18:10:
Pablo Rodriguez via ntg-context > hat am 26.04.2024 17:25 CEST geschrieben:
On 4/26/24 15:33, denis.ma...@unibe.ch  
wrote:
Hi, 
I’m trying to typeset a poem from XML, but I can’t figure out how to
make the inbetween key working here. 
As the source is XML, I cannot just add an empty line to start a new

group of lines inside \startlines…\stoplines. I guess, there must be a
command to do that, but \par seems to have no effect here. 
How can this be done? 

Hi Denis,
I must confess I don’t get which is your actual question.
\blank works here and you know that (since you included it in your 
code).

MkIV with \par works in your sample and LMTX with \par doesn’t.
I wonder whether this might be a bug in LMTX.
Just in case it might help, 
Thanks for your answer and sorry for not being clearer. I was just 
wondering why the \par seems to have no effect. (I first guessed that 
it might be related to XML, to but then realized it happens with 
context markup as well. Usually, you won't run into this because an 
empty line works, but with XML that's not am option.) As you've said, 
it looks like a bug then.




The lines environment treats each line of the input as paragraph by 
adding \par at the end of it and adding another \par makes no difference 
here.


BTW: ConTeXt has a module for poems which can be loaded with 
\usemodule[format].


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: wrong spacing after command with optional arguments

2024-04-26 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 26.04.2024 um 17:29:

Dear list,

I have the following sample:

   \starttext
   \def\MyCommand{\doquadruplegroupempty\doMyCommand}

   \def\doMyCommand#1#2#3#4{%
 \iffourthargument
   #4%
 \orelse\ifthirdargument
   #3%
 \else
   #2%
 \fi}

   \MyCommand{}{second}{third}{fourth},\\
   \MyCommand{}{second}{third}{fourth} e,\\

   \MyCommand{}{second}{third},\\
   \MyCommand{}{second}{third} e,\\

   \MyCommand{}{second},\\
   \MyCommand{}{second} e,\\
   \stoptext

I don‘t know why only the command gets the space after right only when
the four arguments are provided.

What is wrong in my definition above?


There is nothing wrong, this is just a side effect of the scanner used 
with the \do...groupempty commands. To have more control about this 
behavior use the \tolerant modifier for \def to change it.


 begin example
\tolerant\def\CommandA#_#*#_#*#_#*#_{(#1)(#2)(#3)(#4)}
\tolerant\def\CommandB#_#,#_#,#_#,#_{(#1)(#2)(#3)(#4)}

\starttext

A: \CommandA{a}  xxx\par
B: \CommandB{a}  xxx\blank

A: \CommandA{a}{b}   xxx\par
B: \CommandB{a}{b}   xxx\blank

A: \CommandA{a}{b}{c}xxx\par
B: \CommandB{a}{b}{c}xxx\blank

A: \CommandA{a}{b}{c}{d} xxx\par
B: \CommandB{a}{b}{c}{d} xxx\blank

\stoptext
 end example

Another way to avoid this is to create a command with a key-value list.

 begin example
\tolerant\def\Command[#1]%
  {\begingroup
   \getdummyparameters[#1]%
   \doifsomething{\dummyparameter{a}}{(\dummyparameter{a})}%
   \doifsomething{\dummyparameter{b}}{(\dummyparameter{b})}%
   \doifsomething{\dummyparameter{c}}{(\dummyparameter{c})}%
   \doifsomething{\dummyparameter{d}}{(\dummyparameter{d})}%
   \endgroup}

\starttext

\Command[a=1,b=2,c=3,d=4] xxx\par
\Command[a=1,c=3] xxx\par

\stoptext
 end example
Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-24 Thread Wolfgang Schuster

garu...@azules.eu schrieb am 20.04.2024 um 23:00:

I can not figure out why this progress bar only works when \showframe is 
activated.
When you comment on \showframe, it's as if \realpageno is at zero.
(current version: 2024.04.01 08:59)

\showframe

\startuseMPgraphic{MonGraphisme_MP}
   numeric n ; n := \number\realpageno ;
   numeric m ; m := \number\lastpageno ;
   numeric h ; h := \overlayheight ;
   numeric w ; w := \overlaywidth ;
   numeric e ; e := 3mm;
   numeric r ; r := (((n-1)/(m-1))*w);
   fill fullsquare xscaled w yscaled e shifted (w/2, h/2) withcolor darkblue ;
   fill fullsquare xscaled r yscaled e shifted (r/2, h/2) withcolor darkred;
\stopuseMPgraphic

\defineoverlay [MonGraphisme_OL] [\useMPgraphic{MonGraphisme_MP}]

\setupbackgrounds [footer] [rightmargin] [background={MonGraphisme_OL}]

\starttext
\dorecurse{10}{\input tufte\page}
\stoptext

Any clue is warmly welcome


You need

    \setupbackgrounds[state=repeat]

which is set when you use \showframe.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: documentation: parameters of \setuplist

2024-04-23 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 23.04.2024 um 21:43:

Am 22.04.24 um 18:09 schrieb Henning Hraban Ramm:
I tried to complete https://wiki.contextgarden.net/Command/setuplist, 
but I don’t understand all parameters.


Can anyone explain these please:

* state (start stop): what does this en-/disable? collecting entries?
* label (yes no none Name): language dependent labels? as a prefix or 
what?


You can use the key to set language dependent texts for the section 
counters in the list entry, with "yes" the values from the document are 
used but you can also set whatever label you want.


\setuplabeltext
  [en]
  [chapter=Chapter ,
   appendix=Appendix ,
   hraban=Hraban ]

%\setuplist[chapter][label=hraban,width=3cm]
\setuplist[chapter][label=yes,width=3cm]

\starttext

\startfrontmatter
\completecontent
\stopfrontmatter

\startbodymatter
\chapter{First chapter}
\chapter{Second chapter}
\stopbodymatter

\startappendices
\chapter{First appendix}
\stopappendices

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: kpfonts

2024-04-20 Thread Wolfgang Schuster

Mikael Sundqvist schrieb am 20.04.2024 um 14:04:

Hi,

On Sat, Apr 20, 2024 at 2:03 PM Xavier B.  wrote:

Hi,

Just a courious: is there kpfonts available for context?
I love kpfonts.

Thanks in advance,
Xavier

Yes, just download the fonts and do

\setupbodyfont[kpfonts]


The fonts are included in the LMTX installation.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: kpfonts

2024-04-20 Thread Wolfgang Schuster

Xavier B. schrieb am 20.04.2024 um 13:51:

Hi,

Just a courious: is there kpfonts available for context?
I love kpfonts.


\setupbodyfont[kpfonts]

\starttext
\samplefile{lorem}
\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: minwidth not working ?

2024-04-20 Thread Wolfgang Schuster

Denis Maier schrieb am 19.04.2024 um 22:55:

Wolfgang Schuster  hat am 
19.04.2024 20:32 CEST geschrieben:

denis.ma...@unibe.ch schrieb am 10.04.2024 um 12:47:


Hi,

Shouldn’t minwidth set a default minimal width for external figures? 
But this here does not work


[...]

Am I missing something here?


There are no minwidth/minheight values for \externalfigure.

Wolfgang

So the wiki is wrong here? 
https://wiki.contextgarden.net/Command/setupexternalfigure


Yes the comment at the end of page is wrong and the text about the strut 
setting can also be removed, only the orientation value is missing in 
the command table.


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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: minwidth not working ?

2024-04-19 Thread Wolfgang Schuster

denis.ma...@unibe.ch schrieb am 10.04.2024 um 12:47:


Hi,

Shouldn’t minwidth set a default minimal width for external figures? 
But this here does not work


==

\setupexternalfigures

  [

  maxwidth=\textwidth,

  minwidth=\textwidth,

  location={local,global,default},

  ]

\starttext

\externalfigure[cow.pdf]

\externalfigure[cow.pdf][width=\textwidth]

\stoptext

==

Am I missing something here?



There are no minwidth/minheight values for \externalfigure.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Weird (?) float placement for specific widths of image

2024-04-19 Thread Wolfgang Schuster

Denis Maier via ntg-context schrieb am 19.04.2024 um 17:48:


Hi again,

just a quick follow up on this one. Can anyone reproduce this?

Would be good to know how this can be fixed. I have this in a real 
document, and as I’m typesetting a XML source I cannot just adjust 
slightly adjust the dimensions to get rid of that.




\setupfloats[compress=no]

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: [ using horizontal table lines ]

2024-04-15 Thread Wolfgang Schuster

vm via ntg-context schrieb am 15.04.2024 um 13:15:

I'm probably using the \starttable incorrectly:

with this code I only get only *one* horizontal line in the header

[...]

with this code I get two horizontal lines, but the second is too short.

[...]

with this code I get two horizontal lines, with correct length, but 
above the wrong columns


[...]


diff:
\NC\DC\DC\DC\DL[4]\DL[4]\AR
\NC\DC\DC\DC\DL[4]\DL[3]\AR
\NC\DC\DC\DL[4]\DL[4]\AR

There is (probably) a correct way to solve this.


My suggestion is to switch to either natural table or extreme tables but 
it seems to me there is a problem with the division lines which always 
leave an empty column afterwards.


The following example should add horizontal lines above the first and 
third column but this setting results in an error. When I omit the last 
\DC the error disappears but as can be seen in the output the second 
line appears above the fourth column.


\starttext

\starttable[||]
%\DL  \DC  \DL  \DC  \DC \DR
\DL[red] \DC  \DL[red] \DC  \DR
\VL   01 \VL   02 \VL   03 \VL   04 \VL   05 \VL\SR
\stoptable

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Wiki - question about Command/ pages which start with a space character

2024-04-14 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 14.04.2024 um 14:53:

Am 14.04.24 um 14:46 schrieb Wolfgang Schuster:

garu...@azules.eu schrieb am 14.04.2024 um 12:41:

Hi all,

Is it on purpose that 128 pages 
"https://wiki.contextgarden.net/Command/ " start with a 
space character ?

I didn't find an explanation in https://wiki.contextgarden.net/Command

For example, these two pages exist :
- https://wiki.contextgarden.net/Command/startbuffer
- https://wiki.contextgarden.net/Command/_startbuffer

If it is on purpose:
- What is the purpose, and which page should contain which 
documentation?


The command pages which start with an underscore are probably leftovers
when Taco changed a page from manual command descriptions to auto
generated tables.

In the process to change the page he makes a copy of the current page
with an underscore at the beginning which is deleted after the change
but it's possible he forgot to delete a few of them.

When you notice no difference between both versions of a command page
you can delete all of the forgotten pages.


No!

These are the general pages in opposite to instance pages, e.g. 
"startsection" and "startchapter" are instances of "_startsection"?


https://wiki.contextgarden.net/Command/_placefloat is the general page 
for the instances placefigure, placetable etc.


My bad, thank you for the correction!

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Wiki - question about Command/ pages which start with a space character

2024-04-14 Thread Wolfgang Schuster

garu...@azules.eu schrieb am 14.04.2024 um 12:41:

Hi all,

Is it on purpose that 128 pages "https://wiki.contextgarden.net/Command/ 
" start with a space character ?
I didn't find an explanation in https://wiki.contextgarden.net/Command

For example, these two pages exist :
- https://wiki.contextgarden.net/Command/startbuffer
- https://wiki.contextgarden.net/Command/_startbuffer

If it is on purpose:
- What is the purpose, and which page should contain which documentation?


The command pages which start with an underscore are probably leftovers
when Taco changed a page from manual command descriptions to auto
generated tables.

In the process to change the page he makes a copy of the current page
with an underscore at the beginning which is deleted after the change
but it's possible he forgot to delete a few of them.

When you notice no difference between both versions of a command page
you can delete all of the forgotten pages.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: how to apply metapost effects to section title?

2024-04-09 Thread Wolfgang Schuster

seyal.zav...@gmail.com schrieb am 09.04.2024 um 14:53:

i want to produce a gradient header
i tried this code but it does not produce any result:

\startext
\def\Mystyle#1{\startMPcode
   picture tt ; tt := lmt_outline [
   kind = "path",
   text = "#1",
   ] ;
   fill
   for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
}

\definehead[Myhead][section]
\setuphead[Myhead][
   style=\Mystyle,
]
\startMyhead[title=sample] a sample text \stopMyhead
\stoptext


You can't use commands with parameters as argument for the style key.

To format single parts (number or title) of a section title you have to 
apply a command to the "deep...command" key but even then you have to 
make manual changes to the vertical alignment of the text.


 begin example
\starttexdefinition spaces Mystyle #1
  \setbox\scratchboxone\hbox{#1}%
  \setbox\scratchboxtwo\hbox\bgroup
\startMPcode
  picture tt ; tt := lmt_outline [
kind = "path",
text = "#1",
  ];
fill
  for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
  \egroup
  \boxyoffset\scratchboxtwo-\dp\scratchboxone
  \box\scratchboxtwo
\stoptexdefinition

\starttext

\setuphead
  [section]
  [
 deeptextcommand=\Mystyle,
%  deepnumbercommand=\Mystyle,
  ]

\startsection[title=Lorem ipsum]
\samplefile{lorem}
\stopsection

\stoptext
 end example


and the code below works but does not colorize numbers of this heads:
\starttext
 
\def\Mystyle#1{\startMPcode

   picture tt ; tt := lmt_outline [
   kind = "path",
   text = "#1",
   ] ;
   fill
   for i within tt : pathpart i && endfor cycle
  withshademethod "linear"
  withshadedirection up
  withshadecolors (red, blue) ;
\stopMPcode
}
 
\def\startMysection#1{\startsection[title=\Mystyle{#1}]}

\def\stopMysection{\stopsection}
 
\startMysection{hello}

what is best method?
\stopMysection
 
\stoptext


what is your suggestion?


To apply the format the the complete section title you have to create 
your own style and apply it with the "command" key, to get the number 
and title for the current section use the \structurenumber and 
\structuretitle macros.


 begin example
\starttexdefinition spaces protected Mystyle #1#2
  \startMPcode
picture tt ; tt := lmt_outline [
  kind = "path",
  text = "\structurenumber\space\structuretitle",
];
  fill
for i within tt : pathpart i && endfor cycle
withshademethod "linear"
withshadedirection up
withshadecolors (red, blue) ;
  \stopMPcode
\stoptexdefinition

\starttext

\setuphead
  [section]
  [command=\Mystyle]

\startsection[title=Lorem ipsum]
\samplefile{lorem}
\stopsection

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: blank line and \placefigure

2024-04-06 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 06.04.2024 um 12:56:

Am 06.04.24 um 12:48 schrieb Thomas Meyer:
how can I suppress a blank line between a text paragraph and 
\placefigure?

I get one there, but I don't want it.


Did you try
\setupfloat[figure][spacebefore=,]
?
or "none" or "{disable,nowhite,back}"


You can set the space only for *all* floats, e.g.

    \setupfloat[spacebefore=...,spaceafter=...]

and not for a single float type only.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: incosistent output of --- dash

2024-04-06 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 06.04.2024 um 12:23:

Am 06.04.24 um 11:43 schrieb madiazm.eo...@gmail.com:

Hi everyone,
I'm a bit puzzled because I usually don't get an em-dash when I type 
tree hyphens. If I use the command \emdash, no problem but when I use 
the hyphens some days it works... and somedays I see three small 
hyphens.
I tried it on overleaf and of ContextOnWeb with the same 
inconsistency. If I create a new file it usually works right; but 
when I overwrite an existing file subtituting a hyphen for three 
where the dash should be I sometimes get it right and sometimes wrong.
It is not the pdf viewer since I get good or bad results in all, the 
overleaf pdf preview tool, the context on web preview tool and the 
mozilla integrated pdf viewer.


Am I missing something on the use of this ligature? (the question is 
just out of curiosity, since I plan to create a command that adds a 
hairspace after or before the dash, since I don't like it to stick to 
some letters like "o".


Generally, “we” try to reduce active characters as much as possible, 
that’s why -- and --- usually /don’t/ produce en or em dashes. You can 
activate these ligatures as a font feature though (AFAIR 
"latexhyphens", can’t find it…).


The name of the option has changes a few times and the current setting 
is textcontrol=collapsehyphens.



Some editors and some fonts do automatical replacements.


In this case it could be the wrong symbol in the document, there are 
many dashes in unicode which look similar in the input and output files.


\starttext

\startbuffer
\starttabulate[|T]
\NC U+0002D \NC - \NC -- \NC --- \NC\NR
\NC U+02011 \NC ‑ \NC ‑‑ \NC ‑‑‑ \NC\NR
\NC U+02012 \NC ‒ \NC ‒‒ \NC ‒‒‒ \NC\NR
\stoptabulate
\stopbuffer

\getbuffer

\setupbodyfont[pagella]

\getbuffer

\stoptext

Wolfgang

\starttext

\startbuffer
\starttabulate[|T]
\NC U+0002D \NC - \NC -- \NC --- \NC\NR
\NC U+02011 \NC ‑ \NC ‑‑ \NC ‑‑‑ \NC\NR
\NC U+02012 \NC ‒ \NC ‒‒ \NC ‒‒‒ \NC\NR
\stoptabulate
\stopbuffer

\getbuffer

\setupbodyfont[pagella]

\getbuffer

\stoptext


hyphen.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: last page number for a list

2024-04-03 Thread Wolfgang Schuster

Alan Bowen schrieb am 30.03.2024 um 20:59:

How can I get the last page number of a chapter for a list (ToC)?

Outside of a list, I use \lastpagenumber.
But that does not work in a list such as the ToC.

Any tips or pointers will be gladly received.


You can try this:

\definepagestate[alanpage]
\definecounter  [alanindex]

\setuphead
  [chapter]
  [insidesection={\setpagestate[alanpage]},
   aftersection={\setpagestate[alanpage]}]

\setuphead
  [title]
  [insidesection=,
   aftersection=]

\define[1]\ChapterListPage

{\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}%
   \thinspace --\thinspace

\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}}

\setuplist[chapter][pagecommand=\ChapterListPage]
\setuplist[chapter][pagecommand=\ChapterListPage]

\showgrid

\starttext

\completecontent

\startchapter [title=Knuth]
\dorecurse{12}{\samplefile{knuth}}
\stopchapter

\startchapter [title=Zapf]
\dorecurse{12}{\samplefile{zapf}}
\stopchapter

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: what about "textdisplay"?

2024-04-01 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 01.04.2024 um 18:29:

Am 01.04.24 um 18:21 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 01.04.2024 um 17:19:
A while ago, I was pointed (by Wolfgang or Hans, I guess) to 
\start/stoptextdisplay to enhance whitespace handling around images.


My guess is Mikael because I saw the command the first time in the 
source of a presentation from him.


Oh, that’s probably where I saw it, too.


Here is a short example which two other solution to get a similar effect 
as \starttextdisplay.


\usemodule[visual]

\setupfloat[figure][location=left]

\starttext

\fakewords{10}{20}
\startlinecorrection
\fakeimage{4cm}{3cm}{6cm}{4cm}
\stoplinecorrection
\fakewords{10}{20}

\blank[2*line]

\fakewords{10}{20}
\startplacefigure[location={force,none}]
\fakeimage{4cm}{3cm}{6cm}{4cm}
\stopplacefigure
\fakewords{10}{20}

\blank[2*line]

\fakewords{10}{20}
\starttextdisplay
\fakeimage{4cm}{3cm}{6cm}{4cm}
\stoptextdisplay
\fakewords{10}{20}

\stoptext


I wanted to document it, but can’t find it in the sources:


The definition is in spac-ver.mkxl.


Thank you!

So, "context --find" does not what I thought it would.


AFAIR the find option searches only the manual sources.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: what about "textdisplay"?

2024-04-01 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 01.04.2024 um 17:19:
A while ago, I was pointed (by Wolfgang or Hans, I guess) to 
\start/stoptextdisplay to enhance whitespace handling around images.


My guess is Mikael because I saw the command the first time in the 
source of a presentation from him.



I wanted to document it, but can’t find it in the sources:


The definition is in spac-ver.mkxl.


$ context --find=textdisplay
[...]

These two documents use it and compile flawlessly.


 begin \definetextdisplay
 1 2 3
\definetextdisplay [...] [...] [..,..=..,..]
  OPT   OPT

1  NAME
2  NAME
3  inherits: \setuptextdisplay
 end \definetextdisplay

 begin \setuptextdisplay
  1   2
\setuptextdisplay [...,...] [..,..=..,..]
 OPT

1  NAME
2  before = COMMAND
   after  = COMMAND
   factor = NUMBER
 end \setuptextdisplay

 begin \starttextdisplay
*
\starttextdisplay [..,..=..,..] ... \stoptextdisplay
   OPT

*  inherits: \setuptextdisplay
 end \starttextdisplay

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Underbar

2024-03-28 Thread Wolfgang Schuster

Willi Egger schrieb am 28.03.2024 um 17:23:

Hello everybody,

I have a text, where a couple of lines are typeset with \underbar. — To me this 
underbar is a fraction to near the text. So I wanted to use \setupbar[…] to 
change the offset. Unfortunately nothing happens whatever I try.

MWE:

\setupbar[offset=-.5,dy=-.5]


\setupbar[underbar][offset=-0.5]

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Visually balanced columns

2024-03-27 Thread Wolfgang Schuster

Alexey Kryukov schrieb am 27.03.2024 um 14:02:

Hi list,

I'd like to know if its is possible to get visually balanced
mixedcolumns in lmtx. For example, if I have \blank's between
paragraphs, I would like them to be stretched or expanded by
a such way that the bottommost lines have the same vertical
position -- no matter, how many lines there are in each column and how
exactly they are aligned.

If I understand correctly, that's how the multicols environment in
LaTeX works, and that's how old-multicolumns worked -- but this module
seems to be no longer supported in lmtx.

I tried to disable gridfitting for startcolumns, but it produces a
completely distorted output.


The pagecolumns environment supports bottom aligned content.

\setupwhitespace[medium]

\setupalign[depth]

\starttext

\startpagecolumns
\dorecurse{20}{\samplefile{jojomayer}\par}
\stoppagecolumns

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Headertext

2024-03-26 Thread Wolfgang Schuster

Thomas Meyer schrieb am 26.03.2024 um 16:28:

Hi folks,

I know, with

\setuphead[chapter][header=high]

I can suppress the header text on the first page. But what can I do if I 
still want to have part of the header text on the first page?

Is there something I can do with \definetext and if so, how?


When you use "header=high" you can't have a header because the block for 
it no longer exists, compare the results for "header=high" and 
"header=empty" in the following example.


 begin example
\showframe

\starttext

\setuphead[chapter][header=high]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\setuphead[chapter][header=empty]

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext
 end example

As you have guessed \definetext is the way to create a custom header for 
the first page of your \chapter, the command has like \setupheadertexts 
a variable number of arguments.


The third argument with the horizontal position can only be used when 
you use two or four arguments to set texts on the left and right side 
but isn't in my example because a) the text position is the default and 
b) I pass only one argument for the content because I wan't the text in 
the middle.


 begin example
\showframe

\definetext
  [chapterheader] % identifier
  [header]% vertical position (header/footer)
% [text]  % horizontal position (text/margin)
  [This is a custom header for \tex{chapter}] % content

\setuphead[chapter][header=chapterheader]

\starttext

\chapter{Lorem Ipsum}

\dorecurse{10}{\samplefile{lorem}}

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Unknown units es and dk

2024-03-23 Thread Wolfgang Schuster

Jan Ulrich Hasecke via ntg-context schrieb am 23.03.2024 um 13:57:

I saw this in (the btw great) bachotex-stepbystep presentation

\definepapersize
[example]
[width=8.5es,
height=11es]


\setuptextbackground
[location=paragraph,
backgroundcolor=MyColors:4,
backgroundoffset=1dk,
frame=off]


The units "es" and "dk" are unknown to me.
What does they mean?


Regarding the dk unit: https://tug.org/TUGboat/tb42-3/tb132hagen-dk.pdf


A quote from the Luametatex source regarding the es unit:

The Edith and Tove were introduced at BachoTeX 2023 and because the 
error message
was still in feet we decided to adapt it accordingly so now in addition 
it reports
different values, including Theodores little feet measured by Arthur as 
being roughly

five Ediths.


Here is the fitting error message when you pass a dimension too large 
for TeX:


Dimension too large", I can't work with sizes bigger than
about 19 feet (45 Theodores as of 2023), 575 centimeters,
Toves, 230 Ediths or 16383 points. Continue and I'll use
the largest value I can.


You should also take a look at the lowlevel register manual 
(lowlevel-registers.pdf)

which explains how you can define your own units.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Struggling with the distance and right margin text

2024-03-22 Thread Wolfgang Schuster

Ursula Hermann schrieb am 22.03.2024 um 15:57:

Dear Pablo,


Many thanks for your example. Sorry for writing so late.

At least I found out, how it works for me .  This is the best way.


\setuppapersize[A8,landscape]
\setupbodyfont[termes, 12.50pt]
\setuplayout[inrightmargin=5.1cm
              backspace=2.9cm,
              inleftmargin=0cm,width=4cm]


You can shorten the layout to

\setuplayout
  [backspace=2.9cm,
   width=4cm]

because inleftmargin and inrightmargin don't exist as layout settings 
but there is leftmargin and rightmargin without the leading *in*.


You can add

\showlayout

to see the effects on the layout.

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: offset with \copypages

2024-03-21 Thread Wolfgang Schuster

Peter Münster schrieb am 21.03.2024 um 15:04:

Hi,

When inserting pages with \copypages, the included pages are slightly
shifted to the left and to the bottom.

Minimal example:

% test-file.tex:
\setuplayout[page]
\starttext
\input tufte
\vfill
\input tufte
\stoptext

% test.tex:
\starttext

\startlayout[page]

\copypages[test-file.pdf]

\stoplayout

\stoptext

How could I avoid this offset please?
You have to change the layout for the pages where you include your 
images to get rid of the default margins.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: command line arguments

2024-03-19 Thread Wolfgang Schuster

Hraban Ramm schrieb am 19.03.2024 um 21:41:
Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command line 
arguments.


This way it works for the number of pages, as used in 
\dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
\Schema looks right, but \setuparranging doesn’t work. Where's my error?


You forgot about expansion and in your case \doifelsedocumentargument is 
not fully expandable. This doesn't matter for \dorecurse where the 
number parser ignores the flag because \setuparranging does care and 
\Schema fails to expand.



\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}

\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuparranging[\Schema]


\doifelsedocumentargument{schema}
  {\setuparranging[\getdocumentargument{schema}]}
  {\setuparranging[1*8]}

It does also help to look at the included extra files (e.g. 
mtx-context-arrange.tex) written by Hans.


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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Suppress the Chapter Number in the Section Numbering

2024-03-19 Thread Wolfgang Schuster

Jeroen schrieb am 19.03.2024 um 20:35:


I am trying to suppress the chapter number in a section number as 
below as in 1., 2., etc instead of 1.1, 1.2, etc. Is there a simple way 
to achieve this?



1. The First Chapter
1. The First Section
...
2. The Second Section
...

2. The Second Chapter
1. The Third Section
...
2. The Fourth Section
...


\setuphead
  [chapter]
  [sectionstopper=.]

\setuphead
  [section]
  [sectionsegments=section,
   sectionstopper=.]

\starttext

\chapter{The First Chapter}

\section{The First Section}

\section{The Second Section}

\chapter{The Second Chapter}

\section{The Third Section}

\section{The Fourth Section}

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Adjusted Chapter Headings

2024-03-19 Thread Wolfgang Schuster

Jeroen schrieb am 19.03.2024 um 12:59:
I have some style adjustments for the chapters. The chapter "numbers" 
need to be Boek I, Boek II, etc. A vertical separator was introduced 
with an inframe. The chapter title at the right side does not vertically 
align properly with the chapter number in the frame (inside the frame is 
vertically centered, the title not). Is there a way to align the chapter 
title with the chapter number?




\starttexdefinition MyNumberChapterCommand #1
     \inframed[frame=off,rightframe=on,framecolor=black,
      rulethickness=1px,height=30pt]{#1\enspace}
\stoptexdefinition

\setuphead[chapter][style={\bfc},numbercommand=\MyNumberChapterCommand,
     page=no]


\define[2]\MyNumberChapterCommand
  {#1\space\blackrule[width=1pt,height=22pt,depth=8pt]\space#2}

\setuphead
  [chapter]
  [   page=no,
   command=\MyNumberChapterCommand,
 style=\bfc]

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Comments placed in the margin

2024-03-19 Thread Wolfgang Schuster

Jeroen schrieb am 19.03.2024 um 19:34:

This one unbolds the margin text:

\setupmargindata[inouter][style=\tf]

This one works well, it unbolds and reduces the size of the margin text:

\setupmargindata
   [inouter]
   [style={\switchtobodyfont[8pt]}]

This one does not seem to make a change:

\setupmargindata[inmargin][style={\tf}]



It does for me but but unless you want a certain style it is better to 
use a empty argument for the style key.


\starttext

\inmargin{Bold?}\samplefile{lorem}

\setupmargindata[inmargin][style=]

\inmargin{Bold?}\samplefile{lorem}

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Comments placed in the margin

2024-03-19 Thread Wolfgang Schuster




Jeroen schrieb am 19.03.2024 um 15:38:
For comments that are placed in the margin, the \inleft{}, \inouter{} 
etc will place text in the margin in bold. Can this text be placed in 
the margin in regular text or possibly in slightly smaller font size 
compared to the regular text in the document?


\setupmargindata[inouter][style=]

or

\setupmargindata[inleft][style={\switchtobodyfont[8pt]}]

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: ck hyphenation in old German orthography

2024-03-17 Thread Wolfgang Schuster

Hraban Ramm schrieb am 17.03.2024 um 12:06:
Hi, the sample file aesop-de is in old German orthography, there, ck 
should get hyphenated as k-k, this doesn’t work (e.g. Mücke isn’t 
hyphenated at all). Is there something I can configure?


Hraban


\mainlanguage[deo]
\setuplanguage[deo][
   hyphenmin=4,
   lefthyphenmin=2,
   righthyphenmin=2,
]

\starttext

\hyphenatedfile{aesop-de}

\startcolumns
Funktioniert die Trennung? Heckeneckenzecken

\samplefile{aesop-de}

\stopcolumns

\stoptext


Just as a start, the languages manual provides more details about 
hyphenation.


\startexceptions[de]
He{k-}{k}{ck}en-e{k-}{k}{ck}en-ze{k-}{k}{ck}en
\stopexceptions

% \registerhyphenationpattern[de][c1k/k=k]
%
% \setuphyphenation[method=traditional]

\mainlanguage[de]

\starttext
Heckeneckenzecken = \hyphenatedword{Heckeneckenzecken}
\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: issue with typing in footnotes

2024-03-17 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 17.03.2024 um 17:38:

Dear list,

I have the following sample (which was on the way of showing another issue):

   \starttext
   a
   \starttyping
   b
   \stoptyping
   c
   \startfootnote
   a
   \starttyping
   b
   \stoptyping
   c
   \stopfootnote
   \stoptext

Current latest (from 2024.03.11 09:34) breaks compilation with both LMTX
and LuaTeX.

As far as I know, this sample should be compiled without any issue.

Could you be so kind to confirm the issue or explain me what am I missing?


The footnote environment is just a fancy way for a command with a 
argument and buffers don't like being part of arguments.


You can put the code in buffer outside of the footnote and type the 
content of the buffer in the footnote.


 begin example
\starttext

\def\startfoo#1\stopfoo{#1}

% \startfoo
% xxx
% \starttyping
% yyy
% \stoptyping
% zzz
% \stopfoo

\startbuffer
yyy
\stopbuffer

\startfoo
xxx
\typebuffer
zzz
\stopfoo

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: can we do binding correction?

2024-03-17 Thread Wolfgang Schuster

Hraban Ramm schrieb am 17.03.2024 um 22:48:
Hi, this question was rised in my ConTeXt beginners workshop* at 
Chemnitz Linux Days today:


Can I configure binding correction for saddle-stitched or thread-bound 
booklets, and if, does it only work with arranging (imposition) or can 
I enable it somehow for the layout (if the printshop does the 
imposition)?


1. \definepageshift + \setuppageshift

2. \setuplayout[horoffset=]

Also I recognized I'm not sure about the difference of the layout 
parameters backspace and cutspace.


backspace is the inner margin and cutspace the outer

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Japanese

2024-03-16 Thread Wolfgang Schuster

Otared Kavian schrieb am 14.03.2024 um 14:48:

Dear Emmanuel,

Thank you for your reply: indeed I understand your approach, which is 
quite efficient. I am not at all good in coding, so I naively thought 
there would be a way for your setup to retrieve the information it 
needs from what the user is doing. Maybe once things are settled, Hans 
and Wolfgang will have a look in the Japanese part of ConTeXt so that 
the user can avoid to enter the setup included in the \directlua part.


There is no need for these calculations because

    1. you can create named layouts (e.g. \definelayout[kinohanmen:a4]) 
for each paper size,


    2. you can put the fontsize etc. settings in a setups block and 
load the one needed for each paper size and


    3. you can put all of them in a module which can be loaded when 
writing documents in japanese, the paper size can be passed as argument 
to the module.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Why aren't cross-references working in tabulate?

2024-03-15 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 15.03.2024 um 20:50:

When I run this code, \at{page}[xyz] is unable to find the cross reference:

\starttext
%\reference[xyz]{}
\starttabulate[|lp(.3\textwidth)|lp(.\textwidth)|]
\NC    \reference[xyz]{} \NC \NC\NR


\NC \doifnotmode{*trialtypesetting}{\pagereference[xyz]} \NC \NC\NR


\stoptabulate


\pagebreak

\at{page}[xyz]

\stoptext

The code does work when I uncomment line #2, revealing the 
cross-references work find when outside of a table.


I also tried using a TABLE environment instead and the result was 
similar, it wouldn't show the page number.


What am I doing wrong?


Tabulate and natural tables process the table content multiple times and 
therefore you're setting the reference multiple times, to avoid this 
check for trialtypesetting mode and set the reference only when you're 
out of the mode.


@Hans: Can we add the check trialtypesetting check to \reference etc.?

\protected\def\strc_references_set_named_reference
- {\ifreferencing
+ {\iftrialtypesetting
+\expandafter\gobblefourarguments
+  \orelse\ifreferencing
 \expandafter\strc_references_set_named_reference_indeed
   \else
 \expandafter\gobblefourarguments
   \fi}

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: How to track down source of [entry not flushed] displaying in indexes?

2024-03-13 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 13.03.2024 um 23:27:
After many hours of trial-and-error, I was able to recreate the problem 
in a minimum working example:


file main.tex only contains:

\starttext

     \index{birds}
     \index{insects}

     \input secondary

     \placeindex

\stoptext

file secondary.tex only contains:


    \index{turtles}

For reasons I can't understand, the index produces the same [entry not 
flushed] error. It seems here happening when contents are input.


The message appears even without the external file.


My code is so simple, I can't understand what I've typed wrong.


Indices need an anchor to be flushed. When you put \index entries 
between environments the next anchor appears at the start of a new 
paragraph (I used \dontleavehmode for this in the following example).


\starttext

\index{birds}
\index{insects}

\index{turtles}

\dontleavehmode % comment this line for [entry not flushed]

\placeindex

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Japanese

2024-03-11 Thread Wolfgang Schuster

Emanuel Han via ntg-context schrieb am 10.03.2024 um 17:43:

Hi all,

I added 
https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X_4051_Requirements_for_Japanese_Text_Layout

with attached working example code and to-do list.

Thanks for any contributions!

The working example code is still a work in progress. Its text layout 
output meets already some of the requirements (see comments in the 
code). Among the ones to still be implemented are:


 *
solid setting (no extra spacing between characters)
https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for
line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment
 *
aligning of the lines to the Kihon-hanmen (optimizing the code
below in this regard)

Can you make text files out of the images [1] with the spacing 
before/after punctuation to have short examples for testing.


[1] https://www.w3.org/TR/jlreq/#positioning_of_punctuation_marks


 *
positioning and realm of headings
https://www.w3.org/TR/jlreq/#fig3_1_9
https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and
https://www.w3.org/TR/jlreq/#fig3_1_4
 *
positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24
 *
inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1
 *
emphasis with sesame dot or bullet
 *
itemization https://www.w3.org/TR/jlreq/#fig2_5_6

Circled numbered are easy and achieved by adding additional number 
conversions.


 *
indenting of quotation paragraphs
https://www.w3.org/TR/jlreq/#fig2_5_7


Use the narrower or blockquote environment for this.


 *
tab setting https://www.w3.org/TR/jlreq/#fig2_6_1


Just use a table.


 *
furiwake https://www.w3.org/TR/jlreq/#fig2_7_2
 *
jidori https://www.w3.org/TR/jlreq/#fig2_7_4
 *
math https://www.w3.org/TR/jlreq/#fig2_7_6 and
https://www.w3.org/TR/jlreq/#fig2_7_62
 *
tategaki (writing vertically)


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \em issue in MkXL (2024.03.05 11:26)

2024-03-10 Thread Wolfgang Schuster

Hans Hagen via ntg-context schrieb am 10.03.2024 um 10:46:

On 3/10/2024 9:32 AM, Pablo Rodriguez via ntg-context wrote:

On 3/9/24 16:04, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 19:39:

[...]
    \enableexperiments[fonts.compact]

Which seeems weird to me. Or at least, I thought I read that Hans
enabled it by default in LMTX.


AFAIR Hans uses the setting in his own documents.


I have been using it for a while.

I hope the issue with \glyphslant might be fixed to enable it again.


Then my question is whether this was caused by simply enabling compact
fonts or by doing it twice.


The results happen when you use compact mode and is a result of
\glyphslant which keeps the value of the italic style even when you
switch back to the upright style.


Many thanks for your explaination,

using the low level commands

\glyphscale
\glyphxscale
\glyphyscale
\glyphslant
\glyphweight

directly can have side efects when at an outer level these are also set, 
so you need to accumulate, like


\starttext

test {\glyphscale 2000 test \glyphscale \numericscaled1.2\glyphscale 
test} test


test {\glyphslant  500 test \glyphslant \numericscaled2.0\glyphslant 
test} test


test {\glyphweight 100 test \glyphweight\numericscaled2.0\glyphweight 
test} test


\stoptext


The problem is that compact mode uses them to apply the slanted feature 
without any manual use of the commands from a user.


\enableexperiments[fonts.compact]

\definefontfamily[mainface][rm][TeX Gyre Termes]
  [it={style:regular, features:{default,slanted}},
   sl={style:regular, features:{default,slanted}}]

\setupbodyfont[mainface]

\starttext

\startstyle[style=italic]normal {\em emphasized} normal\stopstyle

\stoptext

The only way to mask the effect is to create a new fontfeature with the 
minimum slant value and apply it to the upright style.


\definefontfeature [unslanted] [slant=0.001]

\definefontfamily[mainface][rm][TeX Gyre Termes]
  [features={default,unslanted},
   it={style:regular, features:{default,slanted}},
   sl={style:regular, features:{default,slanted}}]

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: How to set section title based on section content?

2024-03-09 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 09.03.2024 um 16:01:

How to set section title based on section content?

I have a document that has some structures like this:

\starttext

\startsection[title={Animals}]

\event{\input knuth }

\stopsection

\startsection[title={Books}]

\event{\input knuth }

\stopsection

\stoptext

The event macro runs a bunch of conditionals, deciding which content to 
place inside the section. It places any one of neary 200 possible 
different types of content there.


Sadly when I wrote the code, I thought generic titles would be okay. Now 
I realize I need to be more specific, giving titles that match the 
content inside. I could move the section titles inside the \event macro, 
but it means rewriting ~200 other macros.


In other words, how do I define a section title by defining it somewhere 
in the content of the \event macro?


\starttext

\startsection[\whatistitle] %<-- would display "Neon Tetras"

\event{\thetitleis{Neon Tetras}\input knuth }

\stopsection

\startsection[\whatistitle] %<-- would display "Detective Stories"

\event{\thetitleis{Detective Stories}\input knuth }

\stopsection

\stoptext


When each section contains nothing except the \event command I would 
remove the section titles from the document itself and place them as 
part of the \event command.


\define[1]\Event
  {\startsection[title={#1}]
   \input{knuth}
   \stopsection}

\starttext

\Event{Neon Tetras}

\Event{Detective Stories}

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \em issue in MkXL (2024.03.05 11:26)

2024-03-09 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 19:39:

On 3/8/24 19:09, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 18:50:

[...]
LMTX gets b, c and d in slanted form.

LuaTeX gets only b and c in slanted form.

[...]
I get b and d in italic which is the expected output.


Sorry, my LuaTeX is getting slanted b and d ("c" was my typo).

But I see what was causing my issue (line from
~/texmf/texmf-local/cont-loc.mkxl):

   \enableexperiments[fonts.compact]

Which seeems weird to me. Or at least, I thought I read that Hans
enabled it by default in LMTX.


AFAIR Hans uses the setting in his own documents.


Then my question is whether this was caused by simply enabling compact
fonts or by doing it twice.


The results happen when you use compact mode and is a result of 
\glyphslant which keeps the value of the italic style even when you 
switch back to the upright style.


\enableexperiments[fonts.compact]

\definefontfamily[mainface][rm][TeX Gyre Termes]
  [it={style:regular, features:{default,slanted}},
   sl={style:regular, features:{default,slanted}}]

\setupbodyfont[mainface]

\starttext
\tf h\showcurrentfont[]\crlf
\it h\showcurrentfont[]\crlf
%\glyphslant\zerocount
\tf h\showcurrentfont[]\crlf
\it h\showcurrentfont[]
\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \em issue in MkXL (2024.03.05 11:26)

2024-03-08 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 18:50:

Dear list,

the following latest gets differents results when compiled with MkXL and
MkIV (in current latest from 2024.03.05 11:26):

   \definefontfamily[mainface][rm][TeX Gyre Termes]
 [features={default, quality},
  it={style: regular, features:{default, quality, slanted}},
  sl={style: regular, features:{default, quality, slanted}}]

   \setupbodyfontenvironment
   [default]
   [em=italic]

   \setupbodyfont[mainface]
   \starttext
   \startTEXpage[offset=1em]
   a\\
   \em b\\
   \em c\\
   \em d\\
   \stopTEXpage
   \stoptext

LMTX gets b, c and d in slanted form.

LuaTeX gets only b and c in slanted form.

I think LMTX may have an issue here.

Could anyone be so kind to confirm this?


I get b and d in italic which is the expected output.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-03-07 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:17:

On 3/6/24 19:50, Wolfgang Schuster wrote:

[...]
Could you write the first line in plain language?


Look at the second example of the Lua code in the example below for each
command (the first example is your version), the third example is just a
condensed version of example 2.


Many thanks for your extended explanation, Wolfgang.


Here is another solution which uses \ifcase the select a different case 
dependent on the value of the remainder.


\def\beforequadruplenumber#1%
  {\ifcase\numexpr#1;4\relax
 \the\numexpr#1+3\relax % remainder = 0
   \or
 \the\numexpr#1+2\relax % remainder = 1
   \or
 \the\numexpr#1+1\relax % remainder = 2
   \or
 \the\numexpr#1+4\relax % remainder = 3
   \fi}

\def\afterquadruplenumber#1%
  {\ifcase\numexpr#1;4\relax
 \the\numexpr#1+1\relax % remainder = 0
   \or
 \the\numexpr#1+4\relax % remainder = 1
   \or
 \the\numexpr#1+3\relax % remainder = 2
   \or
 \the\numexpr#1+2\relax % remainder = 3
   \fi}



Now it is clearer to me (although I need some time to learn from it).


When you use \numexpr to perform arithmetic in TeX it is recommended to 
add a final \relax to stop the command from scanning to additional 
values, e.g. in the example below \testone takes value beyond the 
argument because \numexpr hasn't ended yet.


\starttext

\def\testone#1{\the\numexpr #1 + 1 }

\testone{1} + 1

\def\testtwo#1{\the\numexpr #1 + 1 \relax}

\testtwo{1} + 1

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-03-06 Thread Wolfgang Schuster

Hans Hagen schrieb am 06.03.2024 um 21:38:

On 3/6/2024 7:50 PM, Wolfgang Schuster wrote:

The semicolon is a undocumented extension (I noticed it in the 
definition of \page[quadruple]) of \numexpr in Luametatex for the 
modulus operator.


One of these days I have to write the pending section in th elow level 
manual and also explain this:


\starttext
    \ifnum  10  = 11 wrong \else okay  \fi
    \ifnum  10 != 11 okay  \else wrong \fi
    \ifnum  10 !> 11 okay  \else wrong \fi
    \ifnum  10 !< 11 wrong \else okay  \fi
    \ifnum  10 ≤  11 okay  \else wrong \fi
    \ifnum  10 ≥  11 wrong \else okay  \fi
    \ifnum  10 ≰  11 okay  \else wrong \fi
    \ifnum  10 ≱  11 wrong \else okay  \fi
    \ifnum "F0 ∈ "F0 okay  \else wrong \fi
    \ifnum "F0 ∉ "F0 wrong \else okay  \fi
\stoptext


These new features are mentioned in the Luametatex manual but not the 
additions to \numexpr (I checked and : is mentioned but ; is missing).


\starttext

\startlines
\number\numexpr 5 + 2 \relax
\number\numexpr 5 - 2 \relax
\number\numexpr 5 * 2 \relax
\number\numexpr 5 / 2 \relax
\number\numexpr 5 : 2 \relax % new!
\number\numexpr 5 ; 2 \relax % new!
\stoplines

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: missing metadata in LMTX

2024-03-06 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11:

[...]

   \startxmlsetupsxml:meta
 %\aftergrouped{\setupinteraction%
 \setupmetadata
  [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]
 %}
   \stopxmlsetups


Use \expanded.

\startxmlsetups xml:meta
\expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, 
}}]}

\stopxmlsetups

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: missing metadata in LMTX

2024-03-06 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11:

On 3/6/24 17:35, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52:

[...]
I wonder whether this requires a minimal sample to be fixed.

Yes, a minimal example would help because \setupmetadata works in your
previous example.

Many thanks for your reply, Wolfgang.

Now I have the minimal sample:

[...]

   \startxmlsetups xml:meta
 %\aftergrouped{\setupinteraction%
 \setupmetadata
  [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]
 %}
   \stopxmlsetups


Use \expanded.

\startxmlsetups xml:meta
\expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, 
}}]}

\stopxmlsetups

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-03-06 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 04.03.2024 um 20:00:

On 2/28/24 19:28, Wolfgang Schuster wrote:

[...]
\def\beforequadruplenumber#1%
{\ifcase\numexpr#1+1;4\relax
   \number\numexpr#1+4\relax
 \else
   \number\numexpr#1+3-#1;4\relax
 \fi}


Sorry for not having answered before, Wolfgang.

I’m afraid I don’t get how \ifcase is deployed with as conditional
(being \ifcase used to give numbers for weekdays or months).


The \ifcase command is the TeX version of a switch statement from other 
programming languages.


The first case in \ifcase checks against zero which is shorter than 
writing "\ifnum ... = 0".



The semicolon is also mysterious to me, I don’t know what it does there
in plain language.


The semicolon is a undocumented extension (I noticed it in the 
definition of \page[quadruple]) of \numexpr in Luametatex for the 
modulus operator.



Sorry, I know it has to be simple, but the syntax is too cryptic for me.

Could you write the first line in plain language?


Look at the second example of the Lua code in the example below for each 
command (the first example is your version), the third example is just a 
condensed version of example 2.



Sorry for asking that. I’m afraid this would be the only way I could get
what \ifcase is doing there.


As was mentioned above I used it as a check when the remainder was 0.

 begin example
\startluacode

--~ interfaces.implement {
--~ name  = "beforequadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~ context(n + 3)
--~ elseif n % 4 == 1 then
--~ context(n + 2)
--~ elseif n % 4 == 2 then
--~ context(n + 1)
--~ elseif n % 4 == 3 then
--~ context(n + 4)
--~ end
--~ end
--~ }

--~ interfaces.implement {
--~ name  = "beforequadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if (n + 1) % 4 == 0 then
--~ context(n + 4)
--~ else
--~ context(n + 3 - n % 4)
--~ end
--~ end
--~ }

interfaces.implement {
name  = "beforequadruplenumber",
arguments = "integer",
actions   = function(n)
context(n + (((n + 1) % 4 == 0) and 4 or (3 - n % 4)))
end
}

--~ interfaces.implement {
--~ name  = "afterquadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~ context(n + 1)
--~ elseif n % 4 == 1 then
--~ context(n + 4)
--~ elseif n % 4 == 2 then
--~ context(n + 3)
--~ elseif n % 4 == 3 then
--~ context(n + 2)
--~ end
--~ end
--~ }

--~ interfaces.implement {
--~ name  = "afterquadruplenumber",
--~ arguments = "integer",
--~ actions   = function(n)
--~ if n % 4 == 0 then
--~   context(n + 1)
--~ else
--~   context(n + 5 - n % 4)
--~ end
--~ end
--~ }

interfaces.implement {
name  = "afterquadruplenumber",
arguments = "integer",
actions   = function(n)
context(n + ((n % 4 == 0) and 1 or (5 - n % 4)))
end
}

\stopluacode

\unprotect
\def\beforequadruplenumber#1{\clf_beforequadruplenumber\numexpr#1\relax}
\def\afterquadruplenumber #1{\clf_afterquadruplenumber \numexpr#1\relax}
\protect

\starttext
\dorecurse{20}{\recurselevel\space = 
\beforequadruplenumber{\recurselevel}\par}\page
\dorecurse{20}{\recurselevel\space = \afterquadruplenumber 
{\recurselevel}\par}

\stoptext
 end example

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: missing metadata in LMTX

2024-03-06 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52:

On 3/6/24 15:54, Hans Hagen wrote:

[...]

\setupmetadata
[title=FooBar]

that's for those who go global

Many thanks for the new command, Hans.

I‘m afraid this new command breaks my compilation.

The error message isn’t very helpful for me (see below).

I wonder whether this requires a minimal sample to be fixed.


Yes, a minimal example would help because \setupmetadata works in your 
previous example.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: missing metadata in LMTX

2024-03-05 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 04.03.2024 um 07:17:

On 3/4/24 01:18, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 03.03.2024 um 20:02:

[...]
With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them.
[...]

I can confirm the issue and it happens because Hans changed they way
how the values of the \setupinteraction commands are passed to Lua
side of ConTeXt to be written to the PDF file.


Many thanks for your reply and your explanation, Wolfgang.


I can provide at the moment solutions which ensure the information
appear in the PDF but none of the is very elegant and I hope Hans
can help with a clean solution.


The first one avoids the issue until Hans provides a final fix.


Here is the official solution:

\startxmlsetups xml:meta
  \setupmetadata
[author={\xmltext{#1}{/author}},
 title={\xmltext{#1}{/title}}]
\stopxmlsetups

The command is new and accepts the following keys:

  - title
  - subtitle
  - author
  - keyword
  - date

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \showsymbolset is noop

2024-03-05 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 04.03.2024 um 21:24:
The \showsymbolset has no output any more, apparently already for some 
time.


I checked on COW (ConTeXt ver: 2022.12.22 22:17 LMTX fmt: 2022.12.23) 
and my local installation (ConTeXt ver: 2024.02.22 18:31 LMTX fmt: 
2024.2.22).


Can someone try on MkIV?

"""
\usesymbols[nav]
\starttext

\showsymbolset[nav]

\stoptext
"""


You pass the wrong name to \showsymbolset.

\usesymbols[nav]

\starttext

\showsymbolset[navigation 1]\page
\showsymbolset[navigation 2]\page
\showsymbolset[navigation 3]\page

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: .jpx and .jxl

2024-03-05 Thread Wolfgang Schuster




Jim schrieb am 04.03.2024 um 15:30:

Recently I've been trying to make some PDFs smaller by using better
compression of JPEG pictures.

I was happy to see that \externalfigure cheerfully accepts .jp2 (JPEG 2000)
files.  However, my understanding (and I could well be wrong, but I've seen
it multiple places) is that JPEG 2000 *Part 2* files should have extension
.jpx, not .jp2.

By default, ConTeXt does not recognize .jpx.  But if I rename a .jpx file
to have a .jp2 extension, then ConTeXt properly processes the file and I
see the picture in the PDF.

Q: are there any plans to make ConTeXt recognize the .jpx extension?
If not, can anyone suggest some ConTeXt code which allows me to tell
ConTeXt to process a .jpx file as a .jp2 file?



Adding

\definegraphictypesynonym [jpx] [jp2]

at the begin of your document should do the trick.

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: missing metadata in LMTX

2024-03-03 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 03.03.2024 um 20:02:

Dear list,

this issue has been bugging me for some time:

[...]

With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them.

For both, I’m using current latest (from 2024.02.27 09:21).

Could anyone confirm the issue or explain me what I am missing


I can confirm the issue and it happens because Hans changed they way
how the values of the \setupinteraction commands are passed to Lua
side of ConTeXt to be written to the PDF file.

I can provide at the moment solutions which ensure the information
appear in the PDF but none of the is very elegant and I hope Hans
can help with a clean solution.

The first solution works around the grouping issue of the xmlsetups
environment and pushes the setting beyond the limit of it.

\startxmlsetups xml:meta
  \aftergrouped{\setupinteraction
[author={\xmltext{#1}{/author}},
 title={\xmltext{#1}{/title}}]}
\stopxmlsetups

The second solution makes the assignment to the \setupinteraction
command global to ensure they are kept even the environment ends,
int old MkII days ConTeXt provided a \startglobal environment to
do this but now I have rely on the primitives.

\startxmlsetups xml:meta
  \globaldefs\plusone
  \setupinteraction
[author={\xmltext{#1}{/author}},
 title={\xmltext{#1}{/title}}]
  \globaldefs\zerocount
\stopxmlsetups

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Japanese

2024-03-02 Thread Wolfgang Schuster

Emanuel Han schrieb am 01.03.2024 um 16:23:

Dear Wolfgang,

thank you for your valuable remarks. I integrated them, see corrected 
attached example.


Yes, correct layout examples exist. They're all showing vertical 
writing, but the rules and principles are exactly the same for 
horizontal writing.


 *
position of the headers and footers:
https://www.w3.org/TR/jlreq/#fig1_30


See my attached gongitsune.tex example how you can squeeze text in a 
very narrow header/footer.



 *
aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3


You can use the lines key for \setuplayout to let ConTeXt calculate the 
necessary value for the text height.



 *
protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6


You're getting this for free because ruby text doesn't take up vertical 
space, in case vertical text is working it would now stick into the 
margins as expected.


\starttext
\ruledhbox{a \ruby{x}{y} b}
\stoptext


In my previous mail, I wrote wrong amounts of lines. They should be 46 
lines on one page, while the actual example doesn't show the 46th line.


It would be important to identify the reason why only 24 characters 
are used to create a line when 25 could be used. Then we can develop a 
method to turn that mechanism off or circumvent it.

Quotation from https://www.w3.org/TR/jlreq:
/In principle, when composing a line with //ideographic (cl-19) 
//, //hiragana (cl-15) 
// and //katakana (cl-16) 
// characters, no extra spacing 
appears between their //character frame 
//. This is called 
solid setting (see //Figure 5 //)./


1. ConTeXt has a mechanism to typeset Japanese texts.

2. There are flaws in the output it produces but this nothing which 
can't be fixed.


3. To fix the problems someone has to be passionate to fix them and 
we're willing to help here.


As you can see in my second example file japanese.tex there is a font 
feature to create half sized parentheses etc. which isn't supported yet 
by ConTeXt's mechanism for japanese and in case your willing to improve 
it this should be taken care of as well.


Wolfgang

\definefontfeature [halt] [halt=yes]

\starttext

\setscript[nihongo]

\begingroup \showmakeup[glyph,fontkern]

% \startfont[file:notosanscjkjpregular*default]「うわアぬすと狐め」と、どなりたてました。\stopfont
% 
% \startfont[file:notosanscjkjpregular*default]「「うわアぬすと狐め」と、「どなりたてました」。\stopfont
% 
% 
\startfont[file:notosanscjkjpregular*default,halt]「うわアぬすと狐め」と、どなりたてました。\stopfont
% 
% 
\startfont[file:notosanscjkjpregular*default,halt]「「うわアぬすと狐め」と、「どなりたてました」。\stopfont

\startfont[name:notosansjpregular*default]「うわアぬすと狐め」と、どなりたてました。\stopfont

\startfont[name:notosansjpregular*default]「「うわアぬすと狐め」と、「どなりたてました」。\stopfont

\startfont[name:notosansjpregular*default,halt]「うわアぬすと狐め」と、どなりたてました。\stopfont

\startfont[name:notosansjpregular*default,halt]「「うわアぬすと狐め」と、「どなりたてました」。\stopfont

\endgroup

\stoptext
% \definefontfeature [fixeddimensions] [dimensions={1,1.8,0}]
% 
% \definefontfamily [noto_japanese] [rm] [Noto Serif CJK JP] 
[features={default,fullprotrusion,fixeddimensions}]
% \definefontfamily [noto_japanese] [ss] [Noto Sans CJK JP]  
[features={default,fullprotrusion,fixeddimensions}]

% \definefontfamily [noto_japanese] [rm] [Noto Serif CJK JP] 
[features={default,fullprotrusion}]
% \definefontfamily [noto_japanese] [ss] [Noto Sans CJK JP]  
[features={default,fullprotrusion}]

\definefontfamily [noto_japanese] [rm] [Noto Serif JP] 
[features={default,fullprotrusion}]
\definefontfamily [noto_japanese] [ss] [Noto Sans JP]  
[features={default,fullprotrusion}]

\setupbodyfont
  [noto_japanese]

\setscript
  [nihongo]

\setupalign
  [hanging]

\setupindenting
  [yes,1em]

\setupinterlinespace
  [line=2\bodyfontsize,
   height=0.9,
   depth=0.1]

\setupruby
  [style={\switchtobodyfont[6pt]}]

\setuppagenumbering
  [alternative=doublesided,
   location=none]

\setuphead
  [title,subject]
  [align=middle]

\startsetups [header:rightpage]

  \startframed [
  frame=off,
  strut=no,
  height=\headerheight,
  offset=none,
  align=low,
  roffset=1em,
  ]

\getmarking[subject]

  \stopframed

\stopsetups

\startsetups [header:leftpage]

  \startframed [
  frame=off,
  strut=no,
  height=\headerheight,
  offset=none,
  align=low,
  loffset=1em,
  ]

\getmarking[title]

  \stopframed

\stopsetups

\startsetups [footer:rightpage]

  \startframed [
  frame=off,
  strut=no,
  height=\headerheight,
  offset=none,
  align=low,
  roffset=1em,
  ]

\prefixedpagenumber

  \stopframed

\stopsetups

\startsetups [footer:leftpage]

  \startframed [
  frame=off,
  strut=no,
  height=\headerheight,
  offset=none,
  align=low,
  loffset=1em,
  ]

\prefixedpagenumber

  \stopframed


[NTG-context] Re: Japanese

2024-03-01 Thread Wolfgang Schuster

Emanuel Han via ntg-context schrieb am 01.03.2024 um 13:08:

Dear all, thanks for your contributions.

Sure I'll update the 
https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully 
with the help of Jeong Dal and others as soon as things are sorted out.


In attached example, the opening Brackets (I marked them with 
\color[red]{【} and \color[red]{{}) are taking the previous character 
with them to the next line. Please remove these to see that the 
previous character would stay on the previous line. Thanks Wolfgang 
for checking wether this is a bug.


Can you stick to fonts which are available for all systems (e.g. Noto 
CJK) because system fonts are a pain when you're on a different system.


The missing line break before 【 is caused by a wrong table entry in 
scrp-cjk.lua and I guess the following change is necessary


local japanese_2 = {
    jamo_initial = korean_break,
    korean   = stretch_break,
    chinese  = stretch_break,
    hiragana = stretch_break,
    katakana = stretch_break,
    half_width_open  = nobreak_stretch_break_autoshrink,
    half_width_close = nobreak_stretch,
-   full_width_open  = nobreak_stretch_break_shrink,
+   full_width_open  = stretch_break,
    full_width_close = nobreak_stretch,
    full_width_punct = japanese_before_full_width_punct, -- 
nobreak_stretch,

    hyphen   = nobreak_stretch,
    non_starter  = nobreak_stretch,
    other    = stretch_break,
}

but there can be more wrong entries.

I was not successful in figuring out how the protrusion mechanism can 
be set in order to keep full stops and commas on the previous line 
(protruding the column box). Could you please give me a hint, 
Wolfgang? Thanks. There's a \color[red]{。} in my example which should 
not jump to the next line.


Adding the first and last line to your example document worked for me.

\definefontfeature [default] [default] [protrusion=pure]

\definefontfamily [...] [...] [...]

\setupbodyfont [...]

\setupalign [hanging]

My example follows the Kihon-hanmen dimensioning as described in 
https://www.w3.org/TR/jlreq . What could be the reason that lines 
which could hold 25 characters are having only 24 characters, for 
example lines 2, 3 or 13 in column 1? I would expect them to have 25 
characters, the same as for example lines 7, 9 or 16 in column 1.


I guess the par builder is responsible for this when it arranges the 
paragraph but this is just a guess.


How can I change alignment of the lines so that the highest character 
boxes align with the top border of the layout boxes for text and 
header and with the bottom border of the layout box for footer? I hope 
that when this is achieved for the layout box for text, then this box 
would hold the expected 45 lines, and not 44 lines as it is doing now. 
Ruby characters in the first line should protrude the box, what they 
already do.
I tried to implement the 1em hskip of the header and footer away from 
the page border. While it works for left aligned headers and footers, 
it doesn't for the right aligned headers and footers (negative hskip 
has no effect). How to solve this problem?


Do you a proper example of the layout?

Setting a few values is not enough because TeX doesn't work the way you 
need for your layout. Things can be improved but in cases like header 
and footer you have to tell ConTeXt there are no characters with depth.



Also how to get rid of the first empty page?


To load a math font from a typescript you have to use the 
\definetypeface command, replace the line


    \definefontfamily [JapaneseFont] [mm] [math] [lucidaot] [default]

with

    \definetypeface [JapaneseFont] [mm] [math] [lucidaot] [default]

and the page disappears.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Japanese

2024-02-28 Thread Wolfgang Schuster

Emanuel Han via ntg-context schrieb am 28.02.2024 um 20:51:

Thank you all for your suggestions and contributions to the wiki.

I don't intend to nag, but when looking at what ConTeXt is producing, 
I need to state that the result is still far away from a properly 
typeset Japanese text.


So the nihongo script which comes with ConTeXt handles *line breaks / 
line wrapping*. But the line break rules defined in it need a rework, 
because they don't follow the standards. The standards are documented 
here: 
https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characters 
, and all affected characters are listed here: 
https://www.w3.org/TR/jlreq/tables/table_en3.pdf


We have different rules, depending what kind of character is 
surpassing the text width (or is in its last position).


Rule 1:

Before closing brackets, closing quotation marks, iteration marks, the 
Prolonged sound mark and small Kana, line breaking is prohibited.


’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.

The actual programmed behaviour by the nihongo script is that, if in 
the position which exceeds the line width,  these characters jump to 
the next line and take the previous character with them. If they're in 
the last position of the line, they stay where they are. This 
behaviour is correct.


Rule 2:

After opening Brackets and opening quotation marks, line breaking is 
prohibited (but not before).


‘“(〔[{〈《「『【

The actual programmed behaviour by the nihongo script is that these 
characters jump to the next line and take the previous character with 
them. This behaviour is wrong. They should jump to the next line 
without taking the previous character with them, just like any regular 
character. The difference to a regular character is that they jump 
already when still within the line length, and they're in the last 
position of the line. The correct behaviour can be seen in LibreOffice 
Writer in action.


Can you provide a minimal example because this should be correct and if 
not it's a bug.



Rule 3:
Comma (tōten), full width comma, full stop

、,。

The actual programmed behaviour by the nihongo script is that, if in 
the position which exceeds the line width, these characters jump to 
the next line and take the previous character with them. This 
behaviour is wrong.
They have to be put back to the end of the previous line, but beyond 
the specified line length. (JIS Z 8125) (Search for "Line adjustment 
by hanging punctuation" under https://www.w3.org/TR/jlreq/ )
If they're in the last position of the line, they stay where they are. 
The correct behaviour can be seen in LibreOffice Writer in action.


This is handled by the protrusion mechanism and enabled with paragraph 
alignment.



Rules 4, 5, ...:
Combinations of inseparable characters... (see 
https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_character 
) and eventually more, which I didn't test.


It might be useful to define three scripts nihongo_loose, 
nihongo_strict and nihongo_very_strict which each implement one of the 
3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a


According the *line gap* (Otared uses \setupwhitespace[big], which is 
exceeding common line gaps), I'd like to quote from 
https://www.w3.org/TR/jlreq/ :


/It is common that the line gap for the kihon-hanmen is set to a value 
between half-em spacing and the one em spacing of the character frame 
used for the kihon-hanmen. Half-em spacing can be chosen in cases 
where the line length is short, but one em spacing or close to it is 
more appropriate when the line length is longer than 35 characters./


I like the standard line gap which is provided by ConTeXt, which is 
equivalent to \setupwhitespace/[0pt]/. Even when using ruby, it works 
well. I found the best voffset for ruby to be -1.7ex.


The \setupwhitespace setting controls the distance between paragraphs 
but you're looking for the \setuplinespace command.


The *line adjustment* provided by ConTeXt by default is not meeting 
the needs for Japanese  (and Chinese) text, which follow a grid 
pattern. Especially the last line of a paragraph is squeezed, which is 
"hurting the eye".
When characters need to jump to the next line due to previously 
discussed line breaking rules, ConTeXt seems to apply "Line adjustment 
by inter-character spacing expansion", which is a valid method 
according to https://www.w3.org/TR/jlreq/#line_adjustment , although 
"Line adjustment by inter-character spacing reduction" is preferred.


The last point which ConTeXt is missing, when talking about Japanese 
typesetting, is vertical writing.


Vertical typesetting is possible but only for small text blocks which 
fit on a single page. Typesetting text which spans multiple pages isn't 
supported yet (it was possible ages ago with MkII) because nobody needed 
it yet.


Wolfgang

___
If your question is of interest to others as well, please 

[NTG-context] Re: imposition: getting to the last page of a booklet

2024-02-28 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 28.02.2024 um 19:02:

On 2/28/24 12:24, Pablo Rodriguez via ntg-context wrote:

[...]
This is why beforequadruple would make sense. I guess some Lua magic
could do that, computing x to the follwing page that "x % 4 = 3" (and
then \page[x]).

I will try to find a trick for that, but not now.


Replying to myself, this is a command to compute next numbers before and
after quadruples (with application to \realpageno):

  \starttext
   \def\beforequadruplenumber#1%
 {\ifnum\modulonumber{4}{#1} = 1
\the\numexpr #1 + 2
  \orelse\ifnum\modulonumber{4}{#1} = 2
\the\numexpr #1 + 1
  \orelse\ifnum\modulonumber{4}{#1} = 3
\the\numexpr #1 + 4
   \else
\the\numexpr #1 + 3
  \fi}


\def\beforequadruplenumber#1%
  {\ifcase\numexpr#1+1;4\relax
 \number\numexpr#1+4\relax
   \else
 \number\numexpr#1+3-#1;4\relax
   \fi}


   \def\afterquadruplenumber#1%
 {\ifnum\modulonumber{4}{#1} = 1
\the\numexpr #1 + 4
  \orelse\ifnum\modulonumber{4}{#1} = 2
\the\numexpr #1 + 3
  \orelse\ifnum\modulonumber{4}{#1} = 3
\the\numexpr #1 + 2
   \else
\the\numexpr #1 +1
  \fi}


\def\afterquadruplenumber#1%
  {\ifcase\numexpr#1;4\relax
 \number\numexpr#1+1\relax
   \else
 \number\numexpr#1+5-#1;4\relax
   \fi}

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Issue with italics

2024-02-26 Thread Wolfgang Schuster

Jean-Pierre Delange schrieb am 26.02.2024 um 18:41:

Thanks to Thomas and Denis,

That's it: use GFS Didot for the French text and Theano Didot for the 
Greek. In my working text I have this preamble (and other things):


[...]

I've found a solution, with Segoeui (Windows font) as the main font and 
Theano Didot for the Greek text.
But I don't understand why setting the fonts to GFS Didot and Theano 
Didot prevents italics from being displayed ...



Can you show the output of the following command on the terminal which 
lists all available font files for GFS Didot:


mtxrun --script fonts --list --all --pattern=gfsdidot*

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: imposition: getting to the last page of a booklet

2024-02-24 Thread Wolfgang Schuster

Michael Guravage schrieb am 23.02.2024 um 10:07:

Greetings,

I would like to use the nextquadruple and beforequadruple 
pagebreakhandlers described at the bottom of the wiki's imposition 
page. However, the examples complain of an error invoking the 
\installpagebreakhandler command.


The wiki page was last updated nearly four years ago. Is anyone using 
updated versions of these?


You can use quadruple out of the box.

\setuppagenumbering[alternative={singlesided,doublesided}]

\starttext

\samplefile{lorem}

\page[quadruple]

\samplefile{lorem}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-21 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 21.02.2024 um 19:04:

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it 
will probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
   draw OverlayBox withpen pencircle scaled 2 dashed withdots 
withcolor "red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

Since I needed only horizontal lines, I forced the height with an 
“invisible“ line:


\startuseMPgraphic{dottedborder}
    draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 
withcolor white;
    draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed 
withdots withcolor "red";

\stopuseMPgraphic

… but it would be visible on a colored background. I’m sure you can show 
me a better way…


\startuseMPgraphic{dottedborder}
  draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed 
withdots withcolor "red";

  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: MetaPost lines in tables?

2024-02-19 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

I guess I asked this a while ago, but I can’t find an answer:
Is it possible to replace the lines of a TABLE with my own MetaPost 
graphics?


ATM I’m trying to place my MP lines behind a frame-less TABLE; it will 
probably work, but it’s a crutch…


The example below draws a custom border for the whole cell but you're 
free to draw only certain sides (leftboundary etc. helps) but don't 
forget to set the boundary box for the graphic (OverlayBox is the size 
of the cell).


 begin example
\startuseMPgraphic{dottedborder}
  draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor 
"red";

\stopuseMPgraphic

\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]

\starttext

\bTABLE[frame=off,background=dottedborder]
  \bTR
\bTD Hello Table! \eTD
  \eTR
\eTABLE

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Text in Margin

2024-02-19 Thread Wolfgang Schuster

Jeroen schrieb am 19.02.2024 um 14:14:
In a textbook I am looking to place a large left margin at every page of 
each chapter. At left printed pages a left margin and at right printed 
pages a right margin, so like a double sided construction. In this 
margin I would like to place:


You can use a custom layout with a narrow text block and a wide 
rightmargin area.



1. Keywords and small descriptions to emphasize some text from the textflow


Use the \inright etc. commands or create your own commands based on 
\inright, look at the margindata mechanism for more information.



2. Figures


You can change the default location of figures from the text block to 
the margin area.


3. An expansion of a table that is placed in the main textflow but that 
needs to cover a wider range then the text area so it expands into the 
margin


In the example below I added a check to the table float to either center 
the small tables or align wide tables on the inner margin which extend 
into the margin area. While this method works in a simple example for a 
real document I suggest to create a clone of the table float (e.g. 
widetable) because the method in the example can lead to 
problems/limitations.



What is the the easiest way to achieve this?


 begin example
\setuppagenumbering
  [alternative=doublesided]

\setuplayout
  [width=10cm,
   rightmargin=6cm]

\showframe

\def\FloatTableALignment
  {\dowithnextbox
 {\ifdim\nextboxwd>\textwidth
\doalignedline{inner}{\flushnextbox}%
  \else
\flushnextbox
  \fi}
 \hbox}

\setupfloat[table][command=\FloatTableALignment]

\setupfloat[figure][default=rightmargin]

\starttext

\inright{Lorem ipsum \unknown}\samplefile{lorem}

\startplacefigure
  \externalfigure[dummy][width=\rightmarginwidth]
\stopplacefigure

\samplefile{lorem}

\startplacetable
  \bTABLE
\bTR
  \bTD one \eTD
  \bTD two \eTD
  \bTD three \eTD
\eTR
  \eTABLE
\stopplacetable

\samplefile{lorem}

\startplacetable

\bTABLE[textwidth=\dimexpr\textwidth+\rightmarginwidth+\rightmargindistance\relax,option=stretch]
\bTR
  \bTD one \eTD
  \bTD two \eTD
  \bTD three \eTD
\eTR
  \eTABLE
\stopplacetable

\samplefile{lorem}

\stoptext
%%% end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: XML processing, unwanted indentation/alignment

2024-02-15 Thread Wolfgang Schuster

Michael Guravage schrieb am 15.02.2024 um 21:28:

Greetings,

I'm typesetting an address book whose addresses are in XML. A typical 
entry has this structure:


   
     
     
       email="" mobile="" />

       
       
     
   

initials and birthday are required, first_name can be left blank and 
email, mobile and maiden_name are optional.


I've written a macro (name) to compose the name, i.e. initials, 
first_name (maiden_name), and another macro (nameemaillink) to make the 
name a link associated with an email address.


% Derive an individual's name
\def\name#1%
   {\ifxmlattempty{#1}{first_name} {\xmlatt{#1}{initials}} \else 
{\xmlatt{#1}{initials}, \xmlatt{#1}{first_name}} \fi
    \ifxmlattempty{#1}{maiden_name} {} \else { 
\tfxx(\xmlatt{#1}{maiden_name})} \fi}


You have a few spaces in the definition of your command (e.g. the space 
after \else and another one after the following { in the main_name 
attribute) which end as multiple spaces in the output.


While you can fix the problem by removing the spaces a better solution 
is to use the texdefinition environment to create your command, you can 
even use blank lines to structure the arguments.


To avoid problems with existing commands it is good practice to use 
camelcase for your own commands.


 begin example
\starttexdefinition Name #1

  \ifxmlattempty{#1}{first_name}
\xmlatt{#1}{initials}
  \else
\xmlatt{#1}{initials}, \xmlatt{#1}{first_name}
  \fi

  \ifxmlattempty{#1}{maiden_name}
%
  \else
{\tfxx(\xmlatt{#1}{maiden_name})}
  \fi

\stoptexdefinition
 end example

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Two bugs with descriptions in ConTeXt.

2024-02-13 Thread Wolfgang Schuster

SirColeman via ntg-context schrieb am 13.02.2024 um 22:04:
The first bug is that descriptions interfere with the counters, 
resulting in the peculiar behavior demonstrated in the resulting PDF.


Still no bug and there is no need to create your own counter because 
enumerations exist which are descriptions with a counter.


Unless I'm mistaken, I think it happens because the head of the 
description is evaluated twice, thus incrementing the counter 
twice---at least, that's the only explanation for how the number is 
incremented by 2 each time. Further, this issue seems to persist 
whether we're using macros or writing \incrementcounter directly.


The solution is to either make sure that the head of descriptions is 
evaluated only once, or document that text placed as the head of 
descriptions is meant to be evaluated twice, if there's a good reason 
for doing so. Of course, this silly example of incrementing counters 
can be subdued by placing the \incrementcounter directly in the after 
option when customizing descriptions. But it demonstrates the issue.


What you're supposed to do here is to increment the counter *before* you 
use the counter value.


As you guessed the content of the title is evaluated multiple times to 
get the width of the description title, in cases where a counter is 
incremented in such a case (very common when you have counters in a 
table cell) you use the trialtypesetting mode to increment only once.


I've tried to make the examples given be as varied as possible, 
demonstrating the different ways in which descriptions interact with 
the counter.


The second bug is that descriptions, or at least that's my intuitive 
expectation, shouldn't interfere with the bullets of items. I expect 
that the bullet stays where it is, and the description is placed next 
to it. But what happens is that the bullet is shifted to the right, 
making it overlap with the description's head, which isn't pretty.


Is this even a real world example?

The reason why the bullet points are at the wrong position is that 
descriptions and items use the same mechanism to set the text offset on 
the left and right sides and when you combine both mechanism the values 
are added. In case you you have a document where a descriptions appear 
as part of an item I suggest to use a different alternative (e.g. 
serried) for the description layout.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: An announcement of my new book.

2024-02-13 Thread Wolfgang Schuster

SirColeman via ntg-context schrieb am 13.02.2024 um 20:44:
>> This is wrong, the counter commands are official and the number 
variants are kept for backwards compatibility with old styles.


I do recall reading on the ConTeXt wiki that \definenumber is 
maintained for backwards compatibility reasons. However, why then does 
ConTeXt fail to compile with \getcounter, if that's how it's supposed 
to work? I was confused, don't get me wrong, but what I wrote was my 
own conclusion on the matter.


Clearly, we have a bug that needs to be reported. I wish my email 
hadn't included such misinformation. But now, this is a bug that needs 
to be resolved.


I'm running ConTeXt version 2024.01.24, and the given attachment fails 
to compile, even with MkIV.


I don't want to pester those subscribed to this mailing list with bug 
reports, so I thought it would be more sensible to post such reports 
on the context developers mailing list. I ask for confirmation that I 
can post there instead of here.


There is no command named \getcounter, only \convertedcounter exists. 
The two older commands \getnumber and \convertednumber are aliases for 
the new \convertedcounter command.


You can report bugs on this list (no need to use the more or less dead 
dev list) but in this case there is no bug, just different names.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: An announcement of my new book.

2024-02-13 Thread Wolfgang Schuster

SirColeman via ntg-context schrieb am 12.02.2024 um 08:49:
Greetings all. I have a passion for typesetting. I found that 
currently the best typesetting systems are those that are based on 
TeX. Of them, there are LaTeX, and ConTeXt.
LaTeX is very well documented and popular; ConTeXt, on the other hand, 
is apparently very powerful and capable, but is not as well documented.


There are things that are spectacularly well documented, others that 
only show hints, and leave it up to the user to figure things out on 
their own, and others still that won't even compile on a more recent 
version of ConTeXt (apparently the proper way to access a counter's 
value in ConTeXt is to use \getnumber or \convertednumber, and not 
\getcounter. That's just an example).


This is wrong, the counter commands are official and the number variants 
are kept for backwards compatibility with old styles.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Section numbering does not work

2024-02-13 Thread Wolfgang Schuster

Oliver Marugg schrieb am 13.02.2024 um 00:17:

Hi

Section numbering does not work until I remove \startbackmatter 
\stopbackmatter. I had a longer text file and I stripped it down until I found 
this?

Greets Oliver


Running freshly installed context ARM64 on m1 and updated it via sh install.sh 
on ARM64 macos 14.3.1:

context --version
mtx-context | ConTeXt Process Management 1.05
mtx-context |
mtx-context | main context file: 
/Applications/ConTeXtStandalone/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2024.01.24 22:39
mtx-context | main context file: 
/Applications/ConTeXtStandalone/tex/texmf-context/tex/context/base/mkxl/context.mkxl
mtx-context | current version: 2024.01.24 22:39
--

Stripped down MWE:

\setuppapersize[A4] [A4]
\starttext
\completecontent[criterium=all]
% ToC
\page
\chapter{CHAP 1}
TEXT
\startbackmatter
\startchapter[title=Literature]
\placelistofpublications
\stopchapter
\stopbackmatter
\stoptext


Besides enabling numbering for the backpart you can use the appendix 
block which has numbering by default.


%\defineconversionset[appendix:default][n]

\starttext

\startfrontmatter
  \completecontent[criterium=all]
\stopfrontmatter

\startbodymatter
  \startchapter[title=CHAP 1]
  TEXT
  \stopchapter
\stopbodymatter

\startappendices
  \startchapter[title=Literature]
  \placelistofpublications
  \stopchapter
\stopappendices

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: removing whitespace

2024-02-13 Thread Wolfgang Schuster

Michael Guravage schrieb am 13.02.2024 um 14:01:
While reading the documentation I spotted something similar from which I 
derived this solution:


\setupinteraction[state=start]
\def\squeeze#1%
   {
     \goto{#1} [url(tel:\ctxlua{context(string.gsub("#1", " ", ""))})]
   }



ConTeXt has a Lua function to remove spaces.

\starttext
\cldcontext{string.nospaces("01234 56789")}
\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Square right aligned

2024-02-09 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 09.02.2024 um 20:07:

On 2/8/24 22:37, Otared Kavian wrote:

Hi Ursula,

I think you mean the so-called end of the proof sign, or QED (Quod Erat
Demonstrandum). You can use this:

\definesymbol[QED][\mathematics{\square}]
\def\qed{\wordright{\symbol[QED]}}
\starttext
This is the end of our proof. \qed
\stoptext

In principle it is included in ConTeXt, but it seems that in the latest
version I have (2024.01.23), the command \qed is broken.


Hi Otared,

\qed seems to have been disabled (line 988 in strc-con.mklx).



The \qed command works only in a description or enumeration environment.

\definedescription [qedtest] [closesymbol=\symbol{qed}]

\starttext

\startqedtest
\samplefile{lorem}\qed
\stopqedtest

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: chronological TOC

2024-01-29 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 27.01.2024 um 10:05:

Am 26.01.24 um 23:46 schrieb jbf:
I wonder if someone can point me in the right direction for a separate 
TOC which needs to be in chronological order at the back of the book 
(i.e. not in page number order, although I need the page numbers to 
show up in the TOC. There is the normal TOC at the front of the book, 
according to chapter titles.


I have succeeded in defining a separate TOC to place at the back, but 
have not succeeded in the chronological order! Here is what I have done:


\definelist[chron][criterium=all,alternative=c]

At the back of the book:

\placelist[chron][criterium=all]

Then at an appropriate point after each \startchapter I have placed 
(as an example):


\writetolist[chron]{}{{\bf 29 April 2017,} Speech, Panama City}

This gives me my list, but in page number order. How do I get the date 
(e.g. 29 April 2017) to be the ordering factor in the list. I assume 
it will be something to do with criterium, but am clueless at the 
moment on how to indicate this.


I don’t know if it works this way (the wizards will know a way), but for 
special needs I’m (ab)using indexes:
just add something like \index[2017-04-29]{Speech, Panama City} to your 
chapter command and setup the index at will.


Lists have a sort option but this is no use here because you can't use 
the title to have a chronological sorted list.


\starttext

\placelist[section][order=title]

\section{Hans}

\section{Peter}

\section{Anton}

\stoptext

Using the register mechanism as you suggest seems to be the best option 
in this case.


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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Own command definition breaks with interaction: Use of \do_my_command doesn't match its definition

2024-01-29 Thread Wolfgang Schuster

Gerion Entrup schrieb am 25.01.2024 um 09:18:

Hi,

I want to make a proper definition of a new command to be able to
process it in Lua. I found something on StackOverflow [1] but that
breaks in enumeration _and_ when interaction is enabled and I do not
understand why? Can you give me some help here?

I want to make commands like \foo{bla} and \foo[b]{bla} possible at the
same time. Here is a minimal example (also attached):

```
\startluacode
function userdata.my_command(keywords, text)
commands.writestatus("test", string.format("text: %s, config: %s", 
text, keywords))
 local cfg = utilities.parsers.settings_to_hash(keywords)

if cfg['emph'] ~= nil then
context("\\emph{" .. text .. "}")
elseif cfg['bold'] ~= nil then
context("\\bold{" .. text .. "}")
else
context(text)
end
end
\stopluacode


\startluacode
function userdata.my_command(keywords, text)
  local keywords = utilities.parsers.settings_to_hash(keywords)
  if keywords['emph'] then
context.emph(text)
  elseif keywords['bold'] then
context.bold(text)
  else
context(text)
  end
end
\stopluacode


% without that line there is no problem
\setupinteraction[state=start]

\defineenumeration[enu][text=Enu]


\defineenumeration[enu][text=Enu,title=yes]


\unprotect
\def\mc{\dosingleempty\do_my_command}
\def\do_my_command[#1]#2{%
\iffirstargument{%
\ctxlua{userdata.my_command('#1', [==[#2]==])}%
}\else {%
\ctxlua{userdata.my_command('', [==[#2]==])}%
}\fi
}
\protect


\tolerant\protected\def\mc[#1]#2%
  {\ctxlua{userdata.my_command("#1","#2")}}

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Section number in the margin and the section title followed by paragraph!

2024-01-28 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 27.01.2024 um 18:40:

On 1/27/24 17:40, Ali Ali wrote:

Thanks, those seems close to what I wanted but not exactly.

The ASCII graphic (better in typewriter font) may explain what I desired,
```
 text width
  |<>|

##.   SECTION TITLE paragraph
   ...
   .

|<-->|
margin
```
I wanted paragraph to begin on the same line the section title lies.


\define[1]\SectionNumberCommand
  {\margindata[inmargin][scope=local]{#1}}

\setuphead
  [section]
  [alternative=text,
   numbercommand=\SectionNumberCommand,
   distance=0pt]

\starttext

\section{Lorem}

\samplefile{lorem}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Section number in the margin and the section title followed by paragraph!

2024-01-27 Thread Wolfgang Schuster

Ali Ali schrieb am 27.01.2024 um 06:03:

I've able to achieve the results I wanted by trial/e using the code shown 
below.
"""
\def\subsecnumwrapper#1{\llap{#1\hskip8pt}}
\setuphead[subsection][alternative=text,numbercommand=\subsecnumwrapper,distance=0pt]
"""

I just wanted to know if there already an option defined to achieve the desired 
result.


\setuphead [subsection] [alternative=margin]
%\setuphead [subsection] [alternative=inmargin]
%\setuphead [subsection] [alternative=margintext]

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Suggestions and problems of the manuals

2024-01-26 Thread Wolfgang Schuster

Gerion Entrup schrieb am 25.01.2024 um 09:24:

Am Mittwoch, 17. Januar 2024, 13:44:51 CET schrieb Gerion Entrup:

Hi,

I discovered the manuals in the context distribution. My general way to
built the manuals were these steps:
```
# execute one time
git clone https://github.com/contextgarden/context.git
cd context/doc/context/sources/general/manuals/

# for every manual
cd $MANUALFOLDER
context $MAIN_MANUAL_FILE.tex
```
Is there a way to speed this up, so to build all manuals with one
command (some make file or shell script for example)?

I saw some problems within the manuals:
- In units/units-mkiv.tex the spacing seems not to work with current
   LMTX. See the attached screenshot (units-mkiv.png) for my rendering.
   In my understanding the spaces should differ.
- I changed some typos(?) and other stuff in that file. The patch is
   attached (0001-units-mkiv-improve.patch).
- math/math-mkiv.tex seems not to compile. The last lines of the log:
system  >
system  > ConTeXt  ver: 2024.01.08 11:23 LMTX  fmt: 2024.1.16  
int: english/english
Sorry, but I can't typeset math unless various parameters have been 
set. This is
normally done by loading special math fonts into the math family slots. 
Your font
set is lacking at least the parameter mentioned earlier.
mtx-context | fatal error: return code: 1
- I tried to find a prebuild version and found 
https://mirror.contextgarden.net/general/manuals/math-mkiv.pdf.
   However, this document seems to be from 2021 and has a kind of wobbly
   rendering in Okular/Poppler (I remember the same phenomena with early
   LMTX). See the screenshot attached (math-mkiv-online.png). Is there a
   newer version somewhere? Maybe it is meaningful to delete the old
   version.

It also does not compile with the newest upload:
ConTeXt  ver: 2024.01.24 22:39 LMTX  fmt: 2024.1.25


I found two problematic sections in the document.

1. The section "Choices" (line 694 -- 741) in math-spacing.tex describes 
the removed \setdisplaymathspacemodel command.


2. The section "Script kerning" (line 127 -- 203) in math-features.tex 
descibes the \mathscriptboxmode primitive which was removed in Luametatex.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \starttable questions

2024-01-25 Thread Wolfgang Schuster

Jim schrieb am 25.01.2024 um 22:01:

Hi Henning,

On Thu, Jan 25, 2024 at 17:16 (+0100), Henning Hraban Ramm wrote:


Am 25.01.24 um 16:12 schrieb Jim:

Hi, I was wondering if anyone here could help me with these three things:
For a long time I have been using Wichura's TaBle macros (i.e., what one
gets with
  \input table
in plain TeX) and would like to use what appears to be ConTeXt's version of
those (i.e., what one gets with \starttable ... \stoptable).



However, https://wiki.contextgarden.net/Command/starttable says
The environment \starttable ... \stoptable is and (sic) old and
nearly obsolete way to handle tabular material
Q1: are there plans to remove \starttable ... \endtable from ConTeXt any
time "soon", or is that wiki comment gratuitously pessimistic?



Hans suggests to use tabulate as long as it fits.

I just gave that a try, using the same syntax as \starttable:

\starttable[|c|c|]
\HL
\VL \bf Year \VL \bf Citizens \VL\SR
\HL
\VL 1675 \VL ˜428 \VL\FR
\VL 1795 \VL 1124 \VL\MR
\VL 1880 \VL 2405 \VL\MR
\VL 1995 \VL 7408 \VL\LR
\HL
\stoptable

\starttabulate[|c|c|]
\HL
\VL \bf Year \VL \bf Citizens \VL\SR
\HL
\VL 1675 \VL ˜428 \VL\FR
\VL 1795 \VL 1124 \VL\MR
\VL 1880 \VL 2405 \VL\MR
\VL 1995 \VL 7408 \VL\LR
\HL
\stoptabulate

While tabulate produced a table with the above input, it needs some work to
make the table look good.  (The columns are too narrow, the vrules don't
meet the hrules, ...).

Perhaps these can be fixed with some tweaking, but I notice that in all of
https://wiki.contextgarden.net/Command/starttabulate
and
https://wiki.contextgarden.net/Tabulate
and
http://www.ntg.nl/maps/22/28.pdf
there is a conspicuous lack of examples with vrules.  And the tables in the
(at least) the starttabulate wiki page which use vrules don't use tabulate
to create the tables.

Coincidence?  I think not.  :-)


Table which rely on rules to make the content readable have a serious 
problem
(read Edward Tufte books how you can improve the visual style) but the 
better

alternative in this case are either natural tables or extreme tables.

Below is a example which uses the table like wrapper for natural tables
which makes adding rules and changing the padding around text very
simple because each table cell is a \framed block with all its options.

\starttext

\startsetups[ruledtable]
  \setupTABLE [frame=off,align=middle,loffset=.5em,roffset=.5em]
  \setupTABLE [column] [each]  [leftframe=on,rightframe=on]
  \setupTABLE [row]    [first] 
[topframe=on,bottomframe=on,foregroundstyle=bold]

  \setupTABLE [row]    [last]  [bottomframe=on]
\stopsetups

\startTABLE[setups=ruledtable]
\NC Year \NC Citizens \NC\NR
\NC 1675 \NC ˜428 \NC\NR
\NC 1795 \NC 1124 \NC\NR
\NC 1880 \NC 2405 \NC\NR
\NC 1995 \NC 7408 \NC\NR
\stopTABLE

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Caching Metafun images and VIM Syntax highlighted code

2024-01-24 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 24.01.2024 um 17:06:
I am writing two books. One is on Rust programming and another is on 
geometry, so I have syntax highlighted code and in second has lost of 
diagrams.


Perhaps Aditya Mahajan can tell me how can I cache code snippets. 
Invoking VIM will have heavy penalty on highlighting the code otherwise.


You can also try to extend ConTeXt's syntax highlighter (or the scite 
module) to support Rust which solves the cache problem.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Using plain TeX commands in ConTeXt

2024-01-24 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 24.01.2024 um 16:52:
Thanks for correcting me, Wolfgang. I meant only TeX commands not plan 
TeX macros.


As I already wrote you can use \parindent etc. in your document but 
unless you

know what you're doing you should keep it to a minimum to avoid conflicts
with other mechanism which rely on certain settings, e.g. changing the 
\parindent

value can result in unwanted result with paragraph indentation set with
\setupindenting[...].

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Using plain TeX commands in ConTeXt

2024-01-24 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 24.01.2024 um 16:37:
For example: \kern, \parindent and so on. Rephrasing the question, can 
LuaMetaTeX/ConTeXt compile

plain TeX files. If yes, how can I do that?


You mix up two different things here.

1. Plain TeX is a collection of TeX macros like ConTeXt or LaTeX.

2. LuaMetaTeX is a program like pdfTeX or LuaTeX which provides commands 
which are used by above mentioned collections to create macros.


Even though ConTeXt provides some commands which available in plain TeX 
not all of the are supported which means you can't process plain TeX 
documents.


On the other hand commands which are provided by the engine like 
\parindent can be used in a ConTeXt document but higher level mechanism 
like \setupindenting are the better choice.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: context version 20240118 ("Registerhaltigkeit")

2024-01-22 Thread Wolfgang Schuster

Thomas Meyer schrieb am 22.01.2024 um 13:04:



Am 22.01.24 um 12:06 schrieb Henning Hraban Ramm:

Am 22.01.24 um 11:46 schrieb Thomas Meyer:
I might get a bit impatient if I have the impression that others get 
an answer faster. Sorry for that.


It’s not unusual to get that impression. It depends on the current 
attention, capacity and mood of the few who can answer your questions.


So the problem is still \hfill that the last paragraph is not on grid 
in the new and the old version (and comma).


Grid is not as easy as it looks first. Low level tricks like fills or 
skips can mess it up.



Maybe \startlinecorrection helps… (No, it doesn’t.)

It also doesn’t help to add a \blank or \par after \vfill.


I know it, i tried it. And I tried \snaptogrid \vbox {}, it doesn't work 
too.


Only counting empty rows and set the number in \blank[ *big] works!



You need a fixed space (multiple of the line distance) between the text 
blocks and \vfill is a variable space which isn't what you want here.


TO get the desired space between the blocks you have to measure the 
height of the text at the bottom and calculate the number of lines which 
have to be added in the gap. Below is a simple solution which adds the 
required number of \blank lines.


\def\PlaceAtBottom
  {\par
   \dowithnextbox
  {\scratchdimen\dimexpr\pagegoal-\pagetotal\relax
   \ifdim\nextboxht>\scratchdimen
 \page
 \getnoflines{\dimexpr\textheight-\nextboxht\relax}%
 \dontleavehmode\blank[\number\numexpr\noflines-2\relax*line]%
 \unvbox\nextbox
   \else
 \getnoflines{\dimexpr\scratchdimen-\nextboxht\relax}%
 \blank[\number\numexpr\noflines-1\relax*line]%
 \unvbox\nextbox
   \fi}
  \vbox}

\let\stopPlaceAtBottom\egroup

\def\startPlaceAtBottom
  {\PlaceAtBottom\bgroup}

\mainlanguage[de]
\setupbodyfont[libertinus, 12pt]

\setuppagenumbering
  [location={footer,middle}]

\setuplayout
  [grid=yes]

\showgrid

\starttext

\samplefile{lorem}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\page

\dorecurse{4}{\samplefile{lorem}}

\startPlaceAtBottom
{\sl\samplefile{lorem}}
\stopPlaceAtBottom

\stoptext

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Looking for itemize help

2024-01-15 Thread Wolfgang Schuster

Jim schrieb am 15.01.2024 um 01:42:

I have

\setupwhitespace [big]

so that I get "a blank line" between paragraphs.

I would like to *not* have "blank lines" before and after my items.  For
example, if there is more "paragraph text" after the last item I would like
to see this structure:

--

Some text preceding the list of items:
a. Item one.
b. Second item.
This sentence is part of the same paragraph.

The next paragraph starts here...

--

and if there is no "paragraph text" after the last item, I'd like to see
this structure:

--

Some text preceding the list of items:
a. Item one.
b. Second item.

The next paragraph starts here...

--

Try as I might, I can't find the right options to give to \startitemize.

The closest I have found is to start with
\startitemize[a,nowhite]
but that prevents the "blank line" even in the second case above, which is
not what I want.  Further, 'packed' and 'joinedup' seem to behave
identically here, both leaving "a blank line" before the first item and
after the last item.

Clearly, I can force a blank line before the following paragraph with a
\vskip, but that seems like a crude way to do it.

Can someone either enlighten me on either
(a) the Right ConTeXt Way to do this, or
(b) a document that would tell me this, if I knew to read it?

I've looked in the wiki, the not-so-short intro to ConTeXt, and "ConTeXt:
an excursion" with no luck.


Hi Jim,

such a feature exists only to suppress paragraph indentation but not to 
ignore whitespace

between paragraphs.

\setupitemize[indentnext=auto]

\setupindenting[yes,medium]

\starttext

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa 
turpis,
semper quis fringilla ut, viverra nec risus. Pellentesque habitant morbi 
\unknown


\startitemize
\startitem Lorem ipsum \unknown \stopitem
\stopitemize

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa 
turpis,
semper quis fringilla ut, viverra nec risus. Pellentesque habitant morbi 
\unknown


\startitemize
\startitem Lorem ipsum \unknown \stopitem
\stopitemize
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa 
turpis,
semper quis fringilla ut, viverra nec risus. Pellentesque habitant morbi 
\unknown


\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: "Registerhaltigkeit"

2024-01-14 Thread Wolfgang Schuster

Thomas Meyer schrieb am 14.01.2024 um 11:21:

Thank you Wolfgang and Hraban,
it can be so easy!

But if my last subject should be at the end of the page and I shift it 
with \vfill to the end, the last subject doesn't fit the grid!


Can you provide a minimal example where you show what you're trying to 
place at the bottom of the page.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: "Registerhaltigkeit"

2024-01-14 Thread Wolfgang Schuster

Thomas Meyer schrieb am 14.01.2024 um 10:30:

Hi folks,

which settings are necessary to achieve "Registerhaltigkeit"?


\setuplayout[grid=yes]

but sometimes elements elements have to be forced to be on the grid, 
e.g. tables need to be part of a float.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Why the way key-value argument is called affected the document's output?

2024-01-13 Thread Wolfgang Schuster

Ali Ali schrieb am 08.01.2024 um 23:53:

Since in the "setup-en.pdf" on p. 234, in "\setuplayout" the possible values for "grid" key is 
"yes", "no" (default), and "off" respectively.


The commands in the document are not always up to date and somtimes miss 
entries or list no longer valid ones, in this case the NAME placeholder 
is missing.



So what does the "yes " (with a trailing space) sets "grid" key to?


The expected behavior is to ignore invalid arguments and fall back to a 
default (in this case "no")option.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: conversion from realpage to pagenumber

2024-01-12 Thread Wolfgang Schuster

mf schrieb am 12.01.2024 um 10:18:

Hello list,

how do I convert the realpage number to a page number?

Suppose you have a document with a frontmatter of 20 pages in roman 
numerals, followed by the main text starting from page 1 in arabic 
numerals.


So the twelfth page is 'XII', while the twenty-second is '2'.

How do I get 'XII' from 12 and '2' from 22?


\defineconversionset
  [frontpart:pagenumber] [] [romannumerals]

\setuppagenumber
  [way=byblock]

% Alternative method for "way=byblock" when you have an appendix where
% the pagenumber of the bodypart continues rather than being reset
%
% \startsectionblockenvironment[bodypart]
%   \resetuserpagenumber
% \stopsectionblockenvironment

\starttext

\startfrontmatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopfrontmatter

\startbodymatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopbodymatter

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: [ flowing figures ]

2024-01-11 Thread Wolfgang Schuster

vm via ntg-context schrieb am 11.01.2024 um 16:15:
How can I wrap an externalfigure into a box that can be placed within 
running text?

Should I wrap the externalfigure into a start/stop buffer, then place it?


There is no need any extra code because \externalfigure can be used in 
running text,
only at the start of a paragraph you have to add \dontleavehmode. 
Another way
is to use the \inlinefigure command which is a small wrapper around 
\externalfigure.


\useMPlibrary[dum]

\starttext

\samplefile{ward} 
\externalfigure[dummy][location=low,height=\lineheight] \samplefile{ward}


\blank

\dontleavehmode\externalfigure[dummy][location=low,height=\lineheight] 
\samplefile{ward}


\blank

\samplefile{ward} \inlinefigure[dummy] \samplefile{ward}

\blank

\inlinefigure[dummy] \samplefile{ward}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Fwd: Re: x mark symbol and general symbol guide

2024-01-09 Thread Wolfgang Schuster

Gerion Entrup schrieb am 09.01.2024 um 16:21:

Hi,

I have to come back to that topic, since it seems not to work.
The said source code produces just the text "times" and "check" for me
(see 1.pdf). I also tried:

```
\usesymbols[fontawesome]

\starttext
\showsymbolset[fontawesome-solid]
\stoptext
```
and get a list of symbols that do not belong to fontawesome (see 2.pdf).

I also tried to find the symbol file directly in the context
distribution and found:
tex/texmf-context/tex/context/base/mkiv/symb-imp-fontawesome.mkiv

However, most parts are commented out there, one of the few remaining
symbols is wheelchair. However, when using that, I just got the string
_378 (3.pdf). Source code:

```
\usesymbols[fontawesome]

\startTEXpage[offset=1pt]
\symbol[fontawesome][wheelchair]
\stopTEXpage
```

Is there a problem with my installation?
Additional output:
```
% mtxrun --script fonts --list --all --pattern='fontawesome'
identifier familyname   fontname
filename subfont   
instances

fontawesomefontawesome  fontawesome 
FontAwesome.otf
fontawesome6brands fontawesome6brands   fontawesome6brandsregular   
/usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
fontawesome6brandsnormal   fontawesome6brands   fontawesome6brandsregular   
/usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
fontawesome6freenormal fontawesome6free fontawesome6freesolid   
/usr/share/fonts/fontawesome/Font Awesome 6 Free-Solid-900.otf
fontawesomenormal  fontawesome  fontawesome 
FontAwesome.otf
fontawesomeregular fontawesome  fontawesome 
FontAwesome.otf
```


The symbols expect version 5 of fontawesome but you have version 6.

I guess it's time to switch to the new version of the fonts which can be 
done by replacing 5 (file:fontawsome5...) with 6 (file:fontawsome6...) 
in the following lines in symb-imp-fontawesome.mkiv


\definefontsynonym [FontAwesomeBrands] 
[file:fontawesome5brandsregular400.otf]
\definefontsynonym [FontAwesomeRegular] 
[file:fontawesome5freeregular400.otf]

\definefontsynonym [FontAwesomeSolid] [file:fontawesome5freesolid900.otf]

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Why the way key-value argument is called affected the document's output?

2024-01-08 Thread Wolfgang Schuster

Ali Ali schrieb am 08.01.2024 um 23:33:

So is
"\setuplayout[grid=yes]"
AND
"\setuplayout[
grid=yes
]"
not same?

I mean, we are initializing "grid" to "yes" in both cases.


No, in the first case you end the value of the grid-key with ] which 
results in "yes" as argument but in the second case you have a linebreak 
before ] which adds a space to the argument which results in "yes " 
(with a trailing space) as argument.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Local alternative to \input

2024-01-04 Thread Wolfgang Schuster

eroen schrieb am 04.01.2024 um 17:12:
I have a document that is getting a lot of mark-up instructions for 
creating tables and placing figures. I would like to move this out of 
the main text flow. The easiest way would be using \input, but i 
rather place all this at the bottom of the file and just refer to it 
with something like \localinput or so to a textblock at the bottom of 
the same file. What would be the easiest way to implement this?


Can you provide a minimal example, natural tables provide a mechanism to 
separate layout and content but we can't know what you use in your document.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Equivalent for hdots and hdotsfor

2023-12-30 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 30.12.2023 um 09:41:
In LaTeX, I can use \hdots for horizontal dots and \hdotsfor{n} to 
fill for several columns in a determinant. But these do not work in 
ConTeXt. What is the equivalent for these in ConTeXt?


Can you show the desired output from LaTeX with a PDF file and a minimal 
example of your ConTeXt version.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-30 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 30.12.2023 um 09:40:
I tried this for old style factorial, but it appears much below the 
line in which it is used. How can I bring it up?


Replace the \inmframed command with \mcframed.

\define[1]\oldfact
  {\mcframed[frame=off,strut=no,leftframe=on,bottomframe=on]{#1}}

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-27 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 27.12.2023 um 13:31:


What do you expect here to pass as argument to the oldfact command?

I will pass something like n, 5, 10 etc.


A simple alternative to tikz is the usage of \framed.

\define[1]\oldfact
  {\inmframed[frame=off,strut=no,leftframe=on,bottomframe=on]{#1}}

\starttext

\m{\oldfact{n}}

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-27 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 27.12.2023 um 13:19:

I use following in Latex to generate old factorial symbol:

\newcommand{\oldfact}[1]{%
\tikz[baseline]{\node[anchor=base,inner 
sep=0.3ex](mynode){\ensuremath{#1}};\draw(mynode.north 
west)--(mynode.south west)--(mynode.south east);\path[use as bounding 
box]($(mynode.south west)+(-0.3ex,-0.3ex)$)rectangle($(mynode.north 
east)+(0.3ex,0.3ex)$);}

}


What do you expect here to pass as argument to the oldfact command?

But I do not know how to make it work in ConTeXt as I am not very 
familiar with ConTeXt.


If you see https://www.ntg.nl/maps/36/09.pdf page no. 28 then proof is 
defined as


\defineenumeration
[proof]
[ text=Proof,
number=no,
headstyle=italic,
title=no, %this is the default
closesymbol={\mathematics{\square}},
style=normal]

But the closessymbol does not work.

I will create a minimum working example and post it as soon as possible.


This works here:

\defineenumeration
  [proof]
  [closesymbol={\mathematics{\square}}]

\starttext

\startproof
\samplefile{lorem}
\stopproof

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: old style factorial symbol and theorems

2023-12-27 Thread Wolfgang Schuster

Shiv Shankar Dayal schrieb am 27.12.2023 um 13:01:

Hi,

How can I typeset old style factorial symbol and theorems in ConTeXt. 
I found https://www.ntg.nl/maps/36/09.pdf but it does not work. What 
adaptation should I do for it to work?


Can you be more precise what you have tried and doesn't work, a complete 
minimal example would be perfect.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: error: Control sequence expected instead of undefined

2023-12-25 Thread Wolfgang Schuster

Jeong Dal via ntg-context schrieb am 25.12.2023 um 16:09:

Hi,

I got an error message as following:

Control sequence expected instead of undefined

If I comment out the “\externalfigure[][]” line, then there is no 
error message.


I don’t know what is wrong in the sample code.


The problem was mentioned a while ago

    https://www.mail-archive.com/ntg-context@ntg.nl/msg106078.html

and Hans provided a fix until a new binary is online

    https://www.mail-archive.com/ntg-context@ntg.nl/msg106095.html

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: \setupsynonyms textstyle=cap failing

2023-12-24 Thread Wolfgang Schuster

Garulfo schrieb am 23.12.2023 um 12:41:

Hi all,

the following  minimum working example is properly typesetted with 
textstyle=bold,

but it fails with textstyle=cap (ConTeXt version : 2023.09.26 18:19)

A number should have been here; I inserted '0'. (If you can't figure 
out why I
needed to see a number, look up 'weird error' in the index to The 
TeXbook.)

mtx-context | fatal error: return code: 1

It works on https://context-on-web.eu (ConTeXt version : 2022.12.22 22:17)


\definesynonyms    [abbreviation] [abbreviations] [\AbbreviationsFull]
\setupsynonyms [abbreviation] [textstyle=bold]

\starttext

\contextversion
\abbreviation{NTG}{Nederlandstalige TeX Gebruikersgroep}

Test 1 : \NTG .

Test 2 : \AbbreviationsFull{NTG}.

\stoptext

Any clue ?


Hans made changes on the capitals mode and now the following two lines 
have to be added to typo-cap.mkxl on line 52 and 53.


\definecapitals[\v!cap] [\v!capital]
\definecapitals[\v!Cap] [\v!Capital]

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: increase vertical between underbrace and equation

2023-12-18 Thread Wolfgang Schuster

Aditya Mahajan schrieb am 18.12.2023 um 21:55:

On Mon, 18 Dec 2023, Aditya Mahajan wrote:


On Mon, 18 Dec 2023, Dean Hung wrote:


The documentation on underbrace (and overbrace, underbracket, etc...) in
the ContextGarden wiki seems to be very limited, and I was not able to find
any user-supplied arguments for increasing this vertical distance.

There are various solutions available for LaTex, and they require external
packages (e.g., BigStrut, vphantom) that redefine the strut height.

I hope I'm missing something simple... Any help would be greatly
appreciated!

Hey, this is context. We don't need any packages for simple stuff:

\startformula
\underbrace[mindepth=1cm]{x+y+z}_{\mathrm{my text here}}
\stopformula

Actually, realized that you want more distance in the other direction. One 
option is to use \vrule.

\underbrace{x+y+z}_{\vrule width 0pt height 1cm\relax\mathrm{my text here}}

You probably also want \text{...} instead of \mathrm{...}.


\underbrace{x+y+z}_{\unframed[toffset=1cm]{my text here}}

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: error with definestartstop and startmode

2023-12-17 Thread Wolfgang Schuster

Peter Münster schrieb am 17.12.2023 um 10:09:

On Sat, Dec 16 2023, Hans Hagen via ntg-context wrote:


\usemodule[abbreviations-logos]
\defineblock [H] [before=\startcolor[blue],after=\stopcolor]
\keepblocks[H]

Thanks for this solution.

Is there also something for inline-mode? Example:

test \beginH TEST\endH test


You can create different versions of your environment and let context choose
one whether the mode is enabled or disabled.

%\enablemode[H]

\startmode [H]
  \definestartstop [H] [color=blue]
\stopmode

\startnotmode [H]
  \define\startH{\ignoreupto\stopH}
\stopnotmode

\starttext

xxx \startH yyy \stopH zzz

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Problem with the paragraph

2023-12-14 Thread Wolfgang Schuster

Ursula Hermann schrieb am 13.12.2023 um 15:22:


Dear list,

I have this example. I need the whole paragraph in color. But there is 
something wrong.


\definepapersize[MyBook][width=19cm,height=24cm]

\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook

%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper



This doesn't work to use Times New Roman as main font, you can use

    \setupbodyfont[termes]

to get a times lookalike.


\setupbodyfont[Times New Roman, 12.2pt]

\definemargindata [MyInMargin][inright]

\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]

\defineenumeration

[theorem]

  [

text=Theorem,

title=yes,

width=fit,

distance=0.2em,

alternative=serried,

  ]

\definetextbackground[paragraph][

location=paragraph,

background=color,

backgroundcolor=lightgray,

leftoffset=.5\bodyfontsize,

rightoffset=.5\bodyfontsize,

topoffset=.5\bodyfontsize,

bottomoffset=.5\bodyfontsize,

before={\switchtobodyfont[global]},

after={},

frame=off,]

\margintext{\blackrule[color=black, height=0.10ex, 
width=1cm]\\}\blackrule[color=black, height=0.10ex, width=13.50cm]


\starttext

\margintext {1.1.1}



What is the purpose of all these starttext/stoptext blocks?


\starttext

\bf{Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor)}.

\stoptext

\starttext

{\it

\par Sei M die Menge aller Männer und F die Menge aller Frauen. Die 
Aus-\par


sage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen

machen Sie sich die Bedeutung der beiden Aussagen klar.

\stoptext

\par

\starttext



1. Use the itemize environment to create numbered blocks.

2. Learn the correct usage of inline math mode, i.e. \m{...}


1. \m\forall m ∈M : ∃f ∈F : h(m, f).\par

2. ∃f ∈F : ∀m ∈M : h(m, f).\par

\stoptext

\blank

\starttext

\startparagraph

\blank

\tf Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass

ein \m ∃\forall∀oder ein \m \forall∀\m∃versteckt ist. Dann ist es 
besonders wichtig, die


Formulierung sehr lange zu prüfen und eventuell auch formalisiert

noch einmal aufzuschreiben.”\blank

Der Wert von y = f(x) ist unabhängig von der Wahl\par

von x“ ist gleichbedeutend mit ∃y : ∀x : f(x) = y \par

(Beutelspacher [10, S.54]).

\blank

\stopparagraph

\stoptext



Wolfgang

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

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: About framedtext

2023-12-13 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 13.12.2023 um 18:19:

Am 13.12.23 um 19:03 schrieb Fabrice Couvreur:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.
Thanks
Fabrice

   \definecolor[ColorA][0.8(white)]
   \definecolor[MyColorA][.75(MyColorB,white)]


I never saw this syntax in ConTeXt.


This was added a few years ago (AFAIR to provide something similar to 
the TikZ color command).


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

maillist : ntg-context@ntg.nl / 
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
___


  1   2   3   4   5   6   7   8   9   10   >