[NTG-context] Re: penalties

2024-11-04 Thread Thomas Meyer

Hi Hans,

thank you very much for your help.
The version
\startsetups[mypenalties] ...
seemed to work better. Then I have tried
\specificationdef \MyWidowPenalties \widowpenalties 3 1 1 0
\specificationdef \MyClubPenalties \clubpenalties 3 1 1 0 ...
and it was even better.
However, I can no longer evaluate what works really well, as a new 
problem has arisen (after the last update?):
On one page I still have 18 empty lines at the bottom. On the next page 
there is a paragraph with a picture on the right that only takes up 13 
lines. Then more text. I don't know how to get the paragraph with the 
image onto the previous page.


Greetings
Thomas


Am 31.10.24 um 21:33 schrieb Hans Hagen:

On 10/31/2024 7:26 PM, Thomas Meyer wrote:

Hi folks,

following today's update,

\startsetups[grid][mypenalties]
 \setdefaultpenalties
 \setpenalties\widowpenalties{2}{1}
 \setpenalties\clubpenalties {2}{1}
\stopsetups

\setuplayout[grid=yes, setups=mypenalties]


does

\startsetups[mypenalties]
 \setdefaultpenalties
 \setpenalties\widowpenalties{2}{1}
 \setpenalties\clubpenalties {2}{1}
\stopsetups

work? this [grid] was only used for this case and has been dropped in 
favour of more powerful par passes and specification definitions


this setup approach was also sensitive for order

doesn't work any longer, I think. Can anyone confirm this. There is 
another problem (page break in the paragraph) that I have yet to verify. 


We now have so call \specificationdef's that work as shown below:

\starttext

\showmakeup[vpenalty]

\specificationdef \MyWidowPenalties \widowpenalties 3 1 1 0
\specificationdef \MyClubPenalties  \clubpenalties  3 1 1 0

{ \samplefile {tufte} } \page

{ \MyWidowPenalties \MyClubPenalties  \samplefile {tufte} }  \page

{ \lesswidowpenalties \lessclubpenalties  \samplefile {tufte} } \page

{ \setupalign[lesswidows,lessclubs,lessorphans] \samplefile {tufte} }  
\page


\stoptext

predefined new alignment keys are:

defaultwidows defaultclubs defaultbroken

lesswidows lessclubs lessbroken

lessorphans lessorphans:2 lessorphans:3 lessorphans:4

strictwidows strictwidows:2 strictwidows:3 strictwidows:4
strictclubs  strictclubs:2  strictclubs:3  strictclubs:4

strictbroken

so a 'global' setupalign can be used

Hans



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___ 

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


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



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

2024-10-31 Thread Hans Hagen

On 10/31/2024 7:26 PM, Thomas Meyer wrote:

Hi folks,

following today's update,

\startsetups[grid][mypenalties]
 \setdefaultpenalties
 \setpenalties\widowpenalties{2}{1}
 \setpenalties\clubpenalties {2}{1}
\stopsetups

\setuplayout[grid=yes, setups=mypenalties]


does

\startsetups[mypenalties]
 \setdefaultpenalties
 \setpenalties\widowpenalties{2}{1}
 \setpenalties\clubpenalties {2}{1}
\stopsetups

work? this [grid] was only used for this case and has been dropped in 
favour of more powerful par passes and specification definitions


this setup approach was also sensitive for order

doesn't work any longer, I think. Can anyone confirm this. There is 
another problem (page break in the paragraph) that I have yet to verify. 


We now have so call \specificationdef's that work as shown below:

\starttext

\showmakeup[vpenalty]

\specificationdef \MyWidowPenalties \widowpenalties 3 1 1 0
\specificationdef \MyClubPenalties  \clubpenalties  3 1 1 0

{ \samplefile {tufte} } \page

{ \MyWidowPenalties \MyClubPenalties  \samplefile {tufte} }  \page

{ \lesswidowpenalties \lessclubpenalties  \samplefile {tufte} }  \page

{ \setupalign[lesswidows,lessclubs,lessorphans] \samplefile {tufte} }  \page

\stoptext

predefined new alignment keys are:

defaultwidows defaultclubs defaultbroken

lesswidows lessclubs lessbroken

lessorphans lessorphans:2 lessorphans:3 lessorphans:4

strictwidows strictwidows:2 strictwidows:3 strictwidows:4
strictclubs  strictclubs:2  strictclubs:3  strictclubs:4

strictbroken

so a 'global' setupalign can be used

Hans



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

2024-10-31 Thread Thomas Meyer

Hi folks,

following today's update,

\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{2}{1}
\setpenalties\clubpenalties {2}{1}
\stopsetups

\setuplayout[grid=yes, setups=mypenalties]


doesn't work any longer, I think. Can anyone confirm this. There is 
another problem (page break in the paragraph) that I have yet to verify. 
Greetings Thomas
___
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] making TABLE spacing match tabulate/halign spacing

2024-10-14 Thread Kirill Davidov
Greetings,

TABLE uses framed extensively to make its cells. it adds all sorts of
offsets and paddings (especially vertical) to cells that annoy me
greatly. i'd like to set up TABLEs to have the same vertical spacing as
a regular tabulate table or even halign, but i keep getting lost in the
options for both TABLE and framed. which ones do i need? i'd like it to
play nice with interline spacing options as well.

MWE:

% === mwe start ===
\startsetups document:start
\setupinterlinespace[line=3.5ex]
\stopsetups

%\showboxes

\startdocument

\startcolumns[n=4]

text\blank[none]
more text\blank[none]

\columnbreak

\unprotect
\halign{%
    \hss#\tabskip=1em&\tabskip=0pt#\cr
    text&more text\cr
    more text&text\cr
}%
\protect

\columnbreak

\starttabulate[|r|l|]
\NC text \NC more text \NC\AR
\NC more text \NC text \NC\AR
\stoptabulate

\columnbreak

\start
\setupTABLE[column][1][align=flushright]%
\setupTABLE[column][2][align=flushleft]%
\bTABLE
    \bTR \bTD text \eTD \bTD more text \eTD \eTR
    \bTR \bTD more text \eTD \bTD text \eTD \eTR
\eTABLE
\stop

\stopcolumns

\stopdocument
% === mwe end ===

Kirill

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

2024-10-10 Thread Mikael Sundqvist
Hi,

On Thu, Oct 10, 2024 at 2:58 PM Henning Hraban Ramm  wrote:
>
> Yesterday I learned:
>
> \startsetups[*default]
> \widowpenalties 3 1 1000 0
> \clubpenalties 3 1 1000 0
> \orphanpenalties 2 8000 1000
> \stopsetups
>
> If I want the penalty settings applied to “everything” (after defining
> the layout, I think?), then I need the setup "*defaults".

Yes, for now, since it got reset when \setuplayout was done. But we
are working on making it possible to also setup this with \setupalign,
with a few "reasonable" pre-defined setups. So, for example in my math
book I currently run

\setupalign[lesswidows,lessclubs,lessorphans,strictmath]

and that actually makes a few of these setups. It will of course be
possible to define your own set of penalties and use them instead.

>
> Since TeX uses a club against orphans (brutal!), I’m not sure what
> \orphanpenalty is for.

Wolfgang already explained this, but in short they are there to
discourage that a paragraph ends with only one word. We looked at it
yesterday at the meeting. You saw those penalties in action when you
did \showmakeup[hpenalty].

>
> I remember \twinpenalty is against doubled words (below each other?),
> and \toddlerpenalty against single letter words at the end of a line
> (why “toddler”?).

Indeed. Well, you can imagine a little toddler not really being able
to join the rest, or if you want, tied to the rest.

>
> widows and clubs get only 150 in TeX, but 2000 in ConTeXt, as far as I
> could find.
>
> Are there more penalties that make sense to set individually?

If you do math there might be more (set above by strictmath), but I
think you are fine with the ones above. Since you are finishing a
project, please tell if more problems show up. We can have another
chat where we try to solve...

>
> WRT demerits: Did I understand correctly that demerits are the “sum”
> (some formula) of badness and penalties in a line or paragraph?

A bit like that. For each possible breakpoint you get a badness value.
Then you can see it as if TeX runs over the paragraph once more, given
all possible breakpoints, with or without extra penalties, and builds
up a demerits for the different possible solutions. They can come from
badness, penalties and additional demerits (adjdemerits not to have
incompatible lines for example). Then, at the end, the best solution
(least demerits) is the one that will be used.

We are currently writing an article on the parbuilder, with and
without parpasses. You saw an early draft at the meeting yesterday.

/Mikael
___
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: penalties

2024-10-10 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 10.10.2024 um 14:54:

Yesterday I learned:

\startsetups[*default]
\widowpenalties 3 1 1000 0
\clubpenalties 3 1 1000 0
\orphanpenalties 2 8000 1000
\stopsetups

If I want the penalty settings applied to “everything” (after defining 
the layout, I think?), then I need the setup "*defaults".


Since TeX uses a club against orphans (brutal!), I’m not sure what 
\orphanpenalty is for.


 begin primitives.tex
[...]

\startnewprimitive[title={\prm {orphanpenalties}}]

This an (single entry) array parameter: first the size is given followed 
by that amount of penalties. These penalties are injected before spaces, 
going backward from the end of a paragraph. When we see a math node with 
a penalty set then we take the max and jump over a (preceding) skip.


\stopnewprimitive

\startnewprimitive[title={\prm {orphanpenalty}}]

This penalty is inserted before the last space in a paragraph, unless 
\prm {orphanpenalties} mandates otherwise.


\stopnewprimitive

[...]
 end primitives.tex

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] penalties

2024-10-10 Thread Henning Hraban Ramm

Yesterday I learned:

\startsetups[*default]
\widowpenalties 3 1 1000 0
\clubpenalties 3 1 1000 0
\orphanpenalties 2 8000 1000
\stopsetups

If I want the penalty settings applied to “everything” (after defining 
the layout, I think?), then I need the setup "*defaults".


Since TeX uses a club against orphans (brutal!), I’m not sure what 
\orphanpenalty is for.


I remember \twinpenalty is against doubled words (below each other?), 
and \toddlerpenalty against single letter words at the end of a line 
(why “toddler”?).


widows and clubs get only 150 in TeX, but 2000 in ConTeXt, as far as I 
could find.


Are there more penalties that make sense to set individually?

WRT demerits: Did I understand correctly that demerits are the “sum” 
(some formula) of badness and penalties in a line or paragraph?


Hraban
___
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 change the way one input file's data is displayed, depending on where it is in the document.

2024-09-25 Thread Bruce Horrocks
Hi Joel,

Your MWE fails to compile for me because \datatypeA is not defined.

> On 24 Sep 2024, at 00:19, Joel via ntg-context  wrote:
> 
> I have some code like this--it is a very reduced minimum-working example, 
> from 10,000+ lines of code:
> 
> fileA.tex--
> 
> \datatypeA{fish}{an animal that lives in the sea}
> \datatypeA{bear}{a big animal with claws and fur}
> \datatypeA{squid}{a sea creature with many legs}
> 
> fileB.tex--
> 
> \datatypeB{fish}{an animal that lives in the sea}
> \datatypeB{bear}{a big animal with claws and fur}
> \datatypeB{squid}{a sea creature with many legs}
> 
> main.tex--
> 
> \datatypeA[2]{\startitemize \item #1 #2 \stopitemize}
> \datatypeA[B]{#1 -- #2}

Did you mean to \def or \define \datatypeA and \datatypeB here?

> 
> \define[8]\activity{
> \subject{#1}
> #2
> \startitemize
> \item #3
> \item #4
> \item #5
> \item #6
> \item #7
> \stopitemize
> #8
> }
> 
> \define[2]\balloongame{
> \activity{Balloon Toss Game}{Instructions}{scissors}{plates}{construction 
> paper}{#1}{#2}{\input fileA}
> }
> \define[2]\fishinggame{
> \activity{Fun Fishing Game}{Instructions}{scissors}{plates}{construction 
> paper}{#1}{#2}{\input fileB}
> }
> 
> \starttext
> 
> \balloongame{balloons}{tape}
> \fishinggame{crayons}{glue}
> 
> \stoptext
> 
> Basically, I have different classroom activities, defined as macros. 
> \balloongame gives all details to the teacher about a "Balloon Toss Game" and 
> \fishinggame defines a "Fun Fishing Game". (code has been reduced and 
> simplified significantly).
> 
> The main issue I have is I have data being stored in filesA.tex, fileB.tex, 
> etc. (there are often a dozen such files). Note that strangly the datasets 
> are all identical, but a different file is called, and the only difference in 
> the dataset is they call different macros. So "Balloon Game" pulls the list, 
> but displays them in datatypeA format, the other game takes the same data, 
> but its in a different file, and since the macros are different, it displays 
> the information differently.
> 
> Basically, I have tons of data files sharing basically the same information, 
> but each one defined inside the file as using a different macro, according to 
> how the information is to be displayed (maybe sometimes as a list, sometimes 
> in a table, etc.)

> 
> This method seems horribly inefficient. I should be able to store that data 
> in one file, but display the data in different ways. The problem is if I use 
> one format, like this...
> 
> \datatype{fish}{an animal that lives in the sea}
> \datatype{bear}{a big animal with claws and fur}
> \datatype{squid}{a sea creature with many legs}
> 
> ...how do I get that dataset to be included, but displayed in a different 
> format each time?

There is a facility called a dataset which allows you to store key-value pairs.

Use \definedataset to create one:

  \definedataset [animals] [ ]

then in your data file populate it using:

  \setdataset [animals] [fish] [desc={an animal that lives in the sea}]
  \setdataset [animals] [bear] [desc={a big animal with claws and fur}]
  \setdataset [animals] [squid] [desc={a sea creature with many legs}]

To retrieve a single value you use:

  \datasetvariable {animals} {fish} {desc}

If you want to be able to retrieve the name of the animal and do something with 
it then populate the dataset using an anonymous table instead:

  \setdataset [animals] [name=fish,desc={an animal that lives in the sea}]
  \setdataset [animals] [name=bear,desc={a big animal with claws and fur}]
  \setdataset [animals] [name=squid,desc={a sea creature with many legs}]

And retrieve using:

  The first animal I saw was a \datasetvariable{animals}{1}{name} which is 
\datasetvariable{animals}{1}{desc}.
  The second animal I saw was a \datasetvariable{animals}{2}{name} which is 
\datasetvariable{animals}{2}{desc}.
  etc

To mimic the \input{fileA} behaviour where you get the whole file included at 
that point, you can use \processdataset to iterate through the whole set. 
Unfortunately, it's not very well documented in the Wiki. You need to use a 
setup to do the formatting, so something like:

  \startsetups[formatA]
\startitemize
  \item \datasetentry{name} \datasetentry{desc}
\stopitemize
  \stopsetups

  \processdataset[animals][formatA]

Even this might not be right because it does the \startitemize ... \stopitemize 
once per database entry. You probably only want that done once for all the rows 
in fileA.

If you can fix the MWE then we can probably h

[NTG-context] Re: Table and rotation: push together 45 degree rotated cells

2024-09-19 Thread Gerion Entrup
Am Donnerstag, 19. September 2024, 09:35:49 MESZ schrieb Hans Hagen via 
ntg-context:
> On 9/19/2024 7:54 AM, Mikael Sundqvist wrote:
> > Hi,
> > 
> > On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup  
> > wrote:
> >>
> >> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> >>> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> >>>> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >>>>> Hi,
> >>>>>
> >>>>> I want to typeset a table where some of the column headings are really 
> >>>>> long, while in the columns itself consists only of numbers.
> >>>>> Therefore, my idea was to rotate the column headings but not 90 degrees 
> >>>>> (I found some solutions for that) but 45 degree.
> >>>>>
> >>>>> It then would be beneficial to push together the rotated cells, so the 
> >>>>> text of one cell actually starts above the previous cell.
> >>>>> Do you know, how to achieve that?
> >>>>>
> >>>>> Here is a minimal example:
> >>>>> ```
> >>>>> \startsetups[table:rotated]
> >>>>> \setupTABLE[frame=off]
> >>>>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, 
> >>>>> low}]
> >>>>> \setupTABLE[row][2][align=flushright]
> >>>>> \stopsetups
> >>>>>
> >>>>> \starttext
> >>>>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >>>>> \bTABLE[setups=table:rotated]
> >>>>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> >>>>> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> >>>>> turtle dove} \eTD \eTR
> >>>>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} 
> >>>>> \eTD \bTD \digits{2} \eTD \eTR
> >>>>> \eTABLE
> >>>>> \stoptext
> >>>>> ```
> >>>>> I would like to achieve that the text "Mexican redknee tarantula" is 
> >>>>> typeset right and above of "Water buffalo" so that the single columns 
> >>>>> have a width that is similar to the width of the single digit coming in 
> >>>>> the second row.
> >>>>
> >>>> To visualize this, I patched the PDF of the above example to the desired 
> >>>> result. See the attachment.
> >>>
> >>> You can use Metapost.
> >>
> >> Thanks for this solution. It, however, seems to fail with any other angle 
> >> than 315° (I tested 305, 325 and 314).
> > 
> > Try
> > 
> >
> > xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});
> > 
> > with sind instead of sin. And maybe with abs around it, but one can
> > think of improvements for smaller angles. It all depends on what one
> > wants.
> 
> here is an alternative
> 
> \bTABLE[frame=off]
>\bTR[align={middle,low}]
>  \bTH \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> Water buffalo}\hss} \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> Mexican redknee tarantula}\hss} \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> European turtle dove}\hss} \eTH
>\eTR
>\bTR[frame=on,align=middle]
>  \bTD Amount of legs \eTD
>  \bTD[width=3em] 4 \eTD
>  \bTD[width=3em] 8 \eTD
>  \bTD[width=3em] 2 \eTD
>\eTR
> \eTABLE

What is the meaning of \hss here? It seems to work just fine without it.

Gerion



signature.asc
Description: This is a digitally signed message part.
___
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: Table and rotation: push together 45 degree rotated cells

2024-09-19 Thread Hans Hagen via ntg-context

On 9/19/2024 7:54 AM, Mikael Sundqvist wrote:

Hi,

On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup  wrote:


Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:

Gerion Entrup schrieb am 18.09.2024 um 14:44:

Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:

Hi,

I want to typeset a table where some of the column headings are really long, 
while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 degrees (I 
found some solutions for that) but 45 degree.

It then would be beneficial to push together the rotated cells, so the text of 
one cell actually starts above the previous cell.
Do you know, how to achieve that?

Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
\setupTABLE[row][2][align=flushright]
\stopsetups

\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
\tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle 
dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
\bTD \digits{2} \eTD \eTR
\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is typeset right and 
above of "Water buffalo" so that the single columns have a width that is similar to the 
width of the single digit coming in the second row.


To visualize this, I patched the PDF of the above example to the desired 
result. See the attachment.


You can use Metapost.


Thanks for this solution. It, however, seems to fail with any other angle than 
315° (I tested 305, 325 and 314).


Try

   
xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});

with sind instead of sin. And maybe with abs around it, but one can
think of improvements for smaller angles. It all depends on what one
wants.


here is an alternative

\bTABLE[frame=off]
  \bTR[align={middle,low}]
\bTH \eTH
\bTH 
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
Water buffalo}\hss} \eTH
\bTH 
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
Mexican redknee tarantula}\hss} \eTH
\bTH 
\dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
European turtle dove}\hss} \eTH

  \eTR
  \bTR[frame=on,align=middle]
\bTD Amount of legs \eTD
\bTD[width=3em] 4 \eTD
\bTD[width=3em] 8 \eTD
\bTD[width=3em] 2 \eTD
  \eTR
\eTABLE

and yes, i needed to trial and error a bit,

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Mikael Sundqvist
Hi,

On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup  wrote:
>
> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> > Gerion Entrup schrieb am 18.09.2024 um 14:44:
> > > Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> > >> Hi,
> > >>
> > >> I want to typeset a table where some of the column headings are really 
> > >> long, while in the columns itself consists only of numbers.
> > >> Therefore, my idea was to rotate the column headings but not 90 degrees 
> > >> (I found some solutions for that) but 45 degree.
> > >>
> > >> It then would be beneficial to push together the rotated cells, so the 
> > >> text of one cell actually starts above the previous cell.
> > >> Do you know, how to achieve that?
> > >>
> > >> Here is a minimal example:
> > >> ```
> > >> \startsetups[table:rotated]
> > >>\setupTABLE[frame=off]
> > >>\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> > >>\setupTABLE[row][2][align=flushright]
> > >> \stopsetups
> > >>
> > >> \starttext
> > >> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> > >> \bTABLE[setups=table:rotated]
> > >>\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> > >> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> > >> turtle dove} \eTD \eTR
> > >>\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} 
> > >> \eTD \bTD \digits{2} \eTD \eTR
> > >> \eTABLE
> > >> \stoptext
> > >> ```
> > >> I would like to achieve that the text "Mexican redknee tarantula" is 
> > >> typeset right and above of "Water buffalo" so that the single columns 
> > >> have a width that is similar to the width of the single digit coming in 
> > >> the second row.
> > >
> > > To visualize this, I patched the PDF of the above example to the desired 
> > > result. See the attachment.
> >
> > You can use Metapost.
>
> Thanks for this solution. It, however, seems to fail with any other angle 
> than 315° (I tested 305, 325 and 314).

Try

  
xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});

with sind instead of sin. And maybe with abs around it, but one can
think of improvements for smaller angles. It all depends on what one
wants.

/Mikael
___
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: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Gerion Entrup
Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> > Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >> Hi,
> >>
> >> I want to typeset a table where some of the column headings are really 
> >> long, while in the columns itself consists only of numbers.
> >> Therefore, my idea was to rotate the column headings but not 90 degrees (I 
> >> found some solutions for that) but 45 degree.
> >>
> >> It then would be beneficial to push together the rotated cells, so the 
> >> text of one cell actually starts above the previous cell.
> >> Do you know, how to achieve that?
> >>
> >> Here is a minimal example:
> >> ```
> >> \startsetups[table:rotated]
> >>\setupTABLE[frame=off]
> >>\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> >>\setupTABLE[row][2][align=flushright]
> >> \stopsetups
> >>
> >> \starttext
> >> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >> \bTABLE[setups=table:rotated]
> >>\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> >> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> >> turtle dove} \eTD \eTR
> >>\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
> >> \bTD \digits{2} \eTD \eTR
> >> \eTABLE
> >> \stoptext
> >> ```
> >> I would like to achieve that the text "Mexican redknee tarantula" is 
> >> typeset right and above of "Water buffalo" so that the single columns have 
> >> a width that is similar to the width of the single digit coming in the 
> >> second row.
> > 
> > To visualize this, I patched the PDF of the above example to the desired 
> > result. See the attachment.
> 
> You can use Metapost.

Thanks for this solution. It, however, seems to fail with any other angle than 
315° (I tested 305, 325 and 314).


> \startuseMPgraphic{tableheader}{text,rotation}
> 
>label.lft("\strut\bf\MPvar{text}",origin)
>  rotated \MPvar{rotation}
>  shifted (\the\strutht,0);

I guess, this one actually draws the text...


>setbounds currentpicture to unitsquare
>  
> xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});

and this one calculates the faked width. Doesn't the sinus here calculate the 
height of the rotated text?

Beside from using Metapost (since I currently do not understand it and would 
only be able to copy paste your code), is there some kind of box construct 
which artificially reduces the width of the inner content?
I would have expected something like \fakewidth[width=1cm, 
align=flushright]{\rotate[rotation=-45, location=high]{A really long text, much 
longer than 1cm}}.
If I see it right, such a construct would also solve the problem, while less 
cleaner due to the fixed width.


Gerion




signature.asc
Description: This is a digitally signed message part.
___
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: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Hans Hagen

On 9/18/2024 10:53 PM, Wolfgang Schuster wrote:

Gerion Entrup schrieb am 18.09.2024 um 14:44:

Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:

Hi,

I want to typeset a table where some of the column headings are 
really long, while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 
degrees (I found some solutions for that) but 45 degree.


It then would be beneficial to push together the rotated cells, so 
the text of one cell actually starts above the previous cell.

Do you know, how to achieve that?

Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, 
low}]

\setupTABLE[row][2][align=flushright]
\stopsetups

\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
\tablerotate{Mexican redknee tarantula} \eTD \bTD 
\tablerotate{European turtle dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD 
\digits{8} \eTD \bTD \digits{2} \eTD \eTR

\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is 
typeset right and above of "Water buffalo" so that the single columns 
have a width that is similar to the width of the single digit coming 
in the second row.


To visualize this, I patched the PDF of the above example to the 
desired result. See the attachment.


You can use Metapost.

\startuseMPgraphic{tableheader}{text,rotation}

   label.lft("\strut\bf\MPvar{text}",origin)
     rotated \MPvar{rotation}
     shifted (\the\strutht,0);

   setbounds currentpicture to unitsquare

xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});

\stopuseMPgraphic

\starttext

\bTABLE[frame=off]
   \bTR[align={middle,low}]
     \bTH \eTH
     \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader} 
{text=Water buffalo,rotation=315} \eTH
     \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader} 
{text=Mexican redknee tarantula,rotation=315} \eTH
     \bTH[width=3em] \dontleavehmode\useMPgraphic{tableheader} 
{text=European turtle dove,rotation=315} \eTH

   \eTR
   \bTR[topframe=on,align=middle]
     \bTD Amount of legs \eTD
     \bTD 4 \eTD
     \bTD 8 \eTD
     \bTD 2 \eTD
   \eTR
\eTABLE

\stoptext


Neat. Added to the test suite.

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Wolfgang Schuster

Gerion Entrup schrieb am 18.09.2024 um 14:44:

Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:

Hi,

I want to typeset a table where some of the column headings are really long, 
while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 degrees (I 
found some solutions for that) but 45 degree.

It then would be beneficial to push together the rotated cells, so the text of 
one cell actually starts above the previous cell.
Do you know, how to achieve that?

Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
\setupTABLE[row][2][align=flushright]
\stopsetups

\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
\tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle 
dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
\bTD \digits{2} \eTD \eTR
\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is typeset right and 
above of "Water buffalo" so that the single columns have a width that is similar to the 
width of the single digit coming in the second row.


To visualize this, I patched the PDF of the above example to the desired 
result. See the attachment.


You can use Metapost.

\startuseMPgraphic{tableheader}{text,rotation}

  label.lft("\strut\bf\MPvar{text}",origin)
rotated \MPvar{rotation}
shifted (\the\strutht,0);

  setbounds currentpicture to unitsquare

xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});

\stopuseMPgraphic

\starttext

\bTABLE[frame=off]
  \bTR[align={middle,low}]
\bTH \eTH
\bTH[width=3em] 
\dontleavehmode\useMPgraphic{tableheader}{text=Water 
buffalo,rotation=315} \eTH
\bTH[width=3em] 
\dontleavehmode\useMPgraphic{tableheader}{text=Mexican redknee 
tarantula,rotation=315} \eTH
\bTH[width=3em] 
\dontleavehmode\useMPgraphic{tableheader}{text=European turtle 
dove,rotation=315} \eTH

  \eTR
  \bTR[topframe=on,align=middle]
\bTD Amount of legs \eTD
\bTD 4 \eTD
\bTD 8 \eTD
\bTD 2 \eTD
  \eTR
\eTABLE

\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: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Gerion Entrup
Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> Hi,
> 
> I want to typeset a table where some of the column headings are really long, 
> while in the columns itself consists only of numbers.
> Therefore, my idea was to rotate the column headings but not 90 degrees (I 
> found some solutions for that) but 45 degree.
> 
> It then would be beneficial to push together the rotated cells, so the text 
> of one cell actually starts above the previous cell.
> Do you know, how to achieve that?
> 
> Here is a minimal example:
> ```
> \startsetups[table:rotated]
>   \setupTABLE[frame=off]
>   \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
>   \setupTABLE[row][2][align=flushright]
> \stopsetups
> 
> \starttext
> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> \bTABLE[setups=table:rotated]
>   \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> turtle dove} \eTD \eTR
>   \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
> \bTD \digits{2} \eTD \eTR
> \eTABLE
> \stoptext
> ```
> I would like to achieve that the text "Mexican redknee tarantula" is typeset 
> right and above of "Water buffalo" so that the single columns have a width 
> that is similar to the width of the single digit coming in the second row.

To visualize this, I patched the PDF of the above example to the desired 
result. See the attachment.


> Another question in this context: Is is possible to specify a \setupTABLE 
> command that works for column 2-4 starting from row 2?
> Something like \setupTABLE[row][2-][column][2,3,4][background=color, 
> backgroundcolor=red].
> In this example this would cover all numbers but nothing else.
> 
> Best
> Gerion



mwe.fixed.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
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] Table and rotation: push together 45 degree rotated cells

2024-09-17 Thread Gerion Entrup
Hi,

I want to typeset a table where some of the column headings are really long, 
while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 degrees (I 
found some solutions for that) but 45 degree.

It then would be beneficial to push together the rotated cells, so the text of 
one cell actually starts above the previous cell.
Do you know, how to achieve that?

Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
\setupTABLE[row][2][align=flushright]
\stopsetups

\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
\tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle 
dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
\bTD \digits{2} \eTD \eTR
\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is typeset 
right and above of "Water buffalo" so that the single columns have a width that 
is similar to the width of the single digit coming in the second row.

Another question in this context: Is is possible to specify a \setupTABLE 
command that works for column 2-4 starting from row 2?
Something like \setupTABLE[row][2-][column][2,3,4][background=color, 
backgroundcolor=red].
In this example this would cover all numbers but nothing else.

Best
Gerion

signature.asc
Description: This is a digitally signed message part.
___
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] (ConTeXt LMTX 2.11.05) how do I make it so that sections, descriptions, and itemizations have just a space between some of the text that they produce

2024-09-16 Thread Felix
\setuppapersize[letter][letter]

\setupalign[normal]

\setuplayout[
backspace=0.5in,
topspace=0.0in,
header=.5in, % No headers
footer=.5in, % Space for the footer
width=middle,
height=middle,
]

\definefontfeature[timesfeatures][default][
trep=yes, % Enables single and double quotes to show up correctly in text, 
perhaps does more
dlig=yes,
% cpsp=yes, use for all caps only
]

\definefontfamily [myfonts] [rm][Times New Roman] 
[features=timesfeatures] % dlig enables times new roman ligatures, and cpsp is 
used by tnr, not aptos

\setupbodyfont[myfonts,12pt]

\mainlanguage[en-us]

\setupindenting[yes,0.5in]

\definedescription[description]

\setupdescription[description][
alternative=serried,
headstyle=bold,
style=normal,
width=broad,
before=,
after=,
]

\setupheads[indentnext=yes] % To get indentation after section numbers, use this

\setuphead[section][
sectionstopper={.}, % Add period after numbers
conversion=R,
before=,
after=,
style=sc, % Small caps style
align=middle, % Center the section titles
]

\startsetups document:start
\centerline{\documentvariable{title}}
\centerline{\documentvariable{author}}
\centerline{\documentvariable{date}}
\blank[line]
\stopsetups

\startdocument[
title={Chapter 4 Quiz},
author={Author},
date={September 16, 2024}
]

\startitemgroup[itemize][n]
\startitem
I'm not a fan of the default spacing
\stopitem
\stopitemgroup

\startdescription{I'm not a fan of the}
default spacing
\stopdescription

\startsection[title={I'm not a fan of the}]
default spacing
\stopsection

\stopdocument

This code shows how I am getting the default spacing between the words from 
itemize, description, and the spacing between the roman numeral and the section 
title. I tried figuring out how to get the spacing for all of these to be set 
to a single space worth but it seems to not be possible with `distance`, 
because it asks for a dimension. How can I get a `\space`'s worth of spacing to 
be the default in descriptions, itemizations, and sections? for itemizations 
and descriptions the spacing seems to vary and I really don't like that. I 
would be thankful to know if there's a way to change the spacing.
___
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 do I get roman numerals in all numerable sections with no extra spacing after the period (would appreciate condensed code/simplification) (I read documentation but did not get an

2024-08-22 Thread Hraban Ramm

Felix,

your example contains a lot that is not relevant to your question. Try 
to reduce it.


For number types, use the "conversion" option, for Roman numerals, there 
are the values r, R, RK, or (lowercase, uppercase, small caps, with 
bars). See also https://wiki.contextgarden.net/Command/convertnumber


Any "command" options accepts the name of a macro, "numbercommand" needs 
a macro with one parameter; don't try to call a macro here.


For the dot after the number, I'm not sure, try "sectionstopper={.}".

Hraban

Am 22.08.24 um 20:54 schrieb Felix:

\setuppapersize
[letter]
[letter]

\setuplayout[
  backspace=0.5in,
  topspace=0.5in,
  header=0in, % No headers
  footer=0in, % Space for the footer
  width=middle,
  height=middle,
]

\definefontfeature [default] [default] [trep=yes]

\definefontfamily [TimesNewRoman] [rm][Times New Roman]
\definetypeface   [TimesNewRoman] [mm] [math] [stixtwo]

\setupbodyfont [TimesNewRoman,12pt]

\mainlanguage[en-us]

\setupindenting[yes,0.5in]

\setupheads[indentnext=yes] % To get indentation after section numbers, use this

\setuphead[part][
   page=no,
   placehead=yes,
   numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[chapter][
   page=no,
   numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[section, subsection, subsubsection, subsubsubsection, 
subsubsubsubsection][
   numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[part, chapter, section, subsection, subsubsection, subsubsubsection, 
subsubsubsubsection, subject, subsubject, subsubsubject, subsubsubsubject, 
subsubsubsubsection][
   before=,
   after=,
   style=sc, % Small caps style
   align=middle, % Center the section titles
   ] % it seems that when I make this into setupheads and delete the first 
square braket set it will not result in what I want

\startsetups document:start
  \centerline{\documentvariable{title}}
  \centerline{\documentvariable{author}}
  \centerline{\documentvariable{date}}
  \blank[line]
\stopsetups

\startdocument[title=Title,author=Author,date=Date]

\startpart[title=one]

\stoppart

\startalignment[middle]

{\sc 1. one} % there is added space as shwon when trying to emulate what I want 
through regular text

\stopalignment

\startchapter[title=two]

\stopchapter

\startpart[title=three]

\stoppart

\startchapter[title=four]

\stopchapter

\startsubject[title=five]

\stopsubject

\stopdocument

with this code I'm trying to get it so that part, chapter, and the 5 section 
levels will have roman numerals. I read the docs but didn't get the result I 
wanted for roman numerals and can't seem to figure out how to get rid of the 
tiny space that is after the period in the section stuff. Would love an answer 
for this.
___
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
__
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] How do I get roman numerals in all numerable sections with no extra spacing after the period (would appreciate condensed code/simplification) (I read documentation but did not get any re

2024-08-22 Thread Felix
\setuppapersize
   [letter]
   [letter]

\setuplayout[
 backspace=0.5in,
 topspace=0.5in,
 header=0in, % No headers
 footer=0in, % Space for the footer
 width=middle,
 height=middle,
]

\definefontfeature [default] [default] [trep=yes]

\definefontfamily [TimesNewRoman] [rm][Times New Roman]
\definetypeface   [TimesNewRoman] [mm] [math] [stixtwo]

\setupbodyfont [TimesNewRoman,12pt]

\mainlanguage[en-us]

\setupindenting[yes,0.5in]

\setupheads[indentnext=yes] % To get indentation after section numbers, use this

\setuphead[part][
  page=no,
  placehead=yes,
  numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[chapter][
  page=no,
  numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[section, subsection, subsubsection, subsubsubsection, 
subsubsubsubsection][
  numbercommand=\groupedcommand{}{.} % Add period after numbers
]

\setuphead[part, chapter, section, subsection, subsubsection, subsubsubsection, 
subsubsubsubsection, subject, subsubject, subsubsubject, subsubsubsubject, 
subsubsubsubsection][
  before=,
  after=,
  style=sc, % Small caps style
  align=middle, % Center the section titles
  ] % it seems that when I make this into setupheads and delete the first 
square braket set it will not result in what I want

\startsetups document:start
 \centerline{\documentvariable{title}}
 \centerline{\documentvariable{author}}
 \centerline{\documentvariable{date}}
 \blank[line]
\stopsetups

\startdocument[title=Title,author=Author,date=Date]

\startpart[title=one]

\stoppart

\startalignment[middle]

{\sc 1. one} % there is added space as shwon when trying to emulate what I want 
through regular text

\stopalignment

\startchapter[title=two]

\stopchapter

\startpart[title=three]

\stoppart

\startchapter[title=four]

\stopchapter

\startsubject[title=five]

\stopsubject

\stopdocument

with this code I'm trying to get it so that part, chapter, and the 5 section 
levels will have roman numerals. I read the docs but didn't get the result I 
wanted for roman numerals and can't seem to figure out how to get rid of the 
tiny space that is after the period in the section stuff. Would love an answer 
for this.
___
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: Probably a very simple question, but how do I get a page number to be centered, at the bottom and vertically in the middle whilst having my doc margins?

2024-08-19 Thread Felix
Hello mikail, I would send a picture to be more clear with what I want but it 
seems to not be possible, what adding the footer=.5in code does is simply take 
away .5in from the bottom margin, what I mean is that The bottom margin really 
just becomes 1in because the footer takes up .5in from the margin setting, 

```
\setuppapersize
   [letter]
   [letter]

\setuplayout[
 backspace=0.5in,
 topspace=0.5in,
 header=0in, % No headers
 footer=.5in, % Space for the footer
 width=middle,
 height=middle,
]

\setuppagenumbering
  [location=footer]

\showframe


\definefontfeature [default] [default] [trep=yes]

\definefontfamily [TimesNewRoman] [rm][Times New Roman]
\definetypeface   [TimesNewRoman] [mm] [math] [stixtwo]

\setupbodyfont [TimesNewRoman,12pt]

\mainlanguage[en-us]

\setupindenting[yes,0.5in]

\setupheads[indentnext=yes] % To get indentation after section numbers, use this

\startsetups document:start
 \centerline{\documentvariable{title}}
 \centerline{\documentvariable{author}}
 \centerline{\documentvariable{date}}
 \blank[line]
\stopsetups

\startdocument[title=Title,author=Author,date=Date]



\stopdocument 
```

I hope this better explains what I am trying to achieve
___
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: Complete novice, why does it seem that LuaLaTeX (Compiled via LaTeX Workshop with MikTeX and added packages on Windows) will generate a more compact result than ConTeXt?

2024-08-13 Thread Hans Hagen via ntg-context

On 8/13/2024 4:49 PM, fm117...@students.panola.edu wrote:

Hello, ConTeXt mailing list! I have a question regarding a difference in the code that I have which 
uses the same paper size and margin settings, and also the same indentation rules and font size and 
font. It seems that ConTeXt (which I compiled via Windows Terminal, this *is* the proper way to 
compile ConTeXt docs, right?) seems to make text that is less... compact, and I am not sure if this 
is due to me not adding features that I **should** have turned on in ConTeXt when using Times New 
Roman that is installed by default on Windows. I also was not able to get a "proper (?)" 
single quote like when Word or LaTeX compiles "Don't", that ' is a straight quote in the 
compiled text.

I also heard that ConTeXT would be much better for typography since it does have a more 
advanced typographical engine as the base (and this is a big reason as to why I want to 
switch to ConTeXt, pretty much everything is built in, I just can't understand 
documentation that well), and this may be because my code is very basic and I do not know 
how do properly do ConTeXt. Is it possible that ConTeXt also has a more 
"correct" way of formatting? Anyways, thank you for reading and taking the time 
to read this post.

LuaLaTeX code: https://pastebin.com/p5aWxAyK

ConTeXt code: https://pastebin.com/DsMnxMvY
Can you explain what you mean with less compact? Can we assume that you 
are running the LMTX version? (luametatex engine)


\showframe

\setuppapersize
  [letter]
  [letter]

\setuplayout[
backspace=0.5in,
topspace=0.5in,
header=0in, % No headers
footer=0in, % Space for the footer
width=middle,
height=middle,
]

\setupbodyfont[termes,12pt]

\mainlanguage[en]

\setupindenting[yes,0.5in]

\startsetups document:start
\centerline{\documentvariable{title}}
\centerline{\documentvariable{author}}
\centerline{\documentvariable{date}}
\blank[line]
\stopsetups

\startdocument[title=Title,author=Author,date=Date]

...

\stopdocument


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

maillist : ntg-context@ntg.nl / 
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: Nāgarī for Academics

2024-08-10 Thread Jürgen Hanneder via ntg-context



Does it work if you say

{\language[sa]yoga}


That's it!!

Together with Wolfgang's patient corrections, I now have a version  
that works. Here again, for the record:


-
\definefallbackfamily [Roman] [rm] [Adishila]  
[range=devanagari,features=devanagari-one]

\definefontfamily [Roman] [rm] [Minion Pro]

\setupbodyfont [Roman]

\definefontfamily [nagari] [rm] [Adishila] [features=devanagari-one]

\usetransliteration[indic]

\definetransliteration [MyDeva] [lang=sa,vector={iast to deva}]

\startsetups [sanskrit]
  \settransliteration[MyDeva]
  \switchtobodyfont[nagari]
\stopsetups

\setuplanguage [sa] [setups=sanskrit]

\starttext

Example: आनन्द

Example: {\language[sa]yoga}

yoga, (in roman again)

\stoptext
--







---

Prof. Dr. Juergen Hanneder
Philipps-Universitaet Marburg
FG Indologie u. Tibetologie
Deutschhausstr.12
35032 Marburg
Germany
Tel. 0049-6421-28-24930
hanne...@staff.uni-marburg.de

___
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: Nāgarī for Academics

2024-08-10 Thread Wolfgang Schuster

Jürgen Hanneder via ntg-context schrieb am 10.08.2024 um 11:10:

Dear Richard,


Are you after a Context version of something such as
Xetex Devanagari?

https://github.com/wujastyk/xetex-devanagari


Indeed. In my XeTeX publications settling the font was quite 
straightforward:


\usepackage{polyglossia,fontspec,xunicode}
\setmainfont{Adobe Text Pro}
\newfontfamily\sanskritfont[Script=Devanagari,Mapping=RomDev,Scale=1.4]{AdishilaSan} 


\setdefaultlanguage{english} \setotherlanguage{sanskrit}


But coming back to ConTeXt:

I am grateful to Pablo and Wolfgang for their suggestions, but
it does not (yet) work as it should. Perhaps this has to do
with the problem in the language command. Here is my test file that
works up to the point, and then shows the problem.

---
\setuppapersize[A4]
\setuplayout[width=14cm, height=fit]

\definefontfamily [roman] [rm] [minion]


You set a font here for english text but never enable it.


\definefontfamily [nagari] [rm] [Adishila] [features=devanagari-one]
\setupbodyfont [nagari]


This is where you set the font for the whole document.


\usetransliteration[indic]
\definetransliteration
[MyDeva]   [lang=sa,vector={iast to deva}]

\startsetups [sanskrit]
\settransliteration[MyDeva]
\switchtobodyfont[nagari]
\stopsetups

\setuplanguage [sa] [setups=sanskrit]

\starttext

Example:   आनन्द। अपिच   % this comes out as it should, but since 
input is in Nagari there is no transliteration involved.
test  % the word "test" comes 
out in roman, i.e. switching back to roman works.


\language[sa]{yoga}    % the word "yoga" is typeset in 
Nagari as expected,
test  % but the word 
"test" is still typeset in Nagari


\language[en]{test}    % still no switching back to 
roman, it seems stuck with Nagari.


\stoptext
-


\definefallbackfamily [Roman] [rm] [Adishila] 
[range=devanagari,features=devanagari-one]

\definefontfamily [Roman] [rm] [Minion Pro]

\setupbodyfont [Roman]

\definefontfamily [nagari] [rm] [Adishila] [features=devanagari-one]

\usetransliteration[indic]

\definetransliteration [MyDeva] [lang=sa,vector={iast to deva}]

\startsetups [sanskrit]
  \settransliteration[MyDeva]
  \switchtobodyfont[nagari]
\stopsetups

\setuplanguage [sa] [setups=sanskrit]

\starttext

Example: आनन्द। अपिच

Example: \language[sa]{yoga}

\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: Nāgarī for Academics

2024-08-10 Thread Jürgen Hanneder via ntg-context

Dear Richard,


Are you after a Context version of something such as 
Xetex Devanagari?

https://github.com/wujastyk/xetex-devanagari


Indeed. In my XeTeX publications settling the font was quite straightforward:

\usepackage{polyglossia,fontspec,xunicode}
\setmainfont{Adobe Text Pro}
\newfontfamily\sanskritfont[Script=Devanagari,Mapping=RomDev,Scale=1.4]{AdishilaSan}
\setdefaultlanguage{english} \setotherlanguage{sanskrit}


But coming back to ConTeXt:

I am grateful to Pablo and Wolfgang for their suggestions, but
it does not (yet) work as it should. Perhaps this has to do
with the problem in the language command. Here is my test file that
works up to the point, and then shows the problem.

---
\setuppapersize[A4]
\setuplayout[width=14cm, height=fit]

\definefontfamily [roman] [rm] [minion]

\definefontfamily [nagari] [rm] [Adishila] [features=devanagari-one]
\setupbodyfont [nagari]

\usetransliteration[indic]
\definetransliteration
[MyDeva]   [lang=sa,vector={iast to deva}]

\startsetups [sanskrit]
\settransliteration[MyDeva]
\switchtobodyfont[nagari]
\stopsetups

\setuplanguage [sa] [setups=sanskrit]

\starttext

Example:   आनन्द। अपिच   % this comes out as it should, but since  
input is in Nagari there is no transliteration involved.
test  % the word "test" comes  
out in roman, i.e. switching back to roman works.


\language[sa]{yoga}% the word "yoga" is typeset in  
Nagari as expected,
test  % but the word  
"test" is still typeset in Nagari


\language[en]{test}% still no switching back to  
roman, it seems stuck with Nagari.


\stoptext
-

Jürgen





---

Prof. Dr. Juergen Hanneder
Philipps-Universitaet Marburg
FG Indologie u. Tibetologie
Deutschhausstr.12
35032 Marburg
Germany
Tel. 0049-6421-28-24930
hanne...@staff.uni-marburg.de

___
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: Nāgarī for Academics

2024-08-08 Thread Wolfgang Schuster

Jürgen Hanneder via ntg-context schrieb am 08.08.2024 um 13:07:

The text below works, thanks for the help!

But there is one more problem.

I could not find an elegant method to set the language of the document 
to English without
disabling Nagari. If one adds \setupbodyfont[minion] the Nagari parts 
disappear.


The normal scenario would be a document in English with Sanskrit as a 
secondary language, to
one switches with a command that changes font, language and activates 
the transliteration

mechanism.


You can put all settings (fonts, transliteration etc.) you need for your 
sanskrit texts
in a setups blocks and apply the block to a language. When you use now 
the \language

command (or environment) all settings are now applied to the content.

Below is a untested example.

\definefontfamily [nagari] [rm] [adishila] [features=devanagari-one]

\usetransliteration[indic]

\definetransliteration
  [MyDeva]
  [lang=sa,
   vector={iast to deva}]

\startsetups [sanskrit]
  \settransliteration[MyDeva]
  \switchtobodyfont[nagari]
\stopsetups

\setuplanguage [sa] [setups=sanskrit]

\starttext

\subject{Some notes on Printing Sanskrit with lmtx}

\language[sa]{योग} -- That is the word Yoga, input and, when you compile 
this document,

printed in (Deva)Nagari script.

\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] About a pagination

2024-07-23 Thread Fabrice Couvreur
Hi,
I'm trying to get the same pagination as in the attached photos. Using the
wiki and Wolfgang's codes I get something interesting but not very elegant
(\ACFRAME{}). Only, I don't see how to emphasize the title of each chapter
in the same way.
Thanks.
Fabrice

\startcomponent[essai]

\setuplayout
  [
backspace=28mm,
topspace=35mm,
width=140mm
  ]

\setuppagenumbering[alternative=doublesided,location=]

\setupbodyfont[pagella,11pt]

\mainlanguage[fr]

\setcharacterspacing
  [frenchpunctuation]

\startuseMPgraphic{acframeleft}
 fill OverlayBox
 leftenlarged (BackSpace)
 rightenlarged 5mm
 withcolor "lightgray";
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
   [acframeleft]
   [\useMPgraphic{acframeleft}]


\defineframed
   [ACFRAMELEFT]
   [frame=off,
width=fit,
height=1ex,
background=acframeleft,
location=,
   ]

\startuseMPgraphic{acframeright}
 fill OverlayBox
 leftenlarged 5mm
 rightenlarged 42mm
 withcolor "lightgray";
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
   [acframeright]
   [\useMPgraphic{acframeright}]


\defineframed
   [ACFRAMERIGHT]
   [frame=off,
width=fit,
height=1ex,
background=acframeright,
location=hanging,
   ]

\setupheader[style=\tfx]

\startsetups [header:leftpage]
\setuplabeltext
 [fr]
 [chapter=\tfx Chapitre]
 \ACFRAMERIGHT{}
 \hfill
 \labeltext{chapter} \getmarking[chapternumber] \getmarking[chapter]
\stopsetups

\startsetups [header:rightpage]
\getmarking[sectionnumber]
\space
\getmarking[section]
\hfill
\ACFRAMERIGHT{}
\stopsetups

\setupheadertexts
 [\directsetup{header:rightpage}] [\prefixedpagenumber]
 [\prefixedpagenumber]  [\directsetup{header:leftpage}]



\defineframedtext
   [ChapterFrame]
   [frame=on,
width=local,
height=broad,
after={\blank[2*line]},
offset=0pt]


\startsetups [section:chapter]

\setuphead
   [chapter]
   [align=leftright,
textcommand=\groupedcommand{\blank[medium]}{},
numbercolor=,
textstyle=,
numberstyle=,
numbercommand=,
before=\startChapterFrame,
after=\stopChapterFrame,
header=nomarking]

\stopsetups

\startsectionblockenvironment [bodypart]
\directsetup{section:chapter}
\stopsectionblockenvironment

\doifmode{*component}{\directsetup{section:chapter}}

\setuplabeltext
   [fr]
   [chapter=\tf Chapitre\space]


\startchapter
  [title={Polynômes}]
  \startsection
[title={Forme réduite et identification}]
\dorecurse{6}{\input knuth}
  \stopsection
  \startsection
[title={Polynômes du second degré}]
  \dorecurse{6}{\input knuth}
  \stopsection
\stopchapter
\stopcomponent
___
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 specify a default formatting for TABLE

2024-07-01 Thread Gerion Entrup
Am Dienstag, 2. Juli 2024, 00:17:36 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.07.2024 um 23:56:
> > Hi,
> > 
> > I want to format a bunch a tables with the same formatting.
> > It seems that specifying the \setupTABLE commands as part of the preamble 
> > works.
> > 
> > However, I need some tables that are formatted in another way.
> > Is there a generic way to specify this?
> > 
> > Here is a MWE:
> > [...]
> > 
> > The last two tables should be formatted as if the four setupTABLE commands 
> > in the header are not existent.
> > My solution does not work, however.
> 
> 1. Put your table settings in a setups-block and load the one you want 
> at the start of your table.
> 
> 2. You don't need \setupcolors[state=start] because colors are enabled 
> by default (since a veee...eeery long time).
> 
> 3. You can replace \bTD ... \eTD with \bTH ... \eTH for table headers to 
> get bold text.
> 
>  begin example
> \startsetups[table:a]
>\setupTABLE [each] [frame=off,width=1cm,height=1cm,align={middle,lohi}]
>\setupTABLE [each] [background=color,backgroundcolor=lightgray]
> \stopsetups
> 
> \startsetups[table:b]
>\setupTABLE [each] 
> [frame=off,width=2cm,height=1.2\lineheight,align=middle]
>\setupTABLE [each] [topframe=on,bottomframe=on]
> \stopsetups
> 
> \starttext
> 
> \bTABLE
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \blank
> 
> \bTABLE[setups=table:a]
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \blank
> 
> \bTABLE[setups=table:b]
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \stoptext
>  end example
> 
> Wolfgang

Thank you very much! That are a bunch of nice tricks. The setups environment is 
really powerful.
I will actively search for this keyword in the documentation next time.

Gerion





signature.asc
Description: This is a digitally signed message part.
___
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 specify a default formatting for TABLE

2024-07-01 Thread Wolfgang Schuster

Gerion Entrup schrieb am 01.07.2024 um 23:56:

Hi,

I want to format a bunch a tables with the same formatting.
It seems that specifying the \setupTABLE commands as part of the preamble works.

However, I need some tables that are formatted in another way.
Is there a generic way to specify this?

Here is a MWE:
[...]

The last two tables should be formatted as if the four setupTABLE commands in 
the header are not existent.
My solution does not work, however.


1. Put your table settings in a setups-block and load the one you want 
at the start of your table.


2. You don't need \setupcolors[state=start] because colors are enabled 
by default (since a veee...eeery long time).


3. You can replace \bTD ... \eTD with \bTH ... \eTH for table headers to 
get bold text.


 begin example
\startsetups[table:a]
  \setupTABLE [each] [frame=off,width=1cm,height=1cm,align={middle,lohi}]
  \setupTABLE [each] [background=color,backgroundcolor=lightgray]
\stopsetups

\startsetups[table:b]
  \setupTABLE [each] 
[frame=off,width=2cm,height=1.2\lineheight,align=middle]

  \setupTABLE [each] [topframe=on,bottomframe=on]
\stopsetups

\starttext

\bTABLE
  \bTR
\bTD A \eTD
\bTD B \eTD
  \eTR
  \bTR
\bTD C \eTD
\bTD D \eTD
  \eTR
\eTABLE

\blank

\bTABLE[setups=table:a]
  \bTR
\bTD A \eTD
\bTD B \eTD
  \eTR
  \bTR
\bTD C \eTD
\bTD D \eTD
  \eTR
\eTABLE

\blank

\bTABLE[setups=table:b]
  \bTR
\bTD A \eTD
\bTD B \eTD
  \eTR
  \bTR
\bTD C \eTD
\bTD D \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: roman numerals frontpart

2024-06-25 Thread jbf

I have found the problem, but am still seeking a little help:

I had created a setup to raise the page number in the footer. Calling 
this setup resulted in the frontpart pages reverting to arabic instead 
of roman:


\startsetups pnfooter

\setuppagenumbering[alternative=doublesided,location=]

\setupfooter

  [style=normal]

  \setupfootertexts

  [{\framed[width=max,frame=off,boffset=2mm]{\pagenumber}}]

\stopsetups

How can I continue to use the setup but still get my roman numerals in 
the frontpart?

Julian

On 26/6/24 10:52, jbf wrote:


Something that has worked for me in the past is not working for me at 
the moment, and I cannot figure out why:


\startsectionblockenvironment [frontpart]
\setupuserpagenumber [numberconversion=romannumerals]
\setcounter [userpage] [5]
\stopsectionblockenvironment
\startsectionblockenvironment [bodypart]
\setcounter [userpage] [1]
\stopsectionblockenvironment

gives me roman numerals in the TOC but not on the frontmatter pages, 
which are arabic. Bodymatter is okay. What could I possibly be doing 
wrong?


Even with a different setup I get the same result:

\definestructureconversionset [frontpart:pagenumber] [] [romannumerals]
\setupheads[title][sectionconversionset=section]
\startsectionblockenvironment[frontpart]
\setupuserpagenumber[numberconversion=romannumerals]
\setuppagenumber[number=1]
\stopsectionblockenvironment

Puzzling (for me at least).

Julian
___
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: Specify separator within setupbtx for custom bibliography rendering

2024-06-21 Thread Gerion Entrup
Am Samstag, 1. Juni 2024, 16:16:38 MESZ schrieb Gerion Entrup:
> Hi,
> 
> according to the section "Custom citation renderings" in the bibliography 
> manual, I have specified an own setup for citation rendering.
> However, this seems only to work for single citations (of one source). I want 
> to also specify the separator but did not get it to run.
> 
> Here is a minimal example:
> ```
> \setupinteraction[state=start]
> 
> \startbuffer[testdata]
> @Book{knuth1,
>   author = {Donald E. Knuth},
>   title = {TEX and METAFONT. New directions in typesetting},
>   year = {1979},
>   publisher = {Addison-Wesley},
> }
> @Article{someother,
>   author = {Some Person and Some Otherperson},
>   title = {Another title},
>   year = {1900},
> }
> \stopbuffer
> 
> % enable tracing
> \enabletrackers[publications, publications.crossref, publications.details, 
> publications.cite, publications.strings]
> 
> \usebtxdataset[main][testdata.buffer]
> \usebtxdefinitions[aps]
> \setupbtx[dataset=main]
> \definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
> \setupbtxlist[aps][
>   alternative=b,
>   distance=.5em,
> ]
> 
> \definebtx[aps:cite:special][aps:cite][
>   left={((},
>   right={))},
>   separator:2={sfd},
>   separator:3={sfd},
>   separator:4={sfd},
> ]
> 
> \startsetups btx:aps:cite:special
>   % just a dummy
>   \btxcitereference
>   \currentbtxtag
> \stopsetups
> 
> \setupbtx[aps:cite][
>   alternative=special,
> ]
> 
> \starttext
> 
> Both said something~\cite[knuth1, someother].
> 
> \placelistofpublications[bibrendering]
> 
> \stoptext
> ```
> 
> The output of this is:
> 
> > Both said something ((knuth1someother)).
> 
> How can I get the separator to work? My expectation would be:
> 
> > Both said something ((knuth1sfdsomeother)).
> 
> or
> 
> > Both said something ((knuth1sfd someother)).

I got some understanding of the underlying code now.
This setup solves the above issue:

```
\startsetups btx:aps:cite:special
% just a dummy
\fastsetup{btx:cite:concat}
\btxcitereference
\currentbtxtag
\stopsetups
```

Gerion


signature.asc
Description: This is a digitally signed message part.
___
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: \brokenpenalties query

2024-06-20 Thread Mikael Sundqvist
Hi again,

in fact, the \brokenpenalties is new. So using \setpenalties on it in
the past did not do anything, since \ifdefined#1 would never be
true...

/Mikael

On Wed, Jun 19, 2024 at 4:45 PM Hans Hagen via ntg-context
 wrote:
>
> On 6/19/2024 4:06 PM, Mikael Sundqvist wrote:
> > Hi,
> >
> > On Wed, Jun 19, 2024 at 3:40 PM Alan Bowen  > <mailto:bowenala...@gmail.com>> wrote:
> >
> > I have in the past relied on
> >  \setpenalties\brokenpenalties{1}{1}\
> > to set the penalty for a page break after a hyphen. But with the
> > latest LMTX, when I run the file, I get the error message
> > Error count has to be 1 for \brokenpenalties
> >
> > Any advice on how to fix the file would be most welcome.
> >
> > Alan
> >
> >
> > Probably only Hans (or Wolfgang) can give a complete answer here. But
> >
> > \startsetups [*default]
> >\directsetup{*reset}
> >\frozen\brokenpenalties 1 1\relax
> > \stopsetups
> >
> > works here.
> >
> > /Mikael
> currently \brokenpenalties only takes one setting
>
> \permanent\protected\def\setpenalties#1#2#3%
>{\ifdefined#1%
>   \frozen#1\ifx#1\brokenpenalties
> \plusone#3\relax
>   \else
> \numexpr#2+\plusone\relax\space\expandedrepeat\numexpr#2\relax
>   { #3}\zerocount\relax
>   \fi
> \fi}
>
> > PS
> >
> > An interesting new feature is the possibility to set penalties depending
> > on left and right page, by using options. For example
> >
> > \startsetups [*default]
> >\directsetup{*reset}
> >\frozen\clubpenalties   3 options 4 1500 3000 250 500 0 0 \relax
> > \stopsetups
> >
> > sets club club penalties 1500 for first line and 250 for second for
> > going from left page to right page (and then 0 for the rest) and 3000
> > for first line and 500 for second (and rest 0) for going from right page
> > to left page.
> >
> > I hope this helps a bit.
> >
> > ___
> > 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
> > ___
>
> --
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> 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
> ___
___
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: \brokenpenalties query

2024-06-19 Thread Hans Hagen via ntg-context

On 6/19/2024 4:06 PM, Mikael Sundqvist wrote:

Hi,

On Wed, Jun 19, 2024 at 3:40 PM Alan Bowen <mailto:bowenala...@gmail.com>> wrote:


I have in the past relied on
     \setpenalties\brokenpenalties{1}{1}\
to set the penalty for a page break after a hyphen. But with the
latest LMTX, when I run the file, I get the error message
Error   count has to be 1 for \brokenpenalties

Any advice on how to fix the file would be most welcome.

Alan


Probably only Hans (or Wolfgang) can give a complete answer here. But

\startsetups [*default]
   \directsetup{*reset}
   \frozen\brokenpenalties 1 1\relax
\stopsetups

works here.

/Mikael

currently \brokenpenalties only takes one setting

\permanent\protected\def\setpenalties#1#2#3%
  {\ifdefined#1%
 \frozen#1\ifx#1\brokenpenalties
   \plusone#3\relax
 \else
   \numexpr#2+\plusone\relax\space\expandedrepeat\numexpr#2\relax
 { #3}\zerocount\relax
 \fi
   \fi}


PS

An interesting new feature is the possibility to set penalties depending 
on left and right page, by using options. For example


\startsetups [*default]
   \directsetup{*reset}
   \frozen\clubpenalties   3 options 4 1500 3000 250 500 0 0 \relax
\stopsetups

sets club club penalties 1500 for first line and 250 for second for 
going from left page to right page (and then 0 for the rest) and 3000 
for first line and 500 for second (and rest 0) for going from right page 
to left page.


I hope this helps a bit.

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


--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

2024-06-19 Thread Mikael Sundqvist
Hi,

On Wed, Jun 19, 2024 at 3:40 PM Alan Bowen  wrote:

> I have in the past relied on
> \setpenalties\brokenpenalties{1}{1}\
> to set the penalty for a page break after a hyphen. But with the latest
> LMTX, when I run the file, I get the error message
> Errorcount has to be 1 for \brokenpenalties
> Any advice on how to fix the file would be most welcome.
>
> Alan
>

Probably only Hans (or Wolfgang) can give a complete answer here. But

\startsetups [*default]
  \directsetup{*reset}
  \frozen\brokenpenalties 1 1\relax
\stopsetups

works here.

/Mikael

PS

An interesting new feature is the possibility to set penalties depending on
left and right page, by using options. For example

\startsetups [*default]
  \directsetup{*reset}
  \frozen\clubpenalties   3 options 4 1500 3000 250 500 0 0 \relax
\stopsetups

sets club club penalties 1500 for first line and 250 for second for going
from left page to right page (and then 0 for the rest) and 3000 for first
line and 500 for second (and rest 0) for going from right page to left page.

I hope this helps a bit.
___
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-18 Thread Gerion Entrup
Am Montag, 17. Juni 2024, 21:20:19 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 17.06.2024 um 13:04:
> > Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> >> [...]
> >>
> >> Wolfgang
> >>
> > 
> > I tried to combine this with the code of the mail thread: "setuphead in 
> > connection with the command argument" but had not luck.
> > ConTeXt always stops with:
> > ```
> > close source> level 1, order 2, name './mwe.tex'
> > tex error   > runaway error: end of file encountered
> > mtx-context | fatal error: return code: 1
> > ```
> > 
> > Here is the MWE:
> > ```
> > [...]
> > 
> > \startsetups[my_chapter]
> > \startlocalheadsetup
> > \startframed[chapter_frame]
> > \blank[2cm]
> > \startfont[Serif sa 8]
> > \color[darkgray]{\headnumbercontent}
> > \stopfont
> > \blank[5mm]
> > \startfont[SerifBold sa 2]
> > \color[m-indigo-800]{\headtextcontent}
> > \stopfont
> > \blank[1cm]
> > \startfont[SerifBold sa 1.5]
> > 
> > \color[m-indigo-800]{\structureuservariable{subtitle}}
> > \stopfont
> > \blank[3cm]
> > 
> > \startextract[author={\structureuservariable{quoteauthor}}]
> > \structureuservariable{quote}
> > \stopextract
> > \stopframed
> > \stoplocalheadsetup
> > \stopsetups
> 
> The userdata environment uses the buffer mechanism of Context which has 
> a few limitations where you can use it, e.g. putting the environment in 
> the arguments of other commands (like the setup-environment above) 
> fails. One way to avoid this is to replace the \startextract ... 
> \stopextract in this case with the code for the quoted text, another way 
> is to put all content in a buffer and just load the buffer in the 
> setups-environment.
> 
> \startbuffer[my_chapter]
>   \startlocalheadsetup
>   \startframed[chapter_frame]
>   ...
>   \stopframed
>   \stoplocalheadsetup
> \stopbuffer
> 
> \startsetups[my_chapter]
>\getbuffer[my_chapter]
> \stopsetups
> 
> Wolfgang
> 

Thanks, I solved it by embedding the extract code directly (more less).

Gerion


signature.asc
Description: This is a digitally signed message part.
___
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-17 Thread Wolfgang Schuster

Gerion Entrup schrieb am 17.06.2024 um 13:04:

Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:

[...]

Wolfgang



I tried to combine this with the code of the mail thread: "setuphead in connection 
with the command argument" but had not luck.
ConTeXt always stops with:
```
close source> level 1, order 2, name './mwe.tex'
tex error   > runaway error: end of file encountered
mtx-context | fatal error: return code: 1
```

Here is the MWE:
```
[...]

\startsetups[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
\blank[2cm]
\startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
\stopfont
\blank[5mm]
\startfont[SerifBold sa 2]
\color[m-indigo-800]{\headtextcontent}
\stopfont
\blank[1cm]
\startfont[SerifBold sa 1.5]

\color[m-indigo-800]{\structureuservariable{subtitle}}
\stopfont
\blank[3cm]

\startextract[author={\structureuservariable{quoteauthor}}]
\structureuservariable{quote}
\stopextract
\stopframed
\stoplocalheadsetup
\stopsetups


The userdata environment uses the buffer mechanism of Context which has 
a few limitations where you can use it, e.g. putting the environment in 
the arguments of other commands (like the setup-environment above) 
fails. One way to avoid this is to replace the \startextract ... 
\stopextract in this case with the code for the quoted text, another way 
is to put all content in a buffer and just load the buffer in the 
setups-environment.


\startbuffer[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
...
\stopframed
\stoplocalheadsetup
\stopbuffer

\startsetups[my_chapter]
  \getbuffer[my_chapter]
\stopsetups

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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-17 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> \startsetups [userdata:extract]
>  \startnarrower
>  \setupindenting[next]
>  \getuserdata
>  \hairline
>  \dontleavehmode\wordright{\itx\userdataparameter{author}}
>  \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>[extract]
>[renderingsetup=userdata:extract]
> 
> \defineuserdata
>[extract]
>[style=italic,
> alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> Wolfgang
> 

I tried to combine this with the code of the mail thread: "setuphead in 
connection with the command argument" but had not luck.
ConTeXt always stops with:
```
close source> level 1, order 2, name './mwe.tex'
tex error   > runaway error: end of file encountered
mtx-context | fatal error: return code: 1
```

Here is the MWE:
```
\startsetups [userdata:extract]
\getuserdata
    \hairline
\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%  \startnarrower
%  \setupindenting[next]
%  \getuserdata
%  \hairline
%  \dontleavehmode\wordright{\itx\userdataparameter{author}}
%  \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
alternative=extract]

\defineframed[chapter_frame][
    width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]

\startsetups[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
\blank[2cm]
\startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
\stopfont
\blank[5mm]
\startfont[SerifBold sa 2]
\color[m-indigo-800]{\headtextcontent}
\stopfont
\blank[1cm]
\startfont[SerifBold sa 1.5]

\color[m-indigo-800]{\structureuservariable{subtitle}}
\stopfont
\blank[3cm]

\startextract[author={\structureuservariable{quoteauthor}}]
\structureuservariable{quote}
\stopextract
\stopframed
\stoplocalheadsetup
\stopsetups

\defineheadalternative[chap][renderingsetup=my_chapter]

\setuphead[title, chapter][
alternative=chap,
after={\page[yes]},
sectionsegments=2:2,
header=high,
footer=high,
style=
]

\starttext

% embedded startextract into startchapter does not work
\startchapter[title=Foo][subtitle=bla, quoteauthor={René Descartes}, quote={%
Cogito ergo sum.
}]
\stopchapter

\startextract[author=René Descartes]
Cogito ergo sum.
\stopextract

\stoptext
```



I also tried to combine it less interleaved, but it fails with the same error:
```
\startsetups [userdata:extract]
\getuserdata
    \hairline
\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%  \startnarrower
%  \setupindenting[next]
%  \getuserdata
%  \hairline
%  \dontleavehmode\wordright{\itx\userdataparameter{author}}
%  \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
alternative=extract]

\defineframed[chapter_frame][
width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]
\defineframed[chapter_quote][
    width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]

\startsetups[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
\blank[2cm]
\startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
\stopfont
\blank[5mm]
\startfont[SerifBold sa 2]
\color[m-indigo-800]{\headtextcontent}
\stopfont
\blank[1cm]
\startfont[SerifBold sa 1.5]

\color[m-indigo-800]{\structureuservariable{subtitle}}
\stopfont
\blank[3cm]
\startframed[chapter_quote]
\structureuservariable{quote}
  

[NTG-context] Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-15 Thread Michael Guravage
Hi,

I am trying to use the Pocket Diary
<https://ctan.org/pkg/context-pocketdiary> module to create a photo
calendar as described in the Calendar Examples
<https://ctan.org/pkg/context-calendar-examples>. The examples work fine.
By default weeks begin on Monday. Does anyone know how to specify that
weeks begin on Sunday? I have searched through all the setvariable
assignments, but nothing seems applicable.

I have attached an example file so you needn't retrieve all the examples.
Any help would be appreciated.

-- 
With kind regards,

Michael


<http://literatesolutions.com>
\usemodule[pocketdiary]

%D Choose and setup the font to be used
\setupbodyfont[ibmplex,ss,12pt]

% Supported languages: EN,DE,NL,FR,IT,ES
\mainlanguage[nl]

% Switch off the page numbering
\setuppagenumbering[location=]

% Setup the paper size
\setuppapersize[A4,portrait][A4,portrait]

% Adjust the layout of the page
\setuplayout
  [topspace=20mm,
  backspace=8.6mm,
  header=0pt,
  footer=0pt,
  height=middle,
  width=middle]

% Setup the path where to find the calendar pictures
\setupexternalfigures [directory={., ./graphics, ../graphics, ./MyPhotoDirectory}]
\setupexternalfigures [location={local,global,default}]

\def\testimage {cow} % dolly.png
% Give pictures symbolic names for using in a loop
\useexternalfigure [1] [\testimage]
\useexternalfigure [2] [\testimage]
\useexternalfigure [3] [\testimage]
\useexternalfigure [4] [\testimage]
\useexternalfigure [5] [\testimage]
\useexternalfigure [6] [\testimage]
\useexternalfigure [7] [\testimage]
\useexternalfigure [8] [\testimage]
\useexternalfigure [9] [\testimage]
\useexternalfigure [10] [\testimage]
\useexternalfigure [11] [\testimage]
\useexternalfigure [12] [\testimage]
\useexternalfigure [13] [\testimage]

% Setup the variables for the Pocket diary, only year is used for the calculations.
\setvariables
  [PocketDiary]
  [Year=2025]

% Let the header and the footer be empty:
\setupheadertexts[][]
\setupfootertexts[][]

% Add some label texts for the international interfaces:
\setuplabeltext[en][fotocal={Photo Calendar}]
\setuplabeltext[nl][fotocal=Fotokalender]
\setuplabeltext[de][fotocal=Fotokalender]
\setuplabeltext[fr][fotocal={Calendrier photo}]
\setuplabeltext[it][fotocal={Calendario fotografico}]
\setuplabeltext[es][fotocal={Calendario fotográfico}]

%D Let lua is perform the magic:
\startluacode
  local report = logs.reporter("Photo calendar")

  function thirddata.calendar.Photo_calendar_page(y)

report("Working in function: calendar.Foto_calendar_page")

local year = y
--local path = file.dirname("./Fotokalender-fotos/")
for i = 1,12 do

  local monthname = string.lower(os.date("%B",
os.time{year=year,month=i,day=1}))

  context.startplacefigure({number="",title=""})
 context.externalfigure({i}, {width = "0.8\\textwidth"})
  context.stopplacefigure()
  context.strut()
  context("\\vfill")
  context.startalign({"middle"})
context("\\bfa")
context.labeltext(monthname)
context("~")
context(year)
  context.stopalign()
  context.blank()

  thirddata.diary.monthtableH(i,year)

  context.page()
end
  end
\stopluacode


% Setup of the month table
\startsetups table:month
   \setupTABLE[c]
  [each]
  [width=\dimexpr\textwidth/7,
   frame=on,
   style=\tfa]
   \setupTABLE[r][each][height=1.8\lineheight,align={center,lohi}]
   \setupTABLE[c][7][foregroundcolor=red]
\stopsetups

% Define the macro for calling lua
\define[1]\Photocalendarpages
  {\ctxlua{thirddata.calendar.Photo_calendar_page(#1)}}

% Setup the \TEX\ side of the document
\starttext

  % Add a title page
  \startstandardmakeup[page=yes,doublesided=yes]
\startplacefigure
  [location=middle,
   title=,
   number=]
  {\externalfigure[13][width=\paperwidth]}
\stopplacefigure
\midaligned{\bfc \labeltext{fotocal}~\getvariable{PocketDiary}{Year}}
  \stopstandardmakeup

  % Call the defined macro
  \Photocalendarpages{\getvariable{PocketDiary}{Year}}

\stoptext
___
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: Prefix the text in an enumeration.

2024-06-14 Thread Gerion Entrup
Am Freitag, 14. Juni 2024, 11:51:28 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 14.06.2024 um 11:01:
> > Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:
> >> \startsetups[question:intro]
> >> \setupparagraphintro[first][\bold{Answer:} ]
> >> \blank
> >> \stopsetups
> >>
> >> \defineenumeration[question][
> >>  alternative=top,
> >>  text=Question,
> >>  title=yes,
> >>  titleleft=,
> >>  titleright=,
> >>  right={:},
> >>  headstyle=bold,
> >> inbetween=\setup{question:intro},
> >> ]
> >>
> >> \starttext
> >>
> >> Some text:
> >>
> >> \startquestion[title={How long does a loop last?}]
> >> For a while.
> >> \stopquestion
> >>
> >> \stoptext
> > 
> > Thank you. That works well for this case.
> > 
> > I have a follow up question. I tried to additionally set a titledistance 
> > and reproduce that for the "Answer:"-part.
> > ConTeXt then introduces a mysterious newline.
> > 
> > See this example:
> > 
> > \definehspace[dist][1em]
> > \startsetups[question:intro]
> > \setupparagraphintro[first][\bold{Answer:}\hspace[1em]]
> > \blank
> > \stopsetups
> 
> You need 2 changes for \setupparagraphintro:
> 
> 1. Change the argument of \hspace to "dist" because the commands accepts 
> only keywords and everything else (even a valid length) is ignored and 
> results in a horizontal skip of 0pt.

Hrmm, this was a typo.

> 
> 2. You have to add curly braces around the content when the content 
> includes square brackets because nesting of optional arguments isn't 
> supported yet.

Thanks for the help, that was the missing part.

> 
> The correct version of the one above is:
> 
> \startsetups[question:intro]
> \setupparagraphintro[first][{\bold{Answer:}\hspace[dist]}]
> \blank
> \stopsetups
> 
> Wolfgang
> 

Gerion



signature.asc
Description: This is a digitally signed message part.
___
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: Prefix the text in an enumeration.

2024-06-14 Thread Wolfgang Schuster

Gerion Entrup schrieb am 14.06.2024 um 11:01:

Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:

\startsetups[question:intro]
\setupparagraphintro[first][\bold{Answer:} ]
\blank
\stopsetups

\defineenumeration[question][
 alternative=top,
 text=Question,
 title=yes,
 titleleft=,
 titleright=,
 right={:},
 headstyle=bold,
inbetween=\setup{question:intro},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\stoptext


Thank you. That works well for this case.

I have a follow up question. I tried to additionally set a titledistance and reproduce 
that for the "Answer:"-part.
ConTeXt then introduces a mysterious newline.

See this example:

\definehspace[dist][1em]
\startsetups[question:intro]
\setupparagraphintro[first][\bold{Answer:}\hspace[1em]]
\blank
\stopsetups


You need 2 changes for \setupparagraphintro:

1. Change the argument of \hspace to "dist" because the commands accepts 
only keywords and everything else (even a valid length) is ignored and 
results in a horizontal skip of 0pt.


2. You have to add curly braces around the content when the content 
includes square brackets because nesting of optional arguments isn't 
supported yet.


The correct version of the one above is:

\startsetups[question:intro]
   \setupparagraphintro[first][{\bold{Answer:}\hspace[dist]}]
   \blank
\stopsetups

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: Prefix the text in an enumeration.

2024-06-14 Thread Gerion Entrup
Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:
> \startsetups[question:intro]
>\setupparagraphintro[first][\bold{Answer:} ]
>\blank
> \stopsetups
> 
> \defineenumeration[question][
> alternative=top,
> text=Question,
> title=yes,
> titleleft=,
> titleright=,
> right={:},
> headstyle=bold,
>inbetween=\setup{question:intro},
> ]
> 
> \starttext
> 
> Some text:
> 
> \startquestion[title={How long does a loop last?}]
> For a while.
> \stopquestion
> 
> \stoptext

Thank you. That works well for this case.

I have a follow up question. I tried to additionally set a titledistance and 
reproduce that for the "Answer:"-part.
ConTeXt then introduces a mysterious newline.

See this example:
```
\definehspace[dist][1em]
\startsetups[question:intro]
   \setupparagraphintro[first][\bold{Answer:}\hspace[1em]]
   \blank
\stopsetups

\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titledistance=1em,
titleright=,
right={:},
headstyle=bold,
   inbetween=\setup{question:intro},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\stoptext
```

Gerion

signature.asc
Description: This is a digitally signed message part.
___
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: Prefix the text in an enumeration.

2024-06-13 Thread Wolfgang Schuster

Gerion Entrup schrieb am 13.06.2024 um 13:41:

Hi,

is there a way to automatically prefix the text body in an enumeration?

Consider this example:
```
\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titleright=,
right={:},
headstyle=bold,
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
\bold{Answer:} For a while.
\stopquestion

\stoptext
```

I'd like to have the `\bold{Answer:}` automatically. So for example something 
like this:
```
\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titleright=,
right={:},
headstyle=bold,
prefix={\bold{Answer:}},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\stoptext
```

I tried to misuse `inbetween` for that but `alternative=top` seems to make a 
(not modifiable space) between the heading and the text body.


Use the \setupparagraphintro command to set the text which should appear 
at the start of the question.


 begin example
\startsetups[question:intro]
  \setupparagraphintro[first][\bold{Answer:} ]
  \blank
\stopsetups

\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titleright=,
right={:},
headstyle=bold,
  inbetween=\setup{question:intro},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\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: Bibliography: separating different kinds of literature OR Sectioning bibliography by type

2024-06-09 Thread Ben Moon via ntg-context
Dear Alan,
Thank you very much for your reply. Unfortunately, I don’t get this working. 
Also, I don’t find the documentation for flushbtxrendering.
Here’s a minimal working example I’m trying:

\startbtxrenderingdefinitions[mybib]

\definebtx
  [mybib]
  [default=default,
   specification=mybib]

\definebtxrendering
  [mybib]
  [specification=mybib,
   numbering=yes]

\stopbtxrenderingdefinitions

\startsetups btx:mybib:list:link
   \btxdoifelse {title} {\btxflush{title}:\space} {No Title}
   \btxdoifelse {url}  {\btxflush{url};\space} {}
   \btxdoifelse {date}  {abgerufen \btxflush{date}.} {}
  \removeunwantedspaces
\stopsetups

\startsetups btx:mybib:list:imagelink
   \btxdoifelse {url}  {\btxflush{url};\space} {}
   \btxdoifelse {date}  {abgerufen \btxflush{date}.} {}
  \removeunwantedspaces
\stopsetups


\startbuffer[maindata]
@link{herbariumathome,
title={Herbarium At Home: A Beginner's Guide},
url={https://youtu.be/2kEbCaTe8XM},
date={04.04.2024}},

@imagelink{zooniverse_logo,
url={https://www.sciencelearn.org.nz/images/3873-zooniverse-logo},
date={04.06.2024}}
\stopbuffer
% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\definebtxdataset[main]
\usebtxdataset[main][maindata.buffer]
%\definebtxdataset[bilder]
%\usebtxdataset[bilder][imagedata.buffer]
\usebtxdefinitions[mybib, aps] % aps for stuff which isn’t a link or image
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][mybib, aps][dataset=main]

\starttext
\cite[herbariumathome]
\cite[zooniverse_logo]

\section{Quellen: Bilder}
%\placelistofpublications[bibrendering]
\flushbtxrendering [bibrendering]
[method=dataset,
 sorttype=index,
 filter=match(category:imagelink)]

\section{Quellen: Webseiten}
\flushbtxrendering [bibrendering]
[method=dataset,
 sorttype=index,
 filter=match(category:link)]
\stoptext

I would very much appreciate more ideas.

Thank you very much and kind regards

Ben

> On 9 Jun 2024, at 14:37, Alan Braslau via ntg-context  
> wrote:
> 
> Try something like:
> 
>  \flushbtxrendering [bibrendering]
>   [method=dataset,
>sorttype=index,
>filter=match(category:article)]
> 
> I have used the filtering mechanism to select fields, such as 
> filter=match(year:2023).
> 
> Alan
> 
> 
> 
> 
> On Tue, 4 Jun 2024 15:20:14 +0200
> Ben Moon via ntg-context  wrote:
> 
>> Hey there,
>> I would like to place a list of bibliography according to types
>> (article, book, in proceedings) in my document. Similar like here:
>> https://tex.stackexchange.com/questions/112874/sectioning-bibliography-by-type-with-multiple-types-per-section
>> Sectioning bibliography by type (with multiple types per section)
>> tex.stackexchange.com
>> 
>> and here:
>> https://www.mail-archive.com/ntg-context@ntg.nl/msg77056.html
>> The example provided by Hans doesn’t seem to properly work any more,
>> and I cannot make the suggestion work of using two different datasets
>> work as suggested in the same thread. So this is where I’m stuck:
>> 
>> \definebtxdataset[main]
>> \usebtxdataset[main][maindata.buffer]
>> \definebtxdataset[images]
>> \usebtxdataset[images][imagedata.buffer]
>> \usebtxdefinitions[mycustom, aps]
>> \setupbtx[dataset=main]
>> \definebtxrendering[bibrendering][mycustom, aps][dataset=main]
>> \definebtxrendering[bibimgrendering][mycustom, aps][dataset=images]
>> 
>> \placelistofpublications[bibrendering]
>> \placelistofpublications[bibimgrendering]
>> 
>> It would be much appreciated if someone could provide a working
>> example?
>> 
>> Thank you very much
>> 
>> Ben
> 
> ___
> 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
> ___

___
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 13:51:53 MESZ schrieb Hans Hagen via ntg-context:
> On 6/6/2024 12:30 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like 
> > it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it 
> > does not work.
> 
> not all constructs hav ethese user variables (yet)
> 
> i'll add an option for arguments tostart/stop so that you can do
> 
> \starttext
> 
> \definedelimitedtext
>[dextract]
>[blockquote]
>[leftmargin=1.5pc,
> style=italic,
> before=\setupindenting[next],
> after=\setups{extract:whatever}]
> 
> \definestartstop
>[extract]
>[arguments=yes,
> before=\setups{extract:start},
> after=\setups{extract:stop}]
> 
> \startsetups extract:start
>  \startdextract
> \stopsetups
> 
> \startsetups extract:stop
>  \startstopparameter{author}
>  \stopdextract
>  \blank[1ex,samepage]
>  \hrule
>  \blank[1ex,samepage]
>  \dontleavehmode
>  \wordright{\itx\startstopparameter{author}}
> \stopsetups
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> but first i want Wolfgang to check the patch,

For me, Wolfgang's answer fulfills all my needs.
So, from my point of view, this is not needed anymore.
Thank you for your effort anyway!

Gerion


signature.asc
Description: This is a digitally signed message part.
___
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 06.06.2024 um 12:30:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like 
> > it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it 
> > does not work.
> 
> \startsetups [userdata:extract]
>  \startnarrower
>  \setupindenting[next]
>  \getuserdata
>  \hairline
>  \dontleavehmode\wordright{\itx\userdataparameter{author}}
>  \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>[extract]
>[renderingsetup=userdata:extract]
> 
> \defineuserdata
>[extract]
>[style=italic,
> alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext

Really cool! Thank you. If I see it right, this is completely generic,
so with this it is possible to define any start stop
with completely variable arguments.

Gerion

signature.asc
Description: This is a digitally signed message part.
___
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Hans Hagen via ntg-context

On 6/6/2024 4:34 PM, Wolfgang Schuster wrote:

Gerion Entrup schrieb am 06.06.2024 um 12:30:

Hi,

I like to achieve something that looks like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
    style={\italic},
    before={\setupindenting[next]},
    after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{René Descartes} \stopalignment}]


\starttext
\startextract
 Cogito ergo sum.
\stopextract
\stoptext
```

So it should setup a quotation and mentions the author.
However, here the author is hardcoded within the blockquote. I would 
like it to use like this:

```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
    style={\italic},
    before={\setupindenting[next]},
    after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{\getcustomvariable{author}} \stopalignment}]


\starttext
\startextract[author=René Descartes]
 Cogito ergo sum.
\stopextract
\stoptext
```

Is there an easy way to achieve that?
I tried with \structureuservariable (like possible in \startchapter) 
but it does not work.


\startsetups [userdata:extract]
     \startnarrower
     \setupindenting[next]
     \getuserdata
     \hairline
     \dontleavehmode\wordright{\itx\userdataparameter{author}}
     \stopnarrower
\stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
    alternative=extract]

\starttext

\startextract[author=René Descartes]
     Cogito ergo sum.
\stopextract

\stoptext
ah, i start forgetting about these mechanisms ... i added this example 
to th etest suite


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

maillist : ntg-context@ntg.nl / 
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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Wolfgang Schuster

Gerion Entrup schrieb am 06.06.2024 um 12:30:

Hi,

I like to achieve something that looks like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
style={\italic},
before={\setupindenting[next]},
after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{René Descartes} \stopalignment}]

\starttext
\startextract
 Cogito ergo sum.
\stopextract
\stoptext
```

So it should setup a quotation and mentions the author.
However, here the author is hardcoded within the blockquote. I would like it to 
use like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
style={\italic},
before={\setupindenting[next]},
after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{\getcustomvariable{author}} \stopalignment}]

\starttext
\startextract[author=René Descartes]
 Cogito ergo sum.
\stopextract
\stoptext
```

Is there an easy way to achieve that?
I tried with \structureuservariable (like possible in \startchapter) but it 
does not work.


\startsetups [userdata:extract]
\startnarrower
\setupindenting[next]
\getuserdata
\hairline
\dontleavehmode\wordright{\itx\userdataparameter{author}}
\stopnarrower
\stopsetups

\defineuserdataalternative
  [extract]
  [renderingsetup=userdata:extract]

\defineuserdata
  [extract]
  [style=italic,
   alternative=extract]

\starttext

\startextract[author=René Descartes]
Cogito ergo sum.
\stopextract

\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: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Hans Hagen via ntg-context

On 6/6/2024 12:30 PM, Gerion Entrup wrote:

Hi,

I like to achieve something that looks like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
style={\italic},
before={\setupindenting[next]},
after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{René Descartes} \stopalignment}]

\starttext
\startextract
 Cogito ergo sum.
\stopextract
\stoptext
```

So it should setup a quotation and mentions the author.
However, here the author is hardcoded within the blockquote. I would like it to 
use like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
   [extract]
   [leftmargin=1.5pc,
style={\italic},
before={\setupindenting[next]},
after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{\getcustomvariable{author}} \stopalignment}]

\starttext
\startextract[author=René Descartes]
 Cogito ergo sum.
\stopextract
\stoptext
```

Is there an easy way to achieve that?
I tried with \structureuservariable (like possible in \startchapter) but it 
does not work.


not all constructs hav ethese user variables (yet)

i'll add an option for arguments tostart/stop so that you can do

\starttext

\definedelimitedtext
  [dextract]
  [blockquote]
  [leftmargin=1.5pc,
   style=italic,
   before=\setupindenting[next],
   after=\setups{extract:whatever}]

\definestartstop
  [extract]
  [arguments=yes,
   before=\setups{extract:start},
   after=\setups{extract:stop}]

\startsetups extract:start
\startdextract
\stopsetups

\startsetups extract:stop
\startstopparameter{author}
\stopdextract
\blank[1ex,samepage]
\hrule
\blank[1ex,samepage]
\dontleavehmode
\wordright{\itx\startstopparameter{author}}
\stopsetups

\starttext

\startextract[author=René Descartes]
Cogito ergo sum.
\stopextract

\stoptext

but first i want Wolfgang to check the patch,

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

maillist : ntg-context@ntg.nl / 
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] Specify separator within setupbtx for custom bibliography rendering

2024-06-01 Thread Gerion Entrup
Hi,

according to the section "Custom citation renderings" in the bibliography 
manual, I have specified an own setup for citation rendering.
However, this seems only to work for single citations (of one source). I want 
to also specify the separator but did not get it to run.

Here is a minimal example:
```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]

\definebtx[aps:cite:special][aps:cite][
left={((},
right={))},
separator:2={sfd},
separator:3={sfd},
separator:4={sfd},
]

\startsetups btx:aps:cite:special
% just a dummy
\btxcitereference
\currentbtxtag
\stopsetups

\setupbtx[aps:cite][
alternative=special,
]

\starttext

Both said something~\cite[knuth1, someother].

\placelistofpublications[bibrendering]

\stoptext
```

The output of this is:

> Both said something ((knuth1someother)).

How can I get the separator to work? My expectation would be:

> Both said something ((knuth1sfdsomeother)).

or

> Both said something ((knuth1sfd someother)).

Best,
Gerion

signature.asc
Description: This is a digitally signed message part.
___
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: setuphead in connection with the command argument

2024-05-30 Thread Bruce Horrocks


> On 30 May 2024, at 23:25, Gerion Entrup  wrote:
> 
> Am Donnerstag, 30. Mai 2024, 18:49:08 MESZ schrieb Bruce Horrocks:
>> 
>>> On 30 May 2024, at 15:15, Gerion Entrup  wrote:
>>> 
>>> Let's begin with a minimal example:
>>> ```
>>> \define[2]\MyChapter{%
>>> #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
>>> }
>> 
>> Stop there!
>> 
>> Use \definehead to create your own variation of a heading - much more 
>> robust. Something like the following (untested):
>> 
>>  \startsetups PlaceSubTitleAndIntro
>>% Set font and and style etc for the subtitle here
>>\structureuservariable(subtitle)
>> 
>>% Set font and style etc for the intro text here
>>\structureuservariable(intro)
>>  \stopsetups
>> 
>>  \definehead [MyChapter] [chapter]
>>  \setuphead [MyChapter]
>>[ style={...}, % heading style
>>  after={\setup{PlaceSubTitleAndIntro}},
>>]
>> 
>>  \starttext
>>  \startMyChapter[title={Foo}]
>>[ subtitle={Bar},
>>  intro={Some explanation},
>>]
>>  The text of the chapter
>>  \stopMyChapter
>>  \stoptext
> 
> Thanks for the input. A comparable example is also listed in the wiki.
> I like the approach for placing subtitle and intro alone. However, I also 
> want to style chapter number and chapter title separately.

Any setuphead commands that apply to MyChapter also apply to chapter so you 
should be able to use exactly the same styling commands.

> I'm also not sure, if an extra heading (MyChapter) is needed, since all my 
> chapters are styled in this way.
> Isn't it possible to define "after" of chapter directly?

Yes, I think it is possible to just use \setuphead [chapter] instead of 
\setuphead [MyChapter] with the rest remaining the same.

The only reason I don't do it is that if something goes wrong, I know I have an 
original version of \chapter readily to hand to compare against for debugging.

Regards,
—
Bruce Horrocks
Hampshire, UK

___
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: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Am Donnerstag, 30. Mai 2024, 22:54:47 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 30.05.2024 um 16:25:
> > The chapter format that I want to achieve in the end is nearly the one in 
> > the attachment (excerpt of Christian Dietrich's PhD thesis).
> 
> When you have a complex layout it is easier to use the 
> \defineheadalternative command to create it.
> 
> To change the font for each element disable the default settings with 
> \setuphead[style=] and use \startfont (or \definedfont) to apply a 
> different style for the number, title etc.
> 
>  begin example
> \defineframed
>[ChapterFrame]
>[width=\textwidth,
> align=flushright,
> offset=0pt,
> rulethickness=0pt]
> 
> \startsetups [christian_dietrich]
>\startlocalheadsetup
>  \startframed[ChapterFrame]
>\blank[2cm]
>\startfont[Serif sa 8]
>  \color[darkgray]{\headnumbercontent}
>\stopfont
>\blank[5mm]
>\startfont[SerifBold sa 2]
>  \color[darkred]{\headtextcontent}
>\stopfont
>\blank[1cm]
>\startfont[SerifBold sa 1.5]
>  \color[darkred]{\structureuservariable{subtitle}}
>\stopfont
>  \stopframed
>\stoplocalheadsetup
> \stopsetups
> 
> \defineheadalternative
>[christian_dietrich]
>[renderingsetup=christian_dietrich]
> 
> \setuphead
>[chapter]
>[alternative=christian_dietrich,
> header=empty,
> style=]
> 
> \starttext
> 
> \startchapter[title=Chapter title][subtitle=Chapter subtitle]
> \samplefile{lorem}
> \stopchapter
> 
> \stoptext
>  end example

Thank you very much! That looks really clean. I will add it to the wiki.

Can you bring some clarification regarding "style=", "command=" and 
"alternative="?
What, if I define multiple of them? Is the system not made for this?

I just tested my initial example regarding font size with `command=\MyChapter, 
style=` and the font size was only affected by the code of \MyChapter.
What is the default style?

Best
Gerion



signature.asc
Description: This is a digitally signed message part.
___
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: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Am Donnerstag, 30. Mai 2024, 18:49:08 MESZ schrieb Bruce Horrocks:
> 
> > On 30 May 2024, at 15:15, Gerion Entrup  wrote:
> > 
> > Let's begin with a minimal example:
> > ```
> > \define[2]\MyChapter{%
> > #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> 
> Stop there!
> 
> Use \definehead to create your own variation of a heading - much more robust. 
> Something like the following (untested):
> 
>   \startsetups PlaceSubTitleAndIntro
> % Set font and and style etc for the subtitle here
> \structureuservariable(subtitle)
> 
> % Set font and style etc for the intro text here
> \structureuservariable(intro)
>   \stopsetups
> 
>   \definehead [MyChapter] [chapter]
>   \setuphead [MyChapter]
> [ style={...}, % heading style
>   after={\setup{PlaceSubTitleAndIntro}},
> ]
> 
>   \starttext
>   \startMyChapter[title={Foo}]
> [ subtitle={Bar},
>   intro={Some explanation},
> ]
>   The text of the chapter
>   \stopMyChapter
>   \stoptext

Thanks for the input. A comparable example is also listed in the wiki.
I like the approach for placing subtitle and intro alone. However, I also want 
to style chapter number and chapter title separately.
I'm also not sure, if an extra heading (MyChapter) is needed, since all my 
chapters are styled in this way.
Isn't it possible to define "after" of chapter directly?

Best
Gerion


signature.asc
Description: This is a digitally signed message part.
___
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: setuphead in connection with the command argument

2024-05-30 Thread Wolfgang Schuster

Gerion Entrup schrieb am 30.05.2024 um 16:25:

The chapter format that I want to achieve in the end is nearly the one in the 
attachment (excerpt of Christian Dietrich's PhD thesis).


When you have a complex layout it is easier to use the 
\defineheadalternative command to create it.


To change the font for each element disable the default settings with 
\setuphead[style=] and use \startfont (or \definedfont) to apply a 
different style for the number, title etc.


 begin example
\defineframed
  [ChapterFrame]
  [width=\textwidth,
   align=flushright,
   offset=0pt,
   rulethickness=0pt]

\startsetups [christian_dietrich]
  \startlocalheadsetup
\startframed[ChapterFrame]
  \blank[2cm]
  \startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
  \stopfont
  \blank[5mm]
  \startfont[SerifBold sa 2]
\color[darkred]{\headtextcontent}
  \stopfont
  \blank[1cm]
  \startfont[SerifBold sa 1.5]
\color[darkred]{\structureuservariable{subtitle}}
  \stopfont
\stopframed
  \stoplocalheadsetup
\stopsetups

\defineheadalternative
  [christian_dietrich]
  [renderingsetup=christian_dietrich]

\setuphead
  [chapter]
  [alternative=christian_dietrich,
   header=empty,
   style=]

\starttext

\startchapter[title=Chapter title][subtitle=Chapter subtitle]
\samplefile{lorem}
\stopchapter

\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: setuphead in connection with the command argument

2024-05-30 Thread Bruce Horrocks


> On 30 May 2024, at 15:15, Gerion Entrup  wrote:
> 
> Let's begin with a minimal example:
> ```
> \define[2]\MyChapter{%
> #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }

Stop there!

Use \definehead to create your own variation of a heading - much more robust. 
Something like the following (untested):

  \startsetups PlaceSubTitleAndIntro
% Set font and and style etc for the subtitle here
\structureuservariable(subtitle)

% Set font and style etc for the intro text here
\structureuservariable(intro)
  \stopsetups

  \definehead [MyChapter] [chapter]
  \setuphead [MyChapter]
[ style={...}, % heading style
  after={\setup{PlaceSubTitleAndIntro}},
]

  \starttext
  \startMyChapter[title={Foo}]
[ subtitle={Bar},
  intro={Some explanation},
]
  The text of the chapter
  \stopMyChapter
  \stoptext

—
Bruce Horrocks
Hampshire, UK

___
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: simplify side by side Poems

2024-05-23 Thread Wolfgang Schuster

seyal.zav...@gmail.com schrieb am 23.05.2024 um 14:13:

Hi all,

i want to use tables for constructing poems structure
this snippet of code works well:

\startsetups tablepoem
\setupTABLE[column][each][width=5cm]
\stopsetups
\starttext
\bTABLE[setups=tablepoem]
\bTR \bTD One one ons ksl   \eTD \bTD  two gfjgfd oski kwo \eTD \eTR
\bTR \bTD One wer s dft tgf \eTD \bTD  two gfkdsjg dfs we  \eTD \eTR
\eTABLE
\stoptext

but when i use this code for simplifying of changing cells I get an error:

\startsetups tablepoem
\setupTABLE[column][each][width=5cm]
\stopsetups

\def\Poemstart{\bTABLE[setups=tablepoem] \bTR \bTD}
\def\Mesra{\eTD \bTD}
\def\nextBeyt{\eTD\eTR\bTR\bTD}
\def\Poemstop{\eTD\eTR\eTABLE}

\starttext
\Poemstart
One one ons ksl\Mesratwo gfjgfd oski kwo  \nextBeyt
One wer s dft tgf   \Mesratwo gfkdsjg dfs we
\Poemstop
\stoptext

what is the problem?


The table environment collects the content of the table cell-wise which 
means when TeX sees a \bTD in the input it reads the following text 
until it finds the corresponding \eTD. When you put the \eTD in the 
definition of another command the scanner will never find the end of a 
cell and you either run out of memory or reach the end of the file etc.


Below are a few alternative solutions to simplify the input, one of them 
is an alternative version of input (\startTABLE) for natural tables 
which uses the same commands to separate columns as tabulate does.


 begin example
\starttext

\startTABLE[width=5cm]
\NC One one ons ksl   \NC two gfjgfd oski kwo \NC\NR
\NC One wer s dft tgf \NC two gfkdsjg dfs we  \NC\NR
\stopTABLE

\starttabulate[|*{2}{k{0}lw(5cm)|}]
\NC One one ons ksl   \NC two gfjgfd oski kwo \NC\NR
\NC One wer s dft tgf \NC two gfkdsjg dfs we  \NC\NR
\stoptabulate

\defineparagraphs[poem][n=2,width=5cm]
\setupparagraphs[poem][each][width=5cm,distance=0pt]

\startpoem
  \startlines
  One one ons ksl
  One wer s dft tgf
  \stoplines
\nextpoem
  \startlines
  two gfjgfd oski kwo
  two gfkdsjg dfs we
  \stoplines
\stoppoem

\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] simplify side by side Poems

2024-05-23 Thread seyal . zavira
Hi all,

i want to use tables for constructing poems structure
this snippet of code works well:

\startsetups tablepoem
\setupTABLE[column][each][width=5cm]
\stopsetups
\starttext
\bTABLE[setups=tablepoem]
\bTR \bTD One one ons ksl   \eTD \bTD  two gfjgfd oski kwo \eTD \eTR
\bTR \bTD One wer s dft tgf \eTD \bTD  two gfkdsjg dfs we  \eTD \eTR
\eTABLE
\stoptext

but when i use this code for simplifying of changing cells I get an error:

\startsetups tablepoem
\setupTABLE[column][each][width=5cm]
\stopsetups

\def\Poemstart{\bTABLE[setups=tablepoem] \bTR \bTD}
\def\Mesra{\eTD \bTD}
\def\nextBeyt{\eTD\eTR\bTR\bTD}
\def\Poemstop{\eTD\eTR\eTABLE}

\starttext
\Poemstart
One one ons ksl\Mesratwo gfjgfd oski kwo  \nextBeyt
One wer s dft tgf   \Mesratwo gfkdsjg dfs we  
\Poemstop
\stoptext

what is the problem?
___
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: Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-25 Thread Gerion Entrup
I solved it, although it's kinda hacky. I'm pretty sure that
publications.citevariants.short is not meant to be called directly.

Do you know why `context.getdetail(dataset, tag, "author")` does not work in 
render_cite?
It always returns nil.


```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]

\definebtx[aps:cite:special][aps:cite]
\startluacode
function render_cite(dataset, tag, righttext)
local luadata = publications.datasets[dataset].luadata
local entry = luadata[tag]
local extrasign = ""
if entry.author:lower():find("knuth") then
extrasign = ">"
end
context("[" .. extrasign)
print(righttext)
publications.citevariants.short({dataset = dataset, reference = tag, 
variant = "short", righttext = righttext})
context("]")
end
\stopluacode

\startsetups btx:aps:cite:special
\btxcitereference
\ctxlua{render_cite([==[\currentbtxdataset]==], [==[\currentbtxtag]==], 
[==[\currentbtxrighttext]==])}
\stopsetups
\setupbtx[aps:cite][alternative=special]

\starttext

\def\comma{,}

Knuth developed \TeX~\cite[knuth1]
Several persons said something~\cite[someother].

\placelistofpublications[bibrendering]

\stoptext
```

Gerion

Am Dienstag, 23. April 2024, 16:03:50 MESZ schrieb Gerion Entrup:
> Here is a solution for the first part of my question. This is based on
> https://www.mail-archive.com/ntg-context@ntg.nl/msg101156.html
> and try and error based on publ-imp-aps.mkvi and publ-imp-apa.mkvi:
> 
> It display now the citation _and_ numbering labels in the short form:
> ```
> \setupinteraction[state=start]
> 
> \startbuffer[testdata]
> @Book{knuth1,
>   author = {Donald E. Knuth},
>   title = {TEX and METAFONT. New directions in typesetting},
>   year = {1979},
>   publisher = {Addison-Wesley},
> }
> @Article{someother,
>   author = {Some Person and Some Otherperson},
>   title = {Another title},
>   year = {1900},
> }
> \stopbuffer
> 
> % enable tracing
> \enabletrackers[publications, publications.crossref, publications.details, 
> publications.cite, publications.strings]
> 
> \usebtxdataset[main][testdata.buffer]
> \usebtxdefinitions[aps]
> \setupbtx[dataset=main]
> \definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
> \setupbtxlist[aps][
>   alternative=b,
>   distance=.5em,
> ]
> \setupbtx[aps:cite][alternative=short]
> 
> \starttext
> 
> Knuth developed \TeX \cite[knuth1]
> Several persons said something \cite[someother].
> 
> \placelistofpublications[bibrendering]
> 
> \stoptext
> ```
> 
> The remaining part now is to mark publications of Knuth in a different way.
> I have tried this and failed. Here is my code so far:
> ```
> \startluacode
> function render_cite(short, author)
>   print(author)
>   if author:lower():find("knuth") then
>   context("[>" .. short .. "]")
>   else
>   context("[" .. short .. "]")
>   end
> end
> \stopluacode
> \definebtx[aps:cite:special][aps:cite]
> \startsetups btx:aps:cite:special
>   \btxcitereference
>   \ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{author}]==])}
> \stopsetups
> % use it with \cite[special][knuth1]
> ```
> This has several problems:
> - \btxflush{short} does not work as I expected that. How can I get the short 
> form?
> - \btxflush to pass arguments to lua does not work as intended. On the lua 
> side the
>variable "author" resolves to "\btxflushauthor{author}" and not to "D. E. 
> Knuth".
>How can I pass the data?
> 
> I use Lua only because I find it more convenient as a programming language. 
> If a
> plain tex solution is simpler, I'm happy to use that. 
> 
> 
> Another question that came up while studying the source code:
> What effect have \c!, \s!, and \v!? These commands exist a lot in the above
> cited files.
> 
> Gerion
> 
> 
> Am Mittwo

[NTG-context] Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-23 Thread Gerion Entrup
Here is a solution for the first part of my question. This is based on
https://www.mail-archive.com/ntg-context@ntg.nl/msg101156.html
and try and error based on publ-imp-aps.mkvi and publ-imp-apa.mkvi:

It display now the citation _and_ numbering labels in the short form:
```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]
\setupbtx[aps:cite][alternative=short]

\starttext

Knuth developed \TeX \cite[knuth1]
Several persons said something \cite[someother].

\placelistofpublications[bibrendering]

\stoptext
```

The remaining part now is to mark publications of Knuth in a different way.
I have tried this and failed. Here is my code so far:
```
\startluacode
function render_cite(short, author)
print(author)
if author:lower():find("knuth") then
context("[>" .. short .. "]")
else
context("[" .. short .. "]")
end
end
\stopluacode
\definebtx[aps:cite:special][aps:cite]
\startsetups btx:aps:cite:special
\btxcitereference
\ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{author}]==])}
\stopsetups
% use it with \cite[special][knuth1]
```
This has several problems:
- \btxflush{short} does not work as I expected that. How can I get the short 
form?
- \btxflush to pass arguments to lua does not work as intended. On the lua side 
the
   variable "author" resolves to "\btxflushauthor{author}" and not to "D. E. 
Knuth".
   How can I pass the data?

I use Lua only because I find it more convenient as a programming language. If a
plain tex solution is simpler, I'm happy to use that. 


Another question that came up while studying the source code:
What effect have \c!, \s!, and \v!? These commands exist a lot in the above
cited files.

Gerion


Am Mittwoch, 17. April 2024, 15:44:12 MESZ schrieb Gerion Entrup:
> Hi,
> 
> > The APS style is an example of a number-based citation system. As you
> > are looking for a tag-based citation, it might be better to start with
> > something like the APA style.
> 
> I'm kind of satisfied with the publication-list layout of the APS style so I 
> chose
> this as a base. If it is simpler to start with the APA style, I can do that.
> 
> My hope is that it is possible to just change the "label" that is used for
> referencing and keep everything else as is.
> 
> > Is there some specification for your short tag-based citation style?
> 
> biblatex implements this with the "alphabetic" style. I'm not aware of
> a specification, though. Does the "short" form in ConTeXt exist for a
> specific reason? :)
> 
> Gerion
> 
> > On Tue, 16 Apr 2024 06:04:35 +0200
> > Gerion Entrup  wrote:
> > 
> > > Hi,
> > > 
> > > I'm trying to customize a cite format in a bibliography. Currently,
> > > I'm using the aps style which fits so far, except of the plain number
> > > as reference. In concrete, I want to change the following:
> > > - Use the first letter of the last name and the year as reference
> > > (this should be exactly the short form). It is more less also
> > > described here [1].
> > > - Highlight publications of a certain author with an extra char (e.g.
> > > '>')
> > > 
> > > Here is a minimal example (lets assume, every occurrence of Knuth
> > > should be highlighted): ```
> > > \setupinteraction[state=start]
> > > 
> > > \startbuffer[testdata]
> > > @Book{knuth1,
> > >   author = {Donald E. Knuth},
> > >   title = {TEX and METAFONT. New directions in typesetting},
> > >   year = {1979},
> > >   publisher = {Addison-Wesley},
> > > }
> > > @Article{someother,
> > >   author = {Some Person and Some Otherperson},
> > >   title = {Another title},
> > >   year = {1900},
> > > }
> > > \stopbuffer
> > > 
> > > % enable tracing
> > > \enabletrackers[publications, publications.crossref,
> > > publications.details, publicati

[NTG-context] \getmarking for top at the current page

2024-04-15 Thread Biblio--- via ntg-context
Dear list,

I've got a problem. Not the first one, but the first one to contribute to the 
list. ;)

system> ConTeXt  ver: 2024.04.01 08:59 LMTX  fmt: 2024.4.12  int: 
english/english
system> 'cont-new.mkxl' loaded

%==
%==
\definehead[Datum][subsubsubject]

\startsetups[Test]
  Pr=(\getmarking[Datum][previous])~
  Nx=(\getmarking[Datum][next])~
  Fi=(\getmarking[Datum][first])~
  La=(\getmarking[Datum][last])~
  Tp=(\getmarking[Datum][top])~
  Bt=(\getmarking[Datum][bottom])~
  Cu=(\getmarking[Datum][current])~
\stopsetups

\setupheadertexts[text]
  [\setups{Test}][]
  [\setups{Test}][]

\setuppagenumbering[location=footer]

\starttext

\startDatum[title={secA}]%

  \dorecurse{50}{aaa }

  \pagebreak
 
  \dorecurse{50}{aaa }

\stopDatum

\startDatum[title={secB}]%

  \dorecurse{630}{bbb }

\stopDatum

\startDatum[title={secC}]%

  \dorecurse{50}{ccc }

\stopDatum

\startDatum[title={secD}]%

  \dorecurse{50}{ddd }

\stopDatum

\startDatum[title={secE}]%

  \dorecurse{50}{eee }

\stopDatum


\stoptext
%==
%==


I'd like to write the marking of the very first text at the current page to the 
header. That seems to be a bit tricky, at least for me. (I'm afraid that 
\getmarking[xxx][top] was intended for that and it is not feasible at all.)

At page 1 the header should read "secA", at page 2 again "secA" (because the 
very first text belongs to "secA"), and at page 3 "secC" (because the very 
first text (the section title) belongs to "secC"). Unfortunatly \getmarking[][] 
does not behave like I expacted.

I understand the keywords of \getmarking in the wiki 
(https://wiki.contextgarden.net/Command/getmarking) as listed below:
• previous: marking at the bottom of the page BEFORE the current page (no page 
before then empty)
• next: marking at the top of the page AFTER the current page (no page after 
then bottom of current page)

• top: marking at the top of the current page
• bottom: marking at the bottom of the current page

• first: first marking that starts at the current page (no first than behaving 
like top)
• last: last marking that starts at the current page (no last than behaving 
like bottom)

• current: last stored marking while deciding on pagebreaking between the 
current page and the (potential) following page
• default: first

According to these thoughts, I started with \getmarking[Datum][top]. But "top" 
seems not to work, there is no difference between "top" and "first", "top" 
behaves like "first".

My second thought: Generally \getmarking[Datum][first] would be perfect, so 
I've thought something like

    \doifelse{\fetchmark[Datum][next] of the page before the current 
page}{\fetchmark[Datum][previous]}
      {\getmarking[Datum][previous]}
      {\getmarking[Datum][first]}

could work. (Honestly I don't know how to do "\fetchmark[Datum][next] of the 
page before the current page}". The first page would need a special treatment 
too.)

But: At page 2 \getmarking[Datum][next] (Nx) contains "secB" but at top of page 
3 is not "secB" but "secC". So \getmarking[Datum][next] does not seem to 
contain the correct information I need, therefore I don't get any further.


Any ideas: How do I write the marking of the very first text at the current 
page to the header?


Thank you in advance, Matthias

___
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 Alan Bowen
Hi, Bruce—
This does not quite work—the page numbers are those of the first page of
the chapter, not the last. But thanks for the tip about \writetolist.
Perhaps I can get that to work.

What I need are ToC entries like
AuthorName
ShortTitle   1–6

I need this pagination because one of the requirements of continuous
publication on the OJS is that once an item is published changes are not
permitted. So I cannot go with normal continuous publication since, for us
anyway, items are not processed in strict sequential order (e,g., we may
have, paper+paper+ review+paper...)

If it helps: I currently have

\startFMTitle[reference=\Reference, title={}][itemAuthor=AuthorName,
itemTitle=ShortTitle,...]
\setuplist[FMTitle][state=start, alternative=startendfmpages,
criterium=all,]
(\Reference is defined at the in the preamble to input of the
file/component.)

\definelistalternative[startendfmpages][renderingsetup=list:startendfmpages]

\startsetups[list:startendfmpages]
  \structurelistuservariable{itemAuthor}\crlf
  \structurelistuservariable{itemTitle}\hfill%
   \at[\currentlistentrypagenumber]–\at[\lastpagenumber]
\vglue1pc
\stopsetups
where I have \reference[\lastpagenumber]{} at the end of the file. But this
gives me ??–viii (the viii is correct and interactive) for the FMTitle.
Sadly the entries for all my other Titles (SourceTitle, StudyTitle...) is
??–viii.
(Each title is a modified chapter.)

Curiously, \at[\Reference]–\convertnumber{r}{\lastpagenumber}  and
\at[\Reference]–\at[\lastpagenumber] work properly in the body text.
The overall structure is project-product sort with many components in the
product.

This is probably TMI. The bottom line is that I am truly stumped.

All best,
Alan

On Wed, Apr 3, 2024 at 6:56 AM Bruce Horrocks  wrote:

>
>
> > On 30 Mar 2024, at 19:59, Alan Bowen  wrote:
> >
> > 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.
>
>
> I'm not quite sure what you want to do with these numbers: something like
> printing out a contents page but instead of the start page of a chapter it
> shows the last page of the chapter?
>
> If so then try creating a custom list and use \writetolist immediately
> before each \stopchapter command?
>
> \definelist[LastPages][criterium=all]
> \starttext
> \completecontent
> \page
> \completelist[LastPages]
> \page
> \dorecurse{10}{
>   \startchapter[title={This is my chapter}]
>   This is a chapter\par \dorecurse{6}{\input knuth } \input
> math-kontinuitet-sv
>
>   \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
>   \stopchapter
> }
> \stoptext
>
> But I can't get the number option of \writetolist to work - the "3." above
> is ignored. :-(
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___
> 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
>
> ___
>
___
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] start/end pages in ToC

2024-03-26 Thread Alan Bowen
Our journal is currently in the process of moving to continuous publication
of items in a given volume as they are ready. This entails re-jigging the
ToC so that it now includes the start and end page numbers of each item. So
far, I have everything pretty much in the right place, but for the page
numbers I am getting only “??”. I am not sure why this is happening and
would be grateful if someone could tell me why or point me to
documentation that explains the problem and how to solve it.

Many thanks in advance.

My minimalish working example:

\definehead[SourceTitle][chapter]
\setuphead[SourceTitle][page=yes,
footer={ItemData}]

\definehead[StudyTitle][chapter]
\setuphead[StudyTitle][page=yes,
footer={ItemData}]

\definetext[ItemData][footer][
{\at[\Reference]–
\at[\namedstructureuservariable{}{authorInitials}endPage]}
]
\setuplist[SourceTitle][
state=start,
textcolor=black,
alternative=startendpages,
criterium=all,
headnumber=no,
interaction=page,
numberalign=flushright,
before={\blank[2.2ex, fixed]},
inbetween=\endgraf,
]

\setuplist[StudyTitle][
state=start,
textcolor=black,
alternative=startendpages,
criterium=all,
headnumber=no,
interaction=all,
numberalign=flushright,
before={\blank[2.2ex, fixed]},
inbetween=\endgraf,
]

\define\ToCEntry{%
\structurelistuservariable{author}\crlf
\structurelistuservariable{title}\hfill%
\at[\structurelistuservariable{reference}]–%
\at[\structurelistuservariable{authorInitials}endPage]
}

\definelistalternative[startendpages]
[renderingsetup=list:startendpages]

\startsetups[list:startendpages]
{\ToCEntry}
\vglue1pc
\stopsetups

\starttext

{\tfa\bf Contents}

\blank[line, fixed]
\WORD{Sources}
\blank[halfline, fixed]
\placelist[SourceTitle][criterium=all]

\blank[line, fixed]
\WORD{Studies}
\blank[halfline, fixed]
\placelist[StudyTitle][criterium=all]

\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSo01}
\startSourceTitle[reference={\Reference},
bookmark=Source01,
title={}][
title=Source01,
author=Author01,
authorInitials=ABC,
reference={\Reference},
]
\input knuth
\page
\dorecurse{25}{\input ward\par}
\reference[ABCendPage]{}
\stopSourceTitle
\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSo02}
\startSourceTitle[reference={\Reference},
bookmark=Source02,
title={}][
author=Author02,
title=Source02,
authorInitials=PQR,
reference={\Reference},
]

\input knuth
\page
\dorecurse{10}{\input ward\par}
\reference[PQRendPage]{}
\stopSourceTitle
\page[makeup]

\setnumber[userpage][1]
\def\Reference{RefSt01}
\startStudyTitle[reference={\Reference},
bookmark=Study01,
title={}][
author=Author03,
title=Study01,
authorInitials=XYZ,
reference={\Reference},
]
\input knuth
\blank[big]
\page
\dorecurse{15}{\input ward\par}
\reference[XYZendPage]{}
\stopStudyTitle
\page[makeup]
\stoptext

Alan
___
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: Use of marking

2024-03-21 Thread Thomas Meyer

Hi Pablo and Bruce,

thank you very much for your two solutions. That helps me enormously now.

Greetings
Thomas

Am 21.03.24 um 16:34 schrieb Bruce Horrocks:

\startsetups[doc:header]
   \getmarking[chapternumber] \space - \space \getmarking[chapter]
   \space :: \space
   \getmarking[sectionnumber] \space - \space \getmarking[section]
\stopsetups
\setupheadertexts[\setup{doc:header}]

\starttext
\dorecurse{10}{
   \startchapter[title={This is my chapter}]
   This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

   \startsection[title={This is my section}]
This is a section\par \dorecurse{6}{\input knuth }\input math-kontinuitet-sv
   \stopsection
   \stopchapter
}
\stoptext
___
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: Use of marking

2024-03-21 Thread Bruce Horrocks


> On 20 Mar 2024, at 18:45, Andres Conrado Montoya  
> wrote:
> 
> 2. As far as I have found, including the chapter/section number in the 
> marking is not really a trivial task. I usually hack something using 
> \headnumber and \getmarking, like so: 

You can do the following:

\startsetups[doc:header]
  \getmarking[chapternumber] \space - \space \getmarking[chapter]
  \space :: \space
  \getmarking[sectionnumber] \space - \space \getmarking[section]
\stopsetups
\setupheadertexts[\setup{doc:header}]

\starttext
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

  \startsection[title={This is my section}]
   This is a section\par \dorecurse{6}{\input knuth }\input math-kontinuitet-sv
  \stopsection
  \stopchapter
}
\stoptext

Caveat: it needs an if...then test around the section number for when a section 
hasn't started.
—
Bruce Horrocks
Hampshire, UK

___
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] multicolumn title and abstact (bachotex) using tugboat.mkxl

2024-03-07 Thread Damien Thiriet via ntg-context

Hello,


I am currently writing my paper for last year's BachoTeX proceedings.
I am using tugboat.mkxl module to design the layout.

In bachotex proceedings, the author's data and abstract are on a single 
column and the article is usually typeset on two columns.

Comments in tugboat.mkxl states:

%D We have several column mechanisms and they all serve a different 
purpose. Here we
%D use pagecolumns. They support much of what we can do in single 
columns, but of
%D course there are exceptions. Floats can go into columns of aremoved 
to the top or
%D bottom when there is no room. We don't span mid column. Notes can go 
in columns
%D or at the end. We can start with a single column (for titles and 
such).


I can't figure out which part of the file should be used/adapted to 
start with a single column.
What I did is to put datas and abstract in a frame and use \placefigure. 
As stated in pagecolumns
manual, everything is put on the top of next page. (BTW, there is a 
typo: «of aremoved»)


I don't know, whether this MWE helps is relevant, but just in case, here 
is what I did:


* copy tugboat.mkxl to a new file p-bachotex.mkxl
* changed p-bachotex.mkxl like this:

\startsetups bachotex:naglowek:columns
\defineframedtext [Dane]
\setupframedtext
[Dane]
[width=18cm ,
 align=normal,
 frame=no]
\definenarrower
[Streszczenia]
[2*middle]

\startplacefigure [location={here,none}]
{\startDane
{\tfa\getvariable{tugboat}{author}}\par
\getvariable{tugboat}{address}\par
{\tt\getvariable{tugboat}{email}}\par

\startStreszczenia
\doifelsebufferempty {abstract} {
% no abstract
} {
\blank[line]

\enforced\let\\\endgraf
\setups[tugboat:abstract:setup]
\startAbstracts[title={Abstract}]
\stopAbstracts
}
\stopStreszczenia
\stopDane}
\stopplacefigure
\stopsetups

\startsetups tugboat:article:start

  \starttext

\setups{tugboat:columns:presets}

\setups{tugboat:banner:setup:\getvariable{tugboat}{type}}

\setupheadertexts
[\setups{tugboat:banner:text:article}]
[pagenumber]

\setuppagenumber
[number=\getvariable{tugboat}{page}]

\startmode[columns]
\startpagecolumns
\stopmode

\setups[tugboat:introduction:article]
\doifmodeelse{columns}{
\setups{bachotex:naglowek:columns}
} {
\setups{bachotex:naglowek:nocolumns}
}

\stopsetups

My article begins so:

\enablemode [columns]
\usemodule [bachotex]

% skipped tugboat variables for this MWE

\StartAbstract
  \input tufte
\StopAbstract
\StartArticle
   \input knuth
\StopArticle

Thank you for your help

Damien T
___
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) 
<https://www.w3.org/TR/jlreq/#cl-19>//, //hiragana (cl-15) 
<https://www.w3.org/TR/jlreq/#cl-15>// and //katakana (cl-16) 
<https://www.w3.org/TR/jlreq/#cl-16>// characters, no extra spacing 
appears between their //character frame 
<https://www.w3.org/TR/jlreq/#term.character-frame>//. This is called 
solid setting (see //Figure 5 <https://www.w3.org/TR/jlreq/#fig1_8>//)./


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,
  ali

[NTG-context] Re: \starttable questions

2024-01-25 Thread Jim
On Thu, Jan 25, 2024 at 22:22 (+0100), Wolfgang Schuster wrote:

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

thanks for the response and the sample code.

[ Note to anyone else trying out this example: there are non-breakable
  spaces above, and depending on your system if you copy and paste them
  into a file, they will cause this code to fail.  ]


I won't argue with you about readability of tables, but if I am typesetting
something for someone and they want it a certain way, I don't want to get
into an argument about it with them either.  :-)


The nice thing about your setup above is that it is nice and structured.
But if a table calls for some row, column or cell to be treated
differently, I guess I am in for some more reading.

Cheers.
Jim
___
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: \setupitemgroup for footnotes

2023-09-25 Thread Henning Hraban Ramm

Am 25.09.23 um 17:52 schrieb Pablo Rodriguez:

Dear list,

I have the following sample (with current latest from 2023.09.18 21:13):

 \setuppapersize[A6]
 \starttext
 \startsetups[forfootnote]
 \setupitemgroup
[itemize][1]
[   before={\endgraf{\ttbf[before]}\endgraf},
 after={\endgraf{\ttbf [after]}\endgraf}]
 \stopsetups

 \setupnote[footnote][setups=forfootnote]

 \footnote{\startitemize
  \startitem Choose the correct answer.
  \startitemize
  \item This one
  \stopitemize
  \stopitem
 \stopitemize}
 \stoptext

Excuse my ignorance, but which is the right way to get the itemize setup
only for footnotes?


I would use \defineitemgroup to define your own, like "footnoteitemize".

https://wiki.contextgarden.net/Command/defineitemgroup

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

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


[NTG-context] \setupitemgroup for footnotes

2023-09-25 Thread Pablo Rodriguez
Dear list,

I have the following sample (with current latest from 2023.09.18 21:13):

\setuppapersize[A6]
\starttext
\startsetups[forfootnote]
\setupitemgroup
   [itemize][1]
   [   before={\endgraf{\ttbf[before]}\endgraf},
after={\endgraf{\ttbf [after]}\endgraf}]
\stopsetups

\setupnote[footnote][setups=forfootnote]

\footnote{\startitemize
 \startitem Choose the correct answer.
 \startitemize
 \item This one
 \stopitemize
 \stopitem
\stopitemize}
\stoptext

Excuse my ignorance, but which is the right way to get the itemize setup
only for footnotes?

Many thanks for your help,

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

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


[NTG-context] Re: how to define an environment with key=value arguments

2023-09-08 Thread Henning Hraban Ramm

Am 08.09.23 um 17:02 schrieb Henning Hraban Ramm:
We can discuss the details next week and you put the resulting 
template on the wiki.


Ah, I guess I understand the template mechanism. Yet again glorious 
setups. Will probably manage.


So far:

\definepageinjection[chapter:start][
  page=left,
  alternative=setups,
  setups=frontispiz,
  color=white,
  background=color,
  backgroundcolor=Eifel,
]

\startsetups[frontispiz]
\starttransparent[tlumi]%
\externalfigure[\structureuservariable{image}][
  width=\measure{MaxWidth},
]%
\stoptransparent%
\stopsetups

\setuphead[chapter][
  page=right,
  style=\ChapterFont,
  beforesection={\pageinjection[chapter:start]},
  command=\ChapterStart,
  before={\startcolumnset[Spalten]},
  after={\vskip-\lineheight}, % fix column start
  inbetween=,
  aftersection={\stopcolumnset},
]

\startchapter[title={Prolog 2: Reiseführer}][
  motto={(quotation.}}, % used in \ChapterStart
  image={00 Lavakeller Mendig g}, % wrong
  blank=2,
]


Not a MWE, I know.
Here’s a screenshot:
https://yemaya.fiee.net/s/G2NcwE8qQrLAx8B

(Funny, I never needed all of before, after, beforesection and 
aftersection so far.)


The injection is a frame, that’s great, because I can set the 
background, and \externalfigure starts at (0,0).


But it uses its own page size, I don’t understand why. I need the 
bleed/trim area.


If I use \setlayer in the setup, the content gets placed on the next 
page, i.e. under the text.


\structureuservariable{image} in the setup gets the value from the 
_next_ chapter. Maybe the approach in from the source with

\dummyparameter\c!name
would work better, but I don’t know how to transfer it.

Hraban


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

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

[NTG-context] TOC with sections titles and page numbers like a paragraph beneath chapter

2023-09-03 Thread jbf
I am attempting to get a TOC that looks like the following (in other 
words with section titles and their relative page numbers in a block 
below the chapter):


Chapter 1 ...5

Section 1   5, Section 2  6, Section 3  7,

Section 4   8, Section 5   9 etc

Chapter 2 10

Section 1   10, Section 2  11, Section 3  12,

Section 4   13, Section 5   14 etc

As I really had no idea how to do this, I found 
https://wiki.contextgarden.net/Horizontal_Table_of_Contents thinking it 
might help, but none of it compiles (for me) in LMTX. So I tried 
something different, e.g.


\definelist[chapter]

\setuplist[chapter][label=yes,distance=1.5cm,alternative=c,style=normal,before=\blank] 



\definelist[section]

\setuplist[section] [textcommand=\setups{SecToc}]

\setupcombinedlist

[content]o

[list={chapter,section}]


\startsetups [SecToc]

\startframedtext [width=\textwidth, align=middle, frame=off]

\placelist [section]

[

criterium=chapter,

]

\stopframedtext

\stopsetups

While that produces a result, it is nothing like what I want above. Has 
anyone put together a TOC of this kind and might be able to give me a 
hint to follow?


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

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

[NTG-context] Re: Better option for a macro with lots of arguments

2023-08-23 Thread Hans Hagen via ntg-context

On 8/23/2023 4:12 AM, Andres Conrado Montoya wrote:

I have been using the following macro to add a bunch of sections to the
start of chapters in a book, it works but I think is kind of weak:

%%%

\define[7]\metadatos{
   \startsection[title={Resumen}] #1 \stopsection
   \startsection[title={Palabras clave}] #2 \stopsection
   \start
   \language[en]
   \startsection[title={Abstract}] #3  \stopsection
   \startsection[title={Keywords}] #4 \stopsection
   \stop
   \startsection[title={¿Cómo citar este capítulo? / How to cite this book?}]
 \startsubsection[title={Apa}] #5 \stopsubsection
 \startsubsection[title={Chicago}] #6 \stopsubsection
 \startsubsection[title={MLA}] #7 \stopsubsection
\stopsection
}

\starttext
% Then I call the macro like this:
\metadatos{spanish abstract \input knuth}{some, comma, separated, keywords,
in, spanish}{english abstract \input knuth}{same, comma, separated,
keywords, in, english}{Apa citation style for this article}{Chicago
citation style for this article}{MLA citation style for this article}
\stoptext
%%%

I've been exploring different ways to do it better, but with not much luck,
I was thinking something based in key=value assignments? setups? datasets?
Not really sure, but If you know a better solution or point me in the
direction of something I can use to replace that macro, it would be greatly
appreciated.

\startsetups [document:start]
   \doifdocumentvariable {englishabstract} {
 \startsection[title={Resumen}]
   \documentvariable{englishabstract}
 \stopsection
   }
   \doifdocumentvariable {spanisabstract} {
 \startsection[title={Palabras clave}]
   \documentvariable{spanishabstract}
 \stopsection
   }
   ...
\stopsetups

\startbuffer english
   ...
\stopbuffer

\startbuffer spanish
   ...
\stopbuffer


\startsetups [document:stop]
   ...
\stopsetups


\startdocument
  [spanisabstract={\getbuffer[spanish]},
   ]

...

\stopdocument

untested, just keyed in


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Re: Penalties and overprinting in tabulate

2023-08-21 Thread Hans Hagen

On 8/21/2023 10:24 AM, denis.ma...@unibe.ch wrote:

-Ursprüngliche Nachricht-
Von: Hans Hagen 
Gesendet: Freitag, 18. August 2023 17:10
An: ntg-context@ntg.nl
Betreff: [NTG-context] Re: Penalties and overprinting in tabulate

On 8/18/2023 4:36 PM, denis.ma...@unibe.ch wrote:

Dear list,

typesetting the example below results in lines printed above each other?

Without the penalties, this doesn't happen. What am I missing here? How I
can use the penalties without the not wanted overprinting?


Best,
Denis


\startsetups[mypenalties]
  \setdefaultpenalties
  \setpenalties\clubpenalties{1}{150}
  \setpenalties\widowpenalties{1}{1}
  \setpenalties\displaywidowpenalties{1}{1}
\stopsetups

\setuplayout[setups=mypenalties]

\starttext
\starttabulate[|p(.15\textwidth)|p|]
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf 
sdf asdf asdf

asdf asdf asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf

  \NC \NR
  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf

asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf

  \NC \NR
  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf

asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf

  \NC \NR
  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf

asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf

  \NC \NR
  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf

asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf

  \NC \NR
\stoptabulate

\stoptext

\startsetups[nopenalties]
  \setdefaultpenalties
\stopsetups


% \setuptabulate[setups=nopenalties] % in next version

\setuptabulate[inner=\setups{nopenalties}]

or

\starttabulate[|p(.15\textwidth)s{nopenalties}|ps{nopenalties}|]

but i admit it needs some thought ... outer level only but that is also pretty
much an engine thing then (no big deal but ... needs pondering)


Thanks, I guess that should be added to this page: 
https://wiki.contextgarden.net/Tabulate
I'll add it to my list of todos..., but just to make sure the explanation will be 
correct: what exactly is happening here? The tabulate environment will 
"inherit" the outer environments setups, but why does this result in the 
overprinting?

that is catched in a next upoload

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Re: Penalties and overprinting in tabulate

2023-08-21 Thread denis.maier
> -Ursprüngliche Nachricht-
> Von: Hans Hagen 
> Gesendet: Freitag, 18. August 2023 17:10
> An: ntg-context@ntg.nl
> Betreff: [NTG-context] Re: Penalties and overprinting in tabulate
> 
> On 8/18/2023 4:36 PM, denis.ma...@unibe.ch wrote:
> > Dear list,
> >
> > typesetting the example below results in lines printed above each other?
> Without the penalties, this doesn't happen. What am I missing here? How I
> can use the penalties without the not wanted overprinting?
> >
> > Best,
> > Denis
> >
> >
> > \startsetups[mypenalties]
> >  \setdefaultpenalties
> >  \setpenalties\clubpenalties{1}{150}
> >  \setpenalties\widowpenalties{1}{1}
> >  \setpenalties\displaywidowpenalties{1}{1}
> > \stopsetups
> >
> > \setuplayout[setups=mypenalties]
> >
> > \starttext
> > \starttabulate[|p(.15\textwidth)|p|]
> > \NC asdf \NC a asdf asdf asdf asdf asdf 
> > asdf sdf asdf asdf
> asdf asdf asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
> >  \NC \NR
> >  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf 
> > asdf asdf
> asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
> >  \NC \NR
> >  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf 
> > asdf asdf
> asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
> >  \NC \NR
> >  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf 
> > asdf asdf
> asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
> >  \NC \NR
> >  \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf 
> > asdf asdf
> asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
> >  \NC \NR
> > \stoptabulate
> >
> > \stoptext
> \startsetups[nopenalties]
>  \setdefaultpenalties
> \stopsetups
> 
> 
> % \setuptabulate[setups=nopenalties] % in next version
> 
> \setuptabulate[inner=\setups{nopenalties}]
> 
> or
> 
> \starttabulate[|p(.15\textwidth)s{nopenalties}|ps{nopenalties}|]
> 
> but i admit it needs some thought ... outer level only but that is also pretty
> much an engine thing then (no big deal but ... needs pondering)

Thanks, I guess that should be added to this page: 
https://wiki.contextgarden.net/Tabulate 
I'll add it to my list of todos..., but just to make sure the explanation will 
be correct: what exactly is happening here? The tabulate environment will 
"inherit" the outer environments setups, but why does this result in the 
overprinting?

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

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


[NTG-context] Enable interaction on custom apa cite variant

2023-08-19 Thread Jethro Djan
Hi,

I would like a variant of cite per the APA specification that removes the
bracket when quoted in mathematical definitions, theorems, etc. I could of
course do it manually for reach using right= and left= but I didn't want to
do it every time. I have come up with this MWE:

\startbuffer[ref]
@book{burago2022course,
  title={A course in metric geometry},
  author={Burago, Dmitri and Burago, Yuri and Ivanov, Sergei},
  volume={33},
  year={2022},
  publisher={American Mathematical Society}
}
\stopbuffer

\setupinteraction[state=start, color=blue]
\setupcolors[state=start]

\usebtxdataset[ref.buffer]

\usebtxdefinitions[apa]
\definebtx
[apa:cite:theorem]
[apa:cite]
\startsetups btx:apa:cite:theorem
\btxflushauthorname{author}
\btxcomma
\btxflush{year}
\fastsetup{btx:cite:righttext}
\stopsetups

\setupenumeration[
  before={\blank[medium]},
  after={\blank[medium]},
  alternative=serried,
  right=,
  headcommand=\groupedcommand{}{.},
  distance=0.5em,
  width=fit,
  headstyle=bold,
  titlestyle=bold,
  way=bytext,
  conversion=numbers,
  prefix=chapter,
  list=all,
  title=yes,
  indentnext=no,
]

\defineenumeration[definition][
  text=Defintion,
  style=normal,
  number=no,
]

\starttext

\startdefinition{\cite[righttext={{ p.\nbsp 1}},
alternative=theorem][burago2022course]}

This is something

\stopdefinition

\startsubject[title={References}]
\placelistofpublications
\startsubject

\stoptext

The problem with this is that the citation is not interactive like it would
be if I used apa:cite:authoryear and just removed the parentheses in the
options. How do I get it to highlight blue and be interactive like the
default behaviour when you turn on interaction? Also this is probably
overkill so if there is a better way to achieve this...

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

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

[NTG-context] Re: Penalties and overprinting in tabulate

2023-08-18 Thread Hans Hagen

On 8/18/2023 4:36 PM, denis.ma...@unibe.ch wrote:

Dear list,

typesetting the example below results in lines printed above each other? 
Without the penalties, this doesn't happen. What am I missing here? How I can 
use the penalties without the not wanted overprinting?

Best,
Denis


\startsetups[mypenalties]
 \setdefaultpenalties
 \setpenalties\clubpenalties{1}{150}
 \setpenalties\widowpenalties{1}{1}
 \setpenalties\displaywidowpenalties{1}{1}
\stopsetups

\setuplayout[setups=mypenalties]

\starttext
\starttabulate[|p(.15\textwidth)|p|]
\NC asdf \NC a asdf asdf asdf asdf asdf asdf 
sdf asdf asdf asdf asdf asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
\stoptabulate

\stoptext

\unprotect
\c_tabl_tabulate_splitlinemode\plustwo
\protect

maybe in the meantime that should be default

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Re: Penalties and overprinting in tabulate

2023-08-18 Thread Hans Hagen

On 8/18/2023 4:36 PM, denis.ma...@unibe.ch wrote:

Dear list,

typesetting the example below results in lines printed above each other? 
Without the penalties, this doesn't happen. What am I missing here? How I can 
use the penalties without the not wanted overprinting?

Best,
Denis


\startsetups[mypenalties]
 \setdefaultpenalties
 \setpenalties\clubpenalties{1}{150}
 \setpenalties\widowpenalties{1}{1}
 \setpenalties\displaywidowpenalties{1}{1}
\stopsetups

\setuplayout[setups=mypenalties]

\starttext
\starttabulate[|p(.15\textwidth)|p|]
\NC asdf \NC a asdf asdf asdf asdf asdf asdf 
sdf asdf asdf asdf asdf asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
 \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
 \NC \NR
\stoptabulate

\stoptext

\startsetups[nopenalties]
\setdefaultpenalties
\stopsetups


% \setuptabulate[setups=nopenalties] % in next version

\setuptabulate[inner=\setups{nopenalties}]

or

\starttabulate[|p(.15\textwidth)s{nopenalties}|ps{nopenalties}|]

but i admit it needs some thought ... outer level only but that is also 
pretty much an engine thing then (no big deal but ... needs pondering)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Penalties and overprinting in tabulate

2023-08-18 Thread denis.maier
Dear list,

typesetting the example below results in lines printed above each other? 
Without the penalties, this doesn't happen. What am I missing here? How I can 
use the penalties without the not wanted overprinting?

Best,
Denis


\startsetups[mypenalties]
\setdefaultpenalties
\setpenalties\clubpenalties{1}{150}
\setpenalties\widowpenalties{1}{1}
\setpenalties\displaywidowpenalties{1}{1}
\stopsetups

\setuplayout[setups=mypenalties]

\starttext
\starttabulate[|p(.15\textwidth)|p|]
   \NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf 
asdf asdf asdf asdf asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
\NC \NR
\NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
\NC \NR
\NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
\NC \NR
\NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
\NC \NR
\NC asdf \NC a asdf asdf asdf asdf asdf asdf sdf asdf asdf asdf asdf 
asdf asdf asdf ashjkdf askldf askdlfjöaslkdfjaösdlf
\NC \NR
\stoptabulate

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

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

[NTG-context] Re: breakpoints in verbatim text

2023-08-18 Thread Hans Hagen

On 8/18/2023 1:02 PM, Wolfgang Schuster wrote:

Alex Leray schrieb am 18.08.2023 um 12:19:

Hello Wolfgang,

Le 17/08/23 à 18:56, Wolfgang Schuster a écrit :
Is it correct all your listing are HTML code and you need line breaks 
for the entries of the href attributes?


The content is from a dutch net-artist artist from the early days of 
the public web, and is often (volontary) mixing different natural nd 
machine langages. Not all snippets are HTML, but most of them are some 
sort of HTML pidgin.



I see, the typing environment is in this case the safest option to 
ensure special characters like % remain i the output.


For simple text without special characters you could have switched to 
the lines environment and use a monospaced but

I wouldn't trust it here (even when you enable \asciimode).



Syntax highlighting of the code listing isn't needed in your case.


No, I don't need syntax highlighting

My problem is solved using manual zero width spaces at the moment but 
I'd be interested to find a more structural solution.


Checking at the Context source code I would have thought that 
breakpoints were possible withing typing env. See


https://source.contextgarden.net/tex/context/base/mkiv/buff-ver.mkiv?search=typing#l51

It would be interesting to document on the wiki that behavior, which I 
can do later when my understanding is better.


The typing environment disables the breakpoint (and a few other) 
mechanism because they can lead to undesired
side effects but Hans suggestion to provide a hook which can be used to 
re-enable the feature, e.g.


     \startsetups [typing:mine]
         \setbreakpoints[compound]
     \stopsetups

     \setuptyping [CUSTOM] [setups=typing:mine]

The only flaw I can see in the suggestion is the use of the 
\everyinitializeverbatim register because it is used for
inline and display verbatim. A better place to add the option is 
\buff_verbatim_initialize_typing_two for \starttyping

and \buff_verbatim_initialize_type_two for \type.


ok

--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Re: breakpoints in verbatim text

2023-08-17 Thread Alex Leray

Thanks,

Unfortunatly, it doesn't work (no difference in output with or without 
the `setups` parameter)


I'm not up-to-date, Should I update? Here is my version.

mtx-context | current version: 2023.03.10 12:15

Many thanks

Le 17/08/23 à 16:32, Hans Hagen a écrit :

On 8/17/2023 2:41 PM, Alex Leray wrote:

Hi,

I'd like to break lines in verbatim on certain characters like "/".

I can do it for normal texte, but not inside typing environment.

Is there a way to achieve this?


For now do this:

   \appendtoks
  \usesetupsparameter\typingparameter
   \to \everyinitializeverbatim

and then

   \startsetups typing:mine
   \setbreakpoints[compound]
   \stopsetups

with

   \starttyping[lines=yes,setups=typing:mine]

I need Wolfgang to check it for possible interferences.

Hans


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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


maillist : ntg-context@ntg.nl / 
https://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


--
Alexandre Leray
+32 487 947 030

Avez-vous pensé à (vous) offrir Médor ?
https://medor.coop/ideescadeau
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: breakpoints in verbatim text

2023-08-17 Thread Hans Hagen

On 8/17/2023 2:41 PM, Alex Leray wrote:

Hi,

I'd like to break lines in verbatim on certain characters like "/".

I can do it for normal texte, but not inside typing environment.

Is there a way to achieve this?


For now do this:

  \appendtoks
 \usesetupsparameter\typingparameter
  \to \everyinitializeverbatim

and then

  \startsetups typing:mine
  \setbreakpoints[compound]
  \stopsetups

with

  \starttyping[lines=yes,setups=typing:mine]

I need Wolfgang to check it for possible interferences.

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


[NTG-context] Re: Experiments with \doloopoverlist

2023-08-17 Thread Hans Hagen via ntg-context

On 8/17/2023 3:50 AM, Andres Conrado Montoya wrote:

Hello List.

I've been trying to typeset a somewhat complex list of authors for several
articles and a book.
My proof of concept seems to work fine, however, I know I am doing weird
things that I think could probably be done in a better way. I'm using
datasets and a recursion, kind of hacky but I can't find a better way of
handling it. Specifically I would like to know:
1. Is there a way of getting the length of a filled dataset? (how many
entries it contains)
2. Is it OK to use \startuserdata \stopuserdata without its inlineuserdata?
Is there an alternative that does not require inlineuserdata?


Weird is relative. Just use what you like most. One could for instance 
use the publication mechanism but you need to set up a bit more (see 
manual for example of usa as database).


Now datasets. It is not hard to add a size query so I added that. Your 
data is missins commas so let's fix that first


\definedataset[autores]

\setdataset[autores]
[
nombre={Angie Natalia Farfán Acevedo},

cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002125949},
orcid={https://orcid.org/0009-0007-0765-4241},

gscholar={https://scholar.google.com/citations?user=GpYTTU0J&hl=es&authuser=1},
]

\setdataset[autores]
[
nombre={Ivon Andrea Rodríguez Román},

cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=027033},
orcid={https://orcid.org/0009-0001-1183-6829},

gscholar={https://scholar.google.com/citations?user=iz8SQNcJ&hl=es},
]

\setdataset[autores]
[
  nombre={Angie Caterin Garzón González},

cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002128501},
  orcid={https://orcid.org/0009-0009-0990-6902},

gscholar={https://scholar.google.com/citations?view_op=list_works&hl=es&user=5WqcOeEJ},
]

\setdataset[autores]
[
  nombre={Heidy Paola Veira Tenorio},

cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127550},
  orcid={https://orcid.org/0009-0008-4076-7317},

gscholar={https://scholar.google.es/citations?view_op=new_profile&hl=es&authuser=1},
]

\setdataset[autores]
[
nombre={Yerly Lorena Diaz Aldana},

cvlac={https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127754},
orcid={https://orcid.org/0009-0008-1720-4057},

gscholar={https://scholar.google.com/citations?hl=es&user=0obyCwkJ&view_op=list_works&gmla=AOV7GLPWRTK-xooHNe0iQ3uubfcSbG__GY_Guy35FdaqDJA3OfLLtp01-E1kzjxUhltlsfj494MaoQFkk9U9hCFYSipoR8aX0Vu2E6sV},
    ]

There is no need to use userdata as intermediate:

% \startsetups[userdata:idautor]
%   \dontleavehmode
%   \imghref
% {\externalfigure[cvlac.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{vclac}}
% \quad
%   \imghref
% {\externalfigure[orcid.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{orcid}}
% \quad
%   \imghref
% {\externalfigure[gscholar.pdf][logo]}
% {\datasetvariable{autores}{\recurselevel}{nombre}}
% \quad
%   \datasetvariable{autores}{\recurselevel}{nombre}\par
% \stopsetups

Just loop over the set and call up the variables in the setup:

% \startdocument
%   \dorecurse{\datasetsize{autores}}{
% \setups[userdata:idautor]
%   }
% \stopdocument

However, i can provide a processor:

% \startsetups[userdata:idautor]
%   \dontleavehmode
%   \imghref
% {\externalfigure[cvlac.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{vclac}}
% \quad
%   \imghref
% {\externalfigure[orcid.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{orcid}}
% \quad
%   \imghref
% {\externalfigure[gscholar.pdf][logo]}
% {\datasetvariable{autores}{\datasetindex}{nombre}}
% \quad
%   \datasetvariable{autores}{\datasetindex}{nombre}\par
% \stopsetups

As we know what dataset we process:

\startsetups[userdata:idautor]
  \dontleavehmode
  \imghref
{\externalfigure[cvlac.pdf][logo]}
{\datasetentry{vclac}}
\quad
  \imghref
{\externalfigure[orcid.pdf][logo]}
{\datasetentry{orcid}}
\quad
  \imghref
{\externalfigure[gscholar.pdf][logo]}
{\datasetentry{nombre}}
\quad
  \datasetentry{nombre}
  \par
\stopsetups

We then end up with:

\startdocument
  \processdataset[autores][userdata:idautor]
\stopdocument

I'll mail you the patch. Copy it to the right place and remake the format.

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-


[NTG-context] Experiments with \doloopoverlist

2023-08-16 Thread Andres Conrado Montoya
Hello List.

I've been trying to typeset a somewhat complex list of authors for several
articles and a book.
My proof of concept seems to work fine, however, I know I am doing weird
things that I think could probably be done in a better way. I'm using
datasets and a recursion, kind of hacky but I can't find a better way of
handling it. Specifically I would like to know:
1. Is there a way of getting the length of a filled dataset? (how many
entries it contains)
2. Is it OK to use \startuserdata \stopuserdata without its inlineuserdata?
Is there an alternative that does not require inlineuserdata?

%% MWE:
\setupinteraction[state=start]

\define[2]\imghref{\bgroup\goto{#1}[url(#2)]\egroup}
\defineexternalfigure[logo][height=1em]

\definedataset[autores]

\setdataset[autores][
  nombre={Angie Natalia Farfán Acevedo},
  cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002125949
},
  orcid={https://orcid.org/0009-0007-0765-4241},
  gscholar={
https://scholar.google.com/citations?user=GpYTTU0J&hl=es&authuser=1},
]
\setdataset[autores][
  nombre={Ivon Andrea Rodríguez Román}
  cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=027033
}
  orcid={https://orcid.org/0009-0001-1183-6829}
  gscholar={https://scholar.google.com/citations?user=iz8SQNcJ&hl=es}
]
\setdataset[autores][
  nombre={Angie Caterin Garzón González}
  cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002128501
}
  orcid={https://orcid.org/0009-0009-0990-6902}
  gscholar={
https://scholar.google.com/citations?view_op=list_works&hl=es&user=5WqcOeEJ
}
]
\setdataset[autores][
  nombre={Heidy Paola Veira Tenorio}
  cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127550
}
  orcid={https://orcid.org/0009-0008-4076-7317}
  gscholar={
https://scholar.google.es/citations?view_op=new_profile&hl=es&authuser=1}
]
\setdataset[autores][
  nombre={Yerly Lorena Diaz Aldana}
  cvlac={
https://scienti.minciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0002127754
}
  orcid={https://orcid.org/0009-0008-1720-4057}
  gscholar={
https://scholar.google.com/citations?hl=es&user=0obyCwkJ&view_op=list_works&gmla=AOV7GLPWRTK-xooHNe0iQ3uubfcSbG__GY_Guy35FdaqDJA3OfLLtp01-E1kzjxUhltlsfj494MaoQFkk9U9hCFYSipoR8aX0Vu2E6sV
}
]

\defineuserdataalternative[idautor][renderingsetup=userdata:idautor]

\startsetups[userdata:idautor]
  \dontleavehmode
  \imghref
{\externalfigure[cvlac.pdf][logo]}
{\userdataparameter{cvlac}}
\quad
  \imghref
{\externalfigure[orcid.pdf][logo]}
{\userdataparameter{orcid}}
\quad
  \imghref
{\externalfigure[gscholar.pdf][logo]}
{\userdataparameter{gscholar}}
\quad
  \userdataparameter{author}\par
\stopsetups

\defineuserdata[idautor][alternative=idautor]

\startdocument
  % I have to manually set the length of the dataset in the loop and use
recurselevel...
  % Maybe there is a way to use the length of the "autores" dataset? and
use indexes?
  \dorecurse{5}{
\startuserdata[idautor][
  author={\datasetvariable{autores}{\recurselevel}{nombre}},
  cvlac={\datasetvariable{autores}{\recurselevel}{cvlac}},
  orcid={\datasetvariable{autores}{\recurselevel}{orcid}},
  gscholar={\datasetvariable{autores}{\recurselevel}{gscholar}},
]\stopuserdata % My "inlineuserdata" is empty... no idea if this is
OK...
  }
\stopdocument
%% END MWE

Thank you in advance.

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: disable header for endnotes

2023-08-16 Thread Rik Kabel

On 8/16/2023 5:02 AM, jbf wrote:


I wonder if someone might be able to help me with this.

I have a book in three parts and the author wants endnotes. No 
problem. I can produce those with \setupfootnotes[location=text] and 
then \placefootnotes.


However, I would like the header to read 'Notes' on the recto page (or 
indeed be blank with no header), but I am currently getting the header 
that belongs to the main setup for headers, which happens to be:


\startsetups[middle]

\hfill

\getmarking[section]

\hfill

\stopsetups

\setupheadertexts

[{\hfill\documentvariable{metadata:title}\hfill}][]

[\setups{middle}][]

How do I deal with the \placefootnotes command so that it ignores this 
and either gives me no header, or perhaps a new header with 'Notes' in 
place of [section] (which is achieved in centered position with 
setups[middle])?


Julian


I use the following for a notes chapter at the end of a book. It 
produces headings that indicate the pages for which the notes apply. 
Perhaps you can adapt it to your needs:


   In the environment file:

   \definemarking [notePage] \startsetups noteHeadingsText {\em
   Notes for page
   \doifelse{\fetchmark[notePage][top]}{\fetchmark[notePage][bottom]}
   { \getmarking[notePage][top]} {s
   \getmarking[notePage][top]–\getmarking[notePage][bottom]}}
   \stopsetups \startsetups noteHeadings:on
   \setupheadertexts[][\setups{noteHeadingsText}]
   [\setups{noteHeadingsText}][] \stopsetups

   In the text:

   \startbackmatter \startchapter[reference={cha:notes},
   list={Notes}, % toc bookmark={Notes}, % pdf bookmark
   title={Notes}] % chapter head [Lettrine=no]
   \setups{noteHeadings:on} \placenotes[endnote] \stopchapter

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

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

[NTG-context] disable header for endnotes

2023-08-16 Thread jbf

I wonder if someone might be able to help me with this.

I have a book in three parts and the author wants endnotes. No problem. 
I can produce those with \setupfootnotes[location=text] and then 
\placefootnotes.


However, I would like the header to read 'Notes' on the recto page (or 
indeed be blank with no header), but I am currently getting the header 
that belongs to the main setup for headers, which happens to be:


\startsetups[middle]

\hfill

\getmarking[section]

\hfill

\stopsetups

\setupheadertexts

[{\hfill\documentvariable{metadata:title}\hfill}][]

[\setups{middle}][]

How do I deal with the \placefootnotes command so that it ignores this 
and either gives me no header, or perhaps a new header with 'Notes' in 
place of [section] (which is achieved in centered position with 
setups[middle])?


Julian

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

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

[NTG-context] Re: Scaling characters without font switching in CLD

2023-08-12 Thread Hamid,Idris
On Aug 12, 2023, 3:49 PM -0600, Hans Hagen , wrote:

> you'll figure it out, right?

I hope so and I'm working on it -- with your help -)

> the demo shows both: x/.y scaling and 90/180/270 rotation

Yes, here is what I have so far:

==
% % Hans' original template

% \startsetups glyph:iTee
 % \dontleavehmode\hpack\bgroup
 % \setbox\scratchbox \ruledhbox \bgroup
 % \glyphxscale 400
 % \glyphyscale 400
 % \getglyphstyled{Serif}{T}% choose a font here
 % \egroup
 % \scratchheight 2.75\ht\scratchbox
 % \boxyoffset\scratchbox\scratchheight
 % \boxorientation\scratchbox\plustwo
 % \ht\scratchbox\scratchheight
 % \box\scratchbox
 % \egroup
% \stopsetups

% \definesymbol
   % [iTee]
   % [\directsetup{glyph:iTee}]

% \startTEXpage [offset=1ts,width=2cm]
 % \ruledhbox {\tfx T \symbol{iTee}} \par
 % \ruledhbox {T  \symbol{iTee}} \par
 % \ruledhbox {\tfa T \symbol{iTee}} \par
 % \ruledhbox {\bfd T \symbol{iTee}}
% \stopTEXpage

\definefontsynonym[MinionRegular][MinionPro-Regular.otf*default]

\startsetups glyph:glottalhamzah
 \dontleavehmode\hpack\bgroup
 \setbox\scratchbox \ruledhbox \bgroup
 \glyphxscale 500
 \glyphyscale 500
 \getglyphstyled{MinionRegular}{c}% choose a font here
 \egroup
 \scratchheight 2.03\ht\scratchbox
 \boxyoffset\scratchbox\scratchheight
 \boxorientation\scratchbox\plustwo
 \ht\scratchbox\scratchheight
 \box\scratchbox
 \egroup
\stopsetups

\startsetups glyph:glottalayn
 \dontleavehmode\hpack\bgroup
 \setbox\scratchbox \ruledhbox \bgroup
 \glyphxscale 500
 \glyphyscale 500
 \getglyphstyled{MinionRegular}{c}% choose a font here
 \egroup
 \scratchheight 1.00\ht\scratchbox
 \boxyoffset\scratchbox\scratchheight
 % \boxorientation\scratchbox\plustwo
 \ht\scratchbox\scratchheight
 \box\scratchbox
 \egroup
\stopsetups

\definesymbol
   [glottalhamzah]
   [\directsetup{glyph:glottalhamzah}]

\definesymbol
   [glottalayn]
   [\directsetup{glyph:glottalayn}]

\definecolor [transparentgreen]  [g=1,t=.7,a=1]
\definecolor [transparentred][r=1,t=.7,a=1]
\definecolor [transparentyellow] [y=1,t=.7,a=1]

\startTEXpage [offset=1ts,width=2cm]
 \ruledhbox {\tfx  c\symbol{glottalhamzah}c} \par
 \ruledhbox   {c\symbol{glottalhamzah}c} \par
 \ruledhbox {\tfa  c\symbol{glottalhamzah}c} \par
 \ruledhbox {\bfd  c\symbol{glottalhamzah}c} \par

 \ruledhbox {\tfx  c\symbol{glottalayn}c} \par
 \ruledhbox   {c\symbol{glottalayn}c} \par
 \ruledhbox {\tfa  c\symbol{glottalayn}c} \par
 \ruledhbox {\bfd  c\symbol{glottalayn}c} \par

 \hbox{\rlap{\ruledhbox {\transparentgreen\tfx  c\symbol{glottalhamzah}c}}%
\hskip-.09em \ruledhbox {\transparentred
c\symbol{glottalhamzah}c}}

 \hbox{\rlap{\ruledhbox {\transparentgreen\tfx  c\symbol{glottalayn}c}}%
 \ruledhbox {\transparentredc\symbol{glottalayn}c}}
\stopTEXpage
==

Note the \rlap's (see attached pdf): we see that \tfx doesn't scale the 
\symbol, although \tfa and higher do work.

I guess fixing \tfx-symbol interaction will be part of your conversation with 
Wolfgang -)

> well, you wented symbols so

Ultimately I just want to be able to type the Unicode symbols for 02BE and 02BF 
-- ʾ and ʿ -- and get proper results. The overwhelming majority of hq fonts 
don't have them, and the few that do do them poorly, etc.

(So there is no substitute for full control of these transliteration 
characters.)

So even if we use symbols, would like to feed these setups to the CLD template 
you provided some days ago and feed the final result to \definefontfeature.
===

Best wishes
Idris
--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523


test-scaling-hans.pdf
Description: test-scaling-hans.pdf
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Scaling characters without font switching in CLD

2023-08-12 Thread Hans Hagen

On 8/12/2023 11:33 PM, Hamid,Idris wrote:

On Aug 12, 2023, 2:11 PM -0600, Hans Hagen via ntg-context 
, wrote:

impossible to reply as impossible to see what is your and mine text here


Hm.. This new/modern email client (forced to update by the university) supports 
inline replies, and I can see the levels, but the distinctions between levels 
of reply appears to get lost when filtered by the ntg-context list (looking at 
the archives). So here it is again, with levels of reply made explicit:

On Aug 12, 2023, 9:35 AM -0600, Hans Hagen , wrote:
** Caution: EXTERNAL Sender **

On 8/12/2023 4:03 PM, Hamid,Idris wrote:


\tfx causes a switch to computer modern.



Indeed. Something I need to discuss with Wolfgang as double checking is needed 
before I patch.


Ah.. ok.


But what if we want to scale independently of font switching?



There is no need to go lua here (esp when you have not done vf magick
before and i'm not going to debug code that i have little clue what it's
about to do).


Many thanks. Part of the context is that I have some updatable mission-critical 
documents that depended on \defineactivecharacter, which is apparently 
deprecated in LMTX. See earlier thread with that subject line.


i adapted some recently but anyway active chars are a bad idea


[BTW: Just this morning someone from the Persian Gulf asked for an updated 
version of a document whose compilation depended on \defineactivecharacter, so 
I need to get this working in the new regime -)]

Now the templates that you provided - many, many thanks! - have what is needed 
to care of everything except for two characters: 02BE and 02BF.


you'll figure it out, right?


For one of those two remaining characters we also need scaling, for the other 
we also need scaling + rotation. It is not clear to me whether the 
scaling/rotation commands should fall under the character function, e.g.,


the demo shows both: x/.y scaling and 90/180/270 rotation


===
-- ʿ ringhalfleft
local function ringhalfleft (characters,target,base,accent)
===

the initialize function

===
local function initialize(tfmdata,value)
===

or whether we just make a new function altogether

===
local function scale (ringhalfleft)  -- shooting in the dark here
===

So the reason I said CLD is best is because we already defined all of the 
needed characters that way -- using your template -- except for these two, for 
which we need to add scaling and or rotation.


The attached (linked in the previous email but attached here) gives us rotation 
but no scaling.
- we cheat here and yuse glyph scaled (I have to provide a relative to
current x/y scaling, don't use \glyphscale as that one is used by
context itself
- we use the style variant so that it adapts
- you have to replace "Serif" with "YourFont" and map that one onto a
file (YourFont YourFontBold etc)
- more about these box manipulations in the low level manual


Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to 
focus on in this case -)


\startsetups glyph:iTee
\dontleavehmode\hpack\bgroup
\setbox\scratchbox \ruledhbox \bgroup
\glyphxscale 400
\glyphyscale 400
\getglyphstyled{Serif}{T}> choose a font here
\egroup
\scratchheight 2.75\ht\scratchbox
\boxyoffset \scratchbox\scratchheight
\boxorientation\scratchbox\plustwo
\ht \scratchbox\scratchheight
\box\scratchbox
\egroup
\stopsetups



\definesymbol
[iTee]
[\directsetup{glyph:iTee}]



\startTEXpage [offset=1ts,width=2cm]
\ruledhbox {\tfx T \symbol{iTee}} \par
\ruledhbox {T \symbol{iTee}} \par
\ruledhbox {\tfa T \symbol{iTee}} \par
\ruledhbox {\bfd T \symbol{iTee}}
\stopTEXpage


Great, will study this. The challenge (for me) will be integrating this 
approach into the lua definitions of the two needed characters. With 
\defineactivecharacter deprecated, there seems to be no way other than CLD to 
make and register the needed macro for \definefontfeature -- and we want to 
move forward with the new regime and not look back.


well, you wented symbols so ... why lua then (btw, no need for squeezine 
as there are virtual commands for scaling; not for rotating; an 
alternative is to define some chars in metapost (see 
meta-imp-gamesymbols) which gives you plenty freedom



With many thanks and much gratitude, Hans.

Best wishes
Idris
--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523


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

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

[NTG-context] Re: Scaling characters without font switching in CLD

2023-08-12 Thread Hamid,Idris
On Aug 12, 2023, 2:11 PM -0600, Hans Hagen via ntg-context 
, wrote:
> impossible to reply as impossible to see what is your and mine text here

Hm.. This new/modern email client (forced to update by the university) supports 
inline replies, and I can see the levels, but the distinctions between levels 
of reply appears to get lost when filtered by the ntg-context list (looking at 
the archives). So here it is again, with levels of reply made explicit:

On Aug 12, 2023, 9:35 AM -0600, Hans Hagen , wrote:
** Caution: EXTERNAL Sender **

On 8/12/2023 4:03 PM, Hamid,Idris wrote:

>> \tfx causes a switch to computer modern.

> Indeed. Something I need to discuss with Wolfgang as double checking is 
> needed before I patch.

Ah.. ok.

>> But what if we want to scale independently of font switching?

> There is no need to go lua here (esp when you have not done vf magick
> before and i'm not going to debug code that i have little clue what it's
> about to do).

Many thanks. Part of the context is that I have some updatable mission-critical 
documents that depended on \defineactivecharacter, which is apparently 
deprecated in LMTX. See earlier thread with that subject line.

[BTW: Just this morning someone from the Persian Gulf asked for an updated 
version of a document whose compilation depended on \defineactivecharacter, so 
I need to get this working in the new regime -)]

Now the templates that you provided - many, many thanks! - have what is needed 
to care of everything except for two characters: 02BE and 02BF.

For one of those two remaining characters we also need scaling, for the other 
we also need scaling + rotation. It is not clear to me whether the 
scaling/rotation commands should fall under the character function, e.g.,

===
-- ʿ ringhalfleft
local function ringhalfleft (characters,target,base,accent)
===

the initialize function

===
local function initialize(tfmdata,value)
===

or whether we just make a new function altogether

===
local function scale (ringhalfleft)  -- shooting in the dark here
===

So the reason I said CLD is best is because we already defined all of the 
needed characters that way -- using your template -- except for these two, for 
which we need to add scaling and or rotation.

> The attached (linked in the previous email but attached here) gives us 
> rotation but no scaling.
> - we cheat here and yuse glyph scaled (I have to provide a relative to
> current x/y scaling, don't use \glyphscale as that one is used by
> context itself
> - we use the style variant so that it adapts
> - you have to replace "Serif" with "YourFont" and map that one onto a
> file (YourFont YourFontBold etc)
> - more about these box manipulations in the low level manual

Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to 
focus on in this case -)

> \startsetups glyph:iTee
> \dontleavehmode\hpack\bgroup
> \setbox\scratchbox \ruledhbox \bgroup
> \glyphxscale 400
> \glyphyscale 400
> \getglyphstyled{Serif}{T}> choose a font here
> \egroup
> \scratchheight 2.75\ht\scratchbox
> \boxyoffset \scratchbox\scratchheight
> \boxorientation\scratchbox\plustwo
> \ht \scratchbox\scratchheight
> \box\scratchbox
> \egroup
> \stopsetups

> \definesymbol
> [iTee]
> [\directsetup{glyph:iTee}]

> \startTEXpage [offset=1ts,width=2cm]
> \ruledhbox {\tfx T \symbol{iTee}} \par
> \ruledhbox {T \symbol{iTee}} \par
> \ruledhbox {\tfa T \symbol{iTee}} \par
> \ruledhbox {\bfd T \symbol{iTee}}
> \stopTEXpage

Great, will study this. The challenge (for me) will be integrating this 
approach into the lua definitions of the two needed characters. With 
\defineactivecharacter deprecated, there seems to be no way other than CLD to 
make and register the needed macro for \definefontfeature -- and we want to 
move forward with the new regime and not look back.

With many thanks and much gratitude, Hans.

Best wishes
Idris
--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

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

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

[NTG-context] Re: Pass string into text background graphic

2023-08-12 Thread Hans Hagen via ntg-context

On 8/12/2023 7:19 PM, Thangalin wrote:

Thanks Hans.

The \newinteger approach would always increment the value, regardless of
conditionals within the MetaPost code (i.e., it was like legend :=
"\ConcurrentTextGet" would always invoke the macro just be referencing the
MPgraphic and nothing would prevent its execution). This meant that the Get
indexes would not correspond to the Set indexes. Switching to \definenumber
resolved the issue. There were a few other oddities, such as the "Get"
counter incrementing twice. Here's the code:


you could remove the \localcontrolled around the advance


\definenumber[ConcurrentTextSetCounter][prefix=no]
\definenumber[ConcurrentTextGetCounter][prefix=no]

\setnumber[ConcurrentTextSetCounter][0]
\setnumber[ConcurrentTextGetCounter][0]

% Map each label as global key/value pairs.
\def\ConcurrentTextSet#1{%
   \incrementnumber[ConcurrentTextSetCounter]%
   \setxvariable
 {concurrent}
 {text:\rawcountervalue[ConcurrentTextSetCounter]}
 {#1}}

% Account for the counter incrementing twice and the index being 1-based.
\def\ConcurrentTextGet{%
   \incrementnumber[ConcurrentTextGetCounter]%
   \getvariable
 {concurrent}


why twice ? you only have to typeset the text once, right?


{text:\number\numexpr1+\rawcountervalue[ConcurrentTextGetCounter]/2\relax}}

\startuseMPgraphic{GraphicConcurrent}
   numeric index;
   index := 1;

   % Differentiate between new text blocks and those crossing pages.
   if (multikind[ index ] = "single") or (multikind[ index ] = "first"):
 string legend;
 legend := "\ConcurrentTextGet";

 % For new text blocks, write the title.
 picture p;
 p := textext.rt( legend )
   shifted ulcorner multipars[ index ]
   shifted (1cm, 0);

 % Draw the horizontal rule only for the initial text block.
 draw
   ulcorner multipars[ index ] shifted (1mm + xpart lrcorner p, 0) --
   urcorner multipars[ index ];

 % Draw the vertical rule for the initial text block.
 draw
   llcorner multipars[ index ] --
   ulcorner multipars[ index ] --
   ulcorner multipars[ index ] shifted (9mm, 0);

 draw p;
   else:
 % Draw only the vertical rule only when crossing page boundaries.
 draw
   llcorner multipars[ index ] --
   ulcorner multipars[ index ];
   fi
\stopuseMPgraphic

\definetextbackground[TextConcurrentFrame][
   mp=GraphicConcurrent,
   frame=off,
   topoffset=1em,
   leftoffset=1em,
   before=\blank[2*big],
   after=\blank,
   location=paragraph,
]

\startsetups concurrent:before
   \ConcurrentTextSet{%
 % Be sure to format "a.m." and other special phrases.
 \expandafter\TextReplacement{%
   \xmlatt{\getvariable{div}{concurrent}}{data-title}%
 }
   }
   \startTextConcurrentFrame
\stopsetups

\startsetups concurrent:after
   \stopTextConcurrentFrame
\stopsetups

\definestartstop[concurrent][
   before=\directsetup{concurrent:before},
   after=\directsetup{concurrent:after}
]

This allows for typesetting a wider range of pandoc-style Markdown
annotations, such as:

::: {.concurrent title="Terminal Berth 5, 3:17 a.m."}
text goes here
:::

With these changes, the titles now only appear at the start of the
demarcated text, in any combination of "concurrent" annotation instances
spanning any number of pages.

Much appreciated.

Cheers!
P.S.
The following line requires KeenWrite themes:

\expandafter\TextReplacement{ ... }

For details, see:

-

https://github.com/DaveJarvis/keenwrite-themes/blob/main/xhtml/xml-blocks.tex
-
https://github.com/DaveJarvis/keenwrite-themes/blob/main/boschet/replace.tex


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

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


--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


[NTG-context] Re: Scaling characters without font switching in CLD

2023-08-12 Thread Hamid,Idris
On Aug 12, 2023, 9:35 AM -0600, Hans Hagen , wrote:
** Caution: EXTERNAL Sender **

On 8/12/2023 4:03 PM, Hamid,Idris wrote:

\tfx causes a switch to computer modern.

Indeed. Something I need to discuss with Wolfgang as double checking is needed 
before I patch.

Ah.. ok.

But what if we want to scale independently of font switching?
There is no need to go lua here (esp when you have not done vf magick
before and i'm not going to debug code that i have little clue what it's
about to do).

Many thanks. Part of the context is that I have some updatable mission-critical 
documents that depended on \defineactivecharacter, which is apparently 
deprecated in LMTX. See earlier thread with that subject line.

[BTW: Just this morning someone from the Persian Gulf asked for an updated 
version of a document whose compilation depended on \defineactivecharacter, so 
I need to get this working in the new regime -)]

Now the templates that you provided - many, many thanks! - have what is needed 
to care of everything except for two characters: 02BE and 02BF.

For one of those two remaining characters we also need scaling, for the other 
we also need scaling + rotation. It is not clear to me whether the 
scaling/rotation commands should fall under the character function, e.g.,

===
-- ʿ ringhalfleft
local function ringhalfleft (characters,target,base,accent)
===

the initialize function

===
local function initialize(tfmdata,value)
===

or whether we just make a new function altogether

===
local function scale (ringhalfleft)  -- shooting in the dark here
===

So the reason I said CLD is best is because we already defined all of the 
needed characters that way -- using your template -- except for these two, for 
which we need to add scaling and or rotation.

The attached (linked in the previous email but attached here) gives us rotation 
but no scaling.
- we cheat here and yuse glyph scaled (I have to provide a relative to
current x/y scaling, don't use \glyphscale as that one is used by
context itself
- we use the style variant so that it adapts
- you have to replace "Serif" with "YourFont" and map that one onto a
file (YourFont YourFontBold etc)
- more about these box manipulations in the low level manual

Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to 
focus on in this case -)
\startsetups glyph:iTee
\dontleavehmode\hpack\bgroup
\setbox\scratchbox \ruledhbox \bgroup
\glyphxscale 400
\glyphyscale 400
\getglyphstyled{Serif}{T}% choose a font here
\egroup
\scratchheight 2.75\ht\scratchbox
\boxyoffset \scratchbox\scratchheight
\boxorientation\scratchbox\plustwo
\ht \scratchbox\scratchheight
\box\scratchbox
\egroup
\stopsetups

\definesymbol
[iTee]
[\directsetup{glyph:iTee}]

\startTEXpage [offset=1ts,width=2cm]
\ruledhbox {\tfx T \symbol{iTee}} \par
\ruledhbox {T \symbol{iTee}} \par
\ruledhbox {\tfa T \symbol{iTee}} \par
\ruledhbox {\bfd T \symbol{iTee}}
\stopTEXpage

Great, will study this. The challenge (for me) will be integrating this 
approach into the lua definitions of the two needed characters. With 
\defineactivecharacter deprecated, there seems to be no way other than CLD to 
make and register the needed macro for \definefontfeature -- and we want to 
move forward with the new regime and not look back.

With many thanks and much gratitude, Hans.

Best wishes
Idris

--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523


transliteration--glottal-lua.pdf
Description: transliteration--glottal-lua.pdf


transliteration--glottal-lua.tex
Description: transliteration--glottal-lua.tex
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Pass string into text background graphic

2023-08-12 Thread Thangalin
Thanks Hans.

The \newinteger approach would always increment the value, regardless of
conditionals within the MetaPost code (i.e., it was like legend :=
"\ConcurrentTextGet" would always invoke the macro just be referencing the
MPgraphic and nothing would prevent its execution). This meant that the Get
indexes would not correspond to the Set indexes. Switching to \definenumber
resolved the issue. There were a few other oddities, such as the "Get"
counter incrementing twice. Here's the code:

\definenumber[ConcurrentTextSetCounter][prefix=no]
\definenumber[ConcurrentTextGetCounter][prefix=no]

\setnumber[ConcurrentTextSetCounter][0]
\setnumber[ConcurrentTextGetCounter][0]

% Map each label as global key/value pairs.
\def\ConcurrentTextSet#1{%
  \incrementnumber[ConcurrentTextSetCounter]%
  \setxvariable
{concurrent}
{text:\rawcountervalue[ConcurrentTextSetCounter]}
{#1}}

% Account for the counter incrementing twice and the index being 1-based.
\def\ConcurrentTextGet{%
  \incrementnumber[ConcurrentTextGetCounter]%
  \getvariable
{concurrent}

{text:\number\numexpr1+\rawcountervalue[ConcurrentTextGetCounter]/2\relax}}

\startuseMPgraphic{GraphicConcurrent}
  numeric index;
  index := 1;

  % Differentiate between new text blocks and those crossing pages.
  if (multikind[ index ] = "single") or (multikind[ index ] = "first"):
string legend;
legend := "\ConcurrentTextGet";

% For new text blocks, write the title.
picture p;
p := textext.rt( legend )
  shifted ulcorner multipars[ index ]
  shifted (1cm, 0);

% Draw the horizontal rule only for the initial text block.
draw
  ulcorner multipars[ index ] shifted (1mm + xpart lrcorner p, 0) --
  urcorner multipars[ index ];

% Draw the vertical rule for the initial text block.
draw
  llcorner multipars[ index ] --
  ulcorner multipars[ index ] --
  ulcorner multipars[ index ] shifted (9mm, 0);

draw p;
  else:
% Draw only the vertical rule only when crossing page boundaries.
draw
  llcorner multipars[ index ] --
  ulcorner multipars[ index ];
  fi
\stopuseMPgraphic

\definetextbackground[TextConcurrentFrame][
  mp=GraphicConcurrent,
  frame=off,
  topoffset=1em,
  leftoffset=1em,
  before=\blank[2*big],
  after=\blank,
  location=paragraph,
]

\startsetups concurrent:before
  \ConcurrentTextSet{%
% Be sure to format "a.m." and other special phrases.
\expandafter\TextReplacement{%
  \xmlatt{\getvariable{div}{concurrent}}{data-title}%
}
  }
  \startTextConcurrentFrame
\stopsetups

\startsetups concurrent:after
  \stopTextConcurrentFrame
\stopsetups

\definestartstop[concurrent][
  before=\directsetup{concurrent:before},
  after=\directsetup{concurrent:after}
]

This allows for typesetting a wider range of pandoc-style Markdown
annotations, such as:

::: {.concurrent title="Terminal Berth 5, 3:17 a.m."}
text goes here
:::

With these changes, the titles now only appear at the start of the
demarcated text, in any combination of "concurrent" annotation instances
spanning any number of pages.

Much appreciated.

Cheers!
P.S.
The following line requires KeenWrite themes:

\expandafter\TextReplacement{ ... }

For details, see:

   -
   https://github.com/DaveJarvis/keenwrite-themes/blob/main/xhtml/xml-blocks.tex
   -
   https://github.com/DaveJarvis/keenwrite-themes/blob/main/boschet/replace.tex


concurrent.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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Scaling characters without font switching in CLD

2023-08-12 Thread Hans Hagen

On 8/12/2023 4:03 PM, Hamid,Idris wrote:


\tfx causes a switch to computer modern.


Indeed. Something I need to discuss with Wolfgang as double checking is 
needed before I patch.



But what if we want to scale independently of font switching?
There is no need to go lua here (esp when you have not done vf magick 
before and i'm not going to debug code that i have little clue what it's 
about to do).


- we cheat here and yuse glyph scaled (I have to provide a relative to 
current x/y scaling, don't use \glyphscale as that one is used by 
context itself

- we use the style variant so that it adapts
- you have to replace "Serif" with "YourFont" and map that one onto a 
file (YourFont YourFontBold etc)

- more about these box manipulations in the low level manual

\startsetups glyph:iTee
\dontleavehmode\hpack\bgroup
\setbox\scratchbox \ruledhbox \bgroup
\glyphxscale 400
\glyphyscale 400
\getglyphstyled{Serif}{T}% choose a font here
\egroup
\scratchheight 2.75\ht\scratchbox
\boxyoffset\scratchbox\scratchheight
\boxorientation\scratchbox\plustwo
\ht\scratchbox\scratchheight
\box\scratchbox
\egroup
\stopsetups

\definesymbol
  [iTee]
  [\directsetup{glyph:iTee}]

\startTEXpage [offset=1ts,width=2cm]
\ruledhbox {\tfx T \symbol{iTee}} \par
\ruledhbox {T  \symbol{iTee}} \par
\ruledhbox {\tfa T \symbol{iTee}} \par
\ruledhbox {\bfd T \symbol{iTee}}
\stopTEXpage

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


[NTG-context] Re: Pass string into text background graphic

2023-08-11 Thread Hans Hagen
,0) --
  urcorner multipars[1]
;
draw p ;
\stopuseMPgraphic

% Watch how i moved the before/after blanks here:

\definetextbackground
  [TextConcurrentFrame]
  [mp=GraphicConcurrent,
 % mp=mpos:region:draw,
   method=mpos:region,
   frame=off,
   topoffset=1em,
   leftoffset=1em,
   before=\blank[2*big],
   after=\blank,
   location=paragraph]

% And use setups to get a nicer definition:

\startsetups concurrent:before
\ConcurrentTextSet{\xmlatt{\getvariable{div}{concurrent}}{data-title}}
\startTextConcurrentFrame
\stopsetups

\startsetups concurrent:after
\stopTextConcurrentFrame
\stopsetups

\definestartstop
  [concurrent]
  [before=\directsetup{concurrent:before},
   after=\directsetup{concurrent:after}]

One problem with variables is that currently we cannot bind a "current" 
value so I need to think a bit about it. Maybe the solution here, a bit 
more robust is one. One can actually pass variables with a graphic but 
again, these are then overwritten by a later one.


In lmtx we have a few better tex-mp communication tricks but these are 
not yet documented in the manual. Contrary to mkii (intermediate as well 
as runtime processing) and mkiv (runtime two pass in a run processing) 
we can make some interfaces a bit simpler in mkxl but that happens 
stepwise because we need to remain compatible. Much of the positional 
graphic trickery is stil a bit mkii-ish in nature (where we had more mem 
and runtime constraints).


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


[NTG-context] Re: upload

2023-08-10 Thread Thangalin
Did arguments regress in 2023.08.10 02:59?

$ cat u.tex
\starttext
Feisty arguments
\stoptext
$ context u.tex
$  ls -la *.pdf
-rw-r--r-- 1 username username 6279 Aug 10 18:28 u.pdf
$ context --arguments=x=y u.tex | grep error
tex error   > tex error on line 13 in file : Use of \getrawparameters
doesn't match its definition
mtx-context | fatal error: return code: 1

This was working with the previous release.

On Wed, Aug 9, 2023 at 8:43 AM Hans Hagen  wrote:

> Hi,
>
> I uploaded a new lmtx. There are some new features that wil be revealed
> in the future (likely after the meeting) but here is one:
>
> \starttext
>
>  \defineoverlay
>[test]
>[\color
>   [blue]
>   {TEST
>\inframed
>  [foregroundcolor=red]
>  {xxx}
>TEST}]
>
>  \framed
>[background=test,
> foregroundstyle=\switchtobodyfont[small]]
>{test}
>
> \stoptext
>
>  From now on many commands accept (properly) nested [] inside commands
> that use [] as fences (like the setup commands) where it makes sense. It
> is up to the user to decide to use {} (as before) or not but it is less
> error prone.
>
> It is now also possible to nest setups as in
>
> \starttext
>
> \startsetups one
>      \startsetups [three]
>  HERE
>  \stopsetups
> \stopsetups
>
> \startsetups two
>  \startsetups [three]
>  THERE
>  \stopsetups
> \stopsetups
>
> \setups[one] \setups[three]
>
> \setups[two] \setups[three]
>
> \stoptext
>
> As part of the ongoing improvements on math rendering we added some
> classic lm/cm kerns (between upperacse and periods / commas) in the
> goodie files.
>
> Some lowlevel manuals have been extended, explaining experimental 'named
> cross macro nesting parameter referencing' and 'constrained cq. retained
> assignments', but that is only relevant for those interested in
> overcoming some limitations in the traditional engines.
>
> Hans
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] upload

2023-08-09 Thread Hans Hagen

Hi,

I uploaded a new lmtx. There are some new features that wil be revealed 
in the future (likely after the meeting) but here is one:


\starttext

\defineoverlay
  [test]
  [\color
 [blue]
 {TEST
  \inframed
[foregroundcolor=red]
{xxx}
  TEST}]

\framed
  [background=test,
   foregroundstyle=\switchtobodyfont[small]]
  {test}

\stoptext

From now on many commands accept (properly) nested [] inside commands 
that use [] as fences (like the setup commands) where it makes sense. It 
is up to the user to decide to use {} (as before) or not but it is less 
error prone.


It is now also possible to nest setups as in

\starttext

\startsetups one
\startsetups [three]
HERE
\stopsetups
\stopsetups

\startsetups two
\startsetups [three]
THERE
\stopsetups
\stopsetups

\setups[one] \setups[three]

\setups[two] \setups[three]

\stoptext

As part of the ongoing improvements on math rendering we added some 
classic lm/cm kerns (between upperacse and periods / commas) in the 
goodie files.


Some lowlevel manuals have been extended, explaining experimental 'named 
cross macro nesting parameter referencing' and 'constrained cq. retained 
assignments', but that is only relevant for those interested in 
overcoming some limitations in the traditional engines.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Re: Par Builder Tests

2023-07-28 Thread Keith McKay

Hi all!

Using the example below I have completed a test using a larger book. 
This time I downloaded War and Peace from the Gutenberg Project and 
extracted the individual xhtml files for Context.


I played around with the setups for the align:pass:test4 code below, as 
Hans suggested, and it was changing the \tolerance value which made the 
difference. Increasing the \tolerance value to 1000 eliminated all 
overfull hboxes but still left 79 underfull hboxes. I continued to 
increase the \tolerance value up to 6600 and was left with two overfull 
hboxes. One with a badness of 6641 (warAndPeace1.png) and one with a 
badness of 1097 (warAndPeace2.png). Above the \tolerance of 6600 only 
warAndPeace2.png was left with a badness of 1097. Both of these 
underfull hboxes were at the beginning of a paragraph - "To his Honor" 
in the first png and "Well, you see," in the second png. I not sure a 
reader would spot the second png badness but the first is noticeable to 
my eyes.


I'm very pleased how the book has turned out, all 1668 pages of it as an 
approximately 13cm by 20cm book. The pdf is 4MB and each run in ConTeXt 
takes about 10 seconds on my M1 mac mini.


I'm interested in seeing how \setupalignpass develops and learning more 
of how to use it.


Best Wishes

Keith McKay

On 21/07/2023 17:33, Keith McKay wrote:

Thanks Hans!

I'll have a play and keep an eye on updates

Best Wishes

Keith

On 21/07/2023 17:10, Hans Hagen via ntg-context wrote:

Hi Keith,

Here an example that Mikael made for such a book:

\showframe

% let's very strict

\startsetups [*default]

    \directsetup{*reset}

    \frozen\widowpenalty    1
    \frozen\clubpenalty 1
    \frozen\displaywidowpenalty 1
    \frozen\brokenpenalty   0 % \defaultbrokenpenalty

\stopsetups

% we enable the use of expansion (this feature might become preset
% because we now delay setting the vectors anyway so less overhead)

\definefontfeature
  [default]
  [default]
  [expansion=quality,
   protrusion=quality,
   itlc=yes]

% vertical expansion

\setuplayout
  [vz=2]

% for which we need:

% \setupalign[hanging,depth,stretch,granular]

\setupalign[depth,stretch,granular]

% here are the passes:

\startsetups align:pass:test4
    \pretolerance 100
    \tolerance    200
    \parpasses    4
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink    5
    adjustspacingstretch  10
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   10
    adjustspacingstretch  20
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   25
    adjustspacingstretch  50
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   50
    adjustspacingstretch 100
    \relax
\stopsetups

\setupalignpass[test4]

\starttext
    ...
\stoptext

(work in progress so keep an eye on updates)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

___ 

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


maillist : ntg-context@ntg.nl / 
https://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___ 
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Keith McKay

Thanks Hans!

I'll have a play and keep an eye on updates

Best Wishes

Keith

On 21/07/2023 17:10, Hans Hagen via ntg-context wrote:

Hi Keith,

Here an example that Mikael made for such a book:

\showframe

% let's very strict

\startsetups [*default]

    \directsetup{*reset}

    \frozen\widowpenalty    1
    \frozen\clubpenalty 1
    \frozen\displaywidowpenalty 1
    \frozen\brokenpenalty   0 % \defaultbrokenpenalty

\stopsetups

% we enable the use of expansion (this feature might become preset
% because we now delay setting the vectors anyway so less overhead)

\definefontfeature
  [default]
  [default]
  [expansion=quality,
   protrusion=quality,
   itlc=yes]

% vertical expansion

\setuplayout
  [vz=2]

% for which we need:

% \setupalign[hanging,depth,stretch,granular]

\setupalign[depth,stretch,granular]

% here are the passes:

\startsetups align:pass:test4
    \pretolerance 100
    \tolerance    200
    \parpasses    4
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink    5
    adjustspacingstretch  10
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   10
    adjustspacingstretch  20
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   25
    adjustspacingstretch  50
    next
    classes  \indecentparpassclasses
    threshold    0.025pt
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   50
    adjustspacingstretch 100
    \relax
\stopsetups

\setupalignpass[test4]

\starttext
    ...
\stoptext

(work in progress so keep an eye on updates)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

___ 

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


maillist : ntg-context@ntg.nl / 
https://www.ntg.nl/mailman/listinfo/ntg-context

webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___ 


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

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

[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Hans Hagen via ntg-context

Hi Keith,

Here an example that Mikael made for such a book:

\showframe

% let's very strict

\startsetups [*default]

\directsetup{*reset}

\frozen\widowpenalty1
\frozen\clubpenalty 1
\frozen\displaywidowpenalty 1
\frozen\brokenpenalty   0 % \defaultbrokenpenalty

\stopsetups

% we enable the use of expansion (this feature might become preset
% because we now delay setting the vectors anyway so less overhead)

\definefontfeature
  [default]
  [default]
  [expansion=quality,
   protrusion=quality,
   itlc=yes]

% vertical expansion

\setuplayout
  [vz=2]

% for which we need:

% \setupalign[hanging,depth,stretch,granular]

\setupalign[depth,stretch,granular]

% here are the passes:

\startsetups align:pass:test4
\pretolerance 100
\tolerance200
\parpasses4
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink5
adjustspacingstretch  10
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   10
adjustspacingstretch  20
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   25
adjustspacingstretch  50
next
classes  \indecentparpassclasses
threshold0.025pt
adjustspacing  3
adjustspacingstep  1
adjustspacingshrink   50
adjustspacingstretch 100
\relax
\stopsetups

\setupalignpass[test4]

\starttext
...
\stoptext

(work in progress so keep an eye on updates)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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


[NTG-context] Re: Par Builder Tests

2023-07-21 Thread Hans Hagen

On 7/21/2023 5:34 PM, Keith McKay wrote:

Hi all,

At the end of June, Hans uploaded a new lmtx version which included 
improvements to par building which he and Mikael had been working on in 
math mode. Hans suggested in the online chat that these improvements may 
be useful in typesetting novels. I was keen to try these since I have 
typset novels in the past.


I have ran some tests on two novels which I downloaded from the 
Gutenberg Project site as epubs and extracted them to get the original 
xhtml files which I then typeset in context. I made very little in the 
way of changes to the files so that my setup for xml was very simple.


Here are my setups for the layout of the novels showing some trackers 
that were used as well:


\definepapersize[pagee][width=5.06in,height=7.81in]
\setuppapersize[pagee]
% XML setups here
\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{1}{150}
\setpenalties\clubpenalties {1}{150}
\stopsetups
\setuplayout[
width=10cm,
topspace=0.5in,
backspace=2.0cm,
header=7.5mm,
footer=0.25in,
location={middle,middle},
vs=2,
grid=yes,
setups=mypenalties
]
%\enabletrackers[makeup]
%\enabletrackers[builders.hpack.quality]
\enabletrackers[builders.hpack.overflow]
%\enabletrackers[layout.vz]
%\enabletrackers[paragraphs.passes]
\enabletrackers[paragraphs.passes=summary]
%\enabletrackers[paragraphs.passes=details]
\setupalign[granular]
%\setupalign[nothyphenated,hz,verytolerant]
%\setupalign[vertical,height]
%\setupalignpass[decent]
%\setupalignpass[quality]
%\setupalignpass[test1]
\setupalignpass[test2]
%\setupalignpass[test3]
%\setupalignpass[test4]
%\setupalignpass[test5]
%\setupalignpass[optional1]
%\setupalignpass[test2b]
\starttext
\setuppagenumbering[location={footer,middle},alternative=doublesided,state=start]
\setcounter[userpage][1]
%\showmakeup[vbox]
%\showlayout
\dostepwiserecurse{0}{30}{1}{
\xmlprocessfile{mysetups}{/path to xhtml 
files/4439720318703948998_84-h-\recurselevel.htm.xhtml}{}

}
\stoptext

Below are the result showing the number of overfull boxes for these 
novels using the setups in the file spac-imp-tests.mkxl . See the manual 
Low Level - Lines


Test    Novel1   Novel2
Test1    70    35
Test2    30    8
Test3    62    23
Test4    89    40
Test5    28    9
Optional1 55    19
Quality  74    32
Decent  39    11

 From these initial tests one can see that Test2 gave the lowest number 
of overfull boxes. So I edited test two, ran it, and the results are below.


Test    Novel1   Novel2

Test2b  11    0

My setup for test 2b is as follows:
\startsetups align:pass:test2b
     \pretolerance 100
     \tolerance    200
     \parpasses  3
     classes  \indecentparpassclasses
     threshold    0.025pt
     tolerance    800
     extrahyphenpenalty    50
   next
     threshold    0.025pt
     tolerance    900
     adjustspacing  3
     adjustspacingstep  1
     adjustspacingshrink   10
     adjustspacingstretch  15
     next
     threshold    0.025pt
     tolerance    1000
     adjustspacing  3
     adjustspacingstep  1
     adjustspacingshrink   20
     adjustspacingstretch  40
     emergencystretch .25\bodyfontsize
     \relax
% \linebreakpasses\plusone
\stopsetups
The only difference between test 2 and 2b are that I increased the 
tolerance in each of the three passes.
In novel 2 this was successful in eliminating the overfull boxes but not 
in Novel 1 although I noticed that majority of overfull boxes were above 
1pt with the largest about 12pt in Novel 1.


I am at the stage now where I need some kind of strategy to 
reduce/eliminate overfull boxes, other than changing the tolerance, and 
I'm hoping for some advice from the community. Suggestions for further 
reading particularly on the commands in \setupalignpass and their usage 
would be appreciated and on the best way to tackle overfull boxes.
you're too tolerant (stick to 200), you can even start out with 
pretolerance 50 and tolerance 150 and then in the passes 200


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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

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

[NTG-context] Par Builder Tests

2023-07-21 Thread Keith McKay

Hi all,

At the end of June, Hans uploaded a new lmtx version which included 
improvements to par building which he and Mikael had been working on in 
math mode. Hans suggested in the online chat that these improvements may 
be useful in typesetting novels. I was keen to try these since I have 
typset novels in the past.


I have ran some tests on two novels which I downloaded from the 
Gutenberg Project site as epubs and extracted them to get the original 
xhtml files which I then typeset in context. I made very little in the 
way of changes to the files so that my setup for xml was very simple.


Here are my setups for the layout of the novels showing some trackers 
that were used as well:


\definepapersize[pagee][width=5.06in,height=7.81in]
\setuppapersize[pagee]
% XML setups here
\startsetups[grid][mypenalties]
\setdefaultpenalties
\setpenalties\widowpenalties{1}{150}
\setpenalties\clubpenalties {1}{150}
\stopsetups
\setuplayout[
width=10cm,
topspace=0.5in,
backspace=2.0cm,
header=7.5mm,
footer=0.25in,
location={middle,middle},
vs=2,
grid=yes,
setups=mypenalties
]
%\enabletrackers[makeup]
%\enabletrackers[builders.hpack.quality]
\enabletrackers[builders.hpack.overflow]
%\enabletrackers[layout.vz]
%\enabletrackers[paragraphs.passes]
\enabletrackers[paragraphs.passes=summary]
%\enabletrackers[paragraphs.passes=details]
\setupalign[granular]
%\setupalign[nothyphenated,hz,verytolerant]
%\setupalign[vertical,height]
%\setupalignpass[decent]
%\setupalignpass[quality]
%\setupalignpass[test1]
\setupalignpass[test2]
%\setupalignpass[test3]
%\setupalignpass[test4]
%\setupalignpass[test5]
%\setupalignpass[optional1]
%\setupalignpass[test2b]
\starttext
\setuppagenumbering[location={footer,middle},alternative=doublesided,state=start]
\setcounter[userpage][1]
%\showmakeup[vbox]
%\showlayout
\dostepwiserecurse{0}{30}{1}{
\xmlprocessfile{mysetups}{/path to xhtml 
files/4439720318703948998_84-h-\recurselevel.htm.xhtml}{}

}
\stoptext

Below are the result showing the number of overfull boxes for these 
novels using the setups in the file spac-imp-tests.mkxl . See the manual 
Low Level - Lines


Test    Novel1   Novel2
Test1    70    35
Test2    30    8
Test3    62    23
Test4    89    40
Test5    28    9
Optional1 55    19
Quality  74    32
Decent  39    11

From these initial tests one can see that Test2 gave the lowest number 
of overfull boxes. So I edited test two, ran it, and the results are below.


Test    Novel1   Novel2

Test2b  11    0

My setup for test 2b is as follows:
\startsetups align:pass:test2b
    \pretolerance 100
    \tolerance    200
    \parpasses  3
    classes  \indecentparpassclasses
    threshold    0.025pt
    tolerance    800
    extrahyphenpenalty    50
  next
    threshold    0.025pt
    tolerance    900
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   10
    adjustspacingstretch  15
    next
    threshold    0.025pt
    tolerance    1000
    adjustspacing  3
    adjustspacingstep  1
    adjustspacingshrink   20
    adjustspacingstretch  40
    emergencystretch .25\bodyfontsize
    \relax
% \linebreakpasses\plusone
\stopsetups
The only difference between test 2 and 2b are that I increased the 
tolerance in each of the three passes.
In novel 2 this was successful in eliminating the overfull boxes but not 
in Novel 1 although I noticed that majority of overfull boxes were above 
1pt with the largest about 12pt in Novel 1.


I am at the stage now where I need some kind of strategy to 
reduce/eliminate overfull boxes, other than changing the tolerance, and 
I'm hoping for some advice from the community. Suggestions for further 
reading particularly on the commands in \setupalignpass and their usage 
would be appreciated and on the best way to tackle overfull boxes.


Best Wishes

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

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

[NTG-context] definedocument, begin & closing

2023-07-06 Thread Henning Hraban Ramm

Hi,
if I use \startdocument, the setups "document:start" and "document:stop" 
get inserted at the beginning and end. But if I define my own document, 
it doesn’t work. What’s wrong?


"""
\definedocument[presentation]

\startsetups[presentation:start]
{\bfd\documentvariable{title}}
\stopsetups

\startsetups[presentation:stop]
Thanks for all the fish.

\stopsetups


\startpresentation[title=Something]

anything

\stoppresentation
"""

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

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

  1   2   3   4   5   6   7   8   9   10   >