[NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?

2024-09-20 Thread Jim
On Fri, Sep 20, 2024 at 02:57 (+), Joel via ntg-context wrote:

> I have a document that's quite long. It uses a recurse function, a bit like 
> this:

> \starttext

>     \dostepwiserecurse{1}{180}{1}{%
>    \input chapter\recurselevel

> }
> \stoptext
> That produces 180  chapters of content.
> Anyway, my boss is upset she has to use a table of contents to navigate to 
> the page she wants, and so wants me to split the file into 180  separate 
> files, which somehow is going to be easier to look at. Honestly, she probably 
> still won't ever actually look at it, but that's her requirement.

> The problem is, I've been splitting the file by using Print --> PDF and 
> choosing a custom print range, and then saving it. If I ned to repeat that 
> 180 times, it not only will have errors, but probably take 5-10 hours.
> Is there something I can put, like \breakpdf or something that will tell it 
> to start a new PDF file? They can be named something like file1.pdf, 
> file2.pdf, etc.
> \starttext

>     \dostepwiserecurse{1}{136}{1}{%
>    \input chapter\recurselevel
> \breakpdf

> }
> \stoptext
> The perhaps "obvious" answer is just make 180  *.tex files, but since the 
> minimal example above is like 0.01% of the complexity of the real file, that 
> isn't so easy...

Joel,

others have suggested mutool and pdftk, which could be half the solution
for you.  (I use pdftk for things like this, but I assume mutool is just as
good.  Either are far less tedious than printing to file.)

If the information of the chapter boundaries is available in the log file,
a judicious use of grep and a few lines of shell script code might do the
trick.  Alternatively, you might be able to use a tool like pdfgrep to find
the page numbers from the PDF file, and then use a few lines of shell code.

If you are a Linux or Mac user, this should be "easy enough".  I don't do
windows, but now that there is (as I understand it) a bash shell available,
you might also be able to use grep and/or pdfgrep there as well.

If the log file isn't currently sufficiently helpful, could you add
something to your "start a new chapter" command to write a comment into the
log file giving you exactly the information you need?

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: How to tell a single *.tex file to produce separate PDFs?

2024-09-20 Thread Denis Maier via ntg-context
I was going to suggest pdftk which is similar to mutools. You can get
boundaries from a the log file and then split the file using these tools.
(Search the mailing list: I think that's also something ConTeXt might be
able to do natively, but I'm not sure.)

Then, you might also consider using a product-component based solution.
You'll then be able to process each file indivdually while still having a
main file around. The page numbers in the individual file will be incorrect,
i.e. always start at 1, but for having a quick look that still might be
nice. (Hans or Wolfgang probably know if there is a way to get correct page
numbers when using components...)

Best,
Denis

> -Ursprüngliche Nachricht-
> Von: vm via ntg-context 
> Gesendet: Freitag, 20. September 2024 10:23
> An: ntg-context@ntg.nl
> Cc: vm 
> Betreff: [NTG-context] Re: How to tell a single *.tex file to produce
separate
> PDFs?
> 
> 
> 
> On 20/09/2024 04:57, Joel via ntg-context wrote:
> >
> > Anyway, my boss is upset she has to use a table of contents to
> > navigate to the page she wants, and so wants me to split the file into
> > 180 separate files, which somehow is going to be easier to look at.
> > Honestly, she probably still won't ever actually look at it, but
> > that's her requirement.
> 
> 
> what is the difference between scrolling through your single page files
folder
> and scrolling through a single pdf?
> 
> How about  too search in the pdf?
> 
> 
> with mutools you can take a pdf aprt into individual pages.
> 
> 
> $ mutool --help
> usage: mutool  [options]
>   clean   -- rewrite pdf file
>   convert -- convert document
>   create  -- create pdf document
>   draw-- convert document
>   trace   -- trace device calls
>   extract -- extract font and image resources
>   info-- show information about pdf resources
>   merge   -- merge pages from multiple pdf sources into a new pdf
>   pages   -- show information about pdf pages
>   poster  -- split large page into many tiles
>   sign-- manipulate PDF digital signatures
>   run -- run javascript
>   show-- show internal pdf objects
> 
> 
> __
> _
> 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: 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 the correct page numbers and do the calculations with it?

2024-09-11 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 11.09.2024 um 04:22:

Thank you for your careful and patient explanation.
I'll check my code again.
Because it's still very simple,
and some situations haven't been taken into account.
In particular, the condition judgment to split the part of the box.


I run your code and already found a few example where it fails, e.g.

- when you have a very short text it is spread over the while line and 
you get a line break at the end
- when you use it in the narrower environment you don't compensate the 
left/right indentations



Regarding the part about referencing commands,
I inadvertently forgot to delete it.

I have a question about the command "\warichuparameter\c!XXX" :
Why can we use "\warichuparameter\c!XXX" instead of "\warichuparameter{XXX}" in 
most cases,
but in some cases, it says that the command is not defined?
For example, \warichuparameter\c!pointstyle -->   Control sequence expected 
instead of undefined

I've used "\warichuparameter\c!XXX" before, but it causes the error
because there are some keys that are specifically named.
For the sake of stylistic consistency, I used "\warichuparameter{XXX}" for all 
command.

Maybe it's because I didn't define it? Should I define the following in advance?

%%%
\def\c!pointstyle{pointstyle}
%%%


Yes, these constants are predefined to have language dependent keys in 
the setup command, e.g.


    \setupitemize[width=1cm]

is written as

    \stelleaufzaehlungein[breite=1cm]

with the german interface.


To ensure you use the correct name for the key you use \c!width as 
argument for the \xxxparameter command.



While you can use \def\c!...{...}  to create a new constant the proper 
method is to use \setinterfaceconstant.



You can run the following example to get a list with a predefined 
constant. When you uncomment the first three lines you see the new entry 
also appears in the list.


 begin example
% \startinterface all
% \setinterfaceconstant {pointstyle} {pointstyle}
% \stopinterface

\setuplayout[tight]

\starttext

\startluacode
context.startcolumns({n=3})
for constant, _ in table.sortedpairs(interfaces.constants) do
  context.mono(constant)
  context.par()
end
context.stopcolumns()
\stopluacode

\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: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

Bruce Horrocks schrieb am 11.09.2024 um 00:35:



On 10 Sep 2024, at 19:47, Wolfgang Schuster  
wrote:

You can't use page counters in running text without problems because you're 
working against the way how TeX constructs pages.

The only reliable way are multipass solutions like the pagestate or reference 
mechanism.

If commands such as \pagenumber and \userpagenumber don’t work reliably then 
maybe the commands should be removed? Just a thought.


They work without problems when you use them to show the pagenumber in 
the header/footer
because these elements are added when the page is finished and the 
values don't change anymore.


What doesn't works is to use them to print the number of the current 
page within running text
because TeX collects more text than it can fit on a single page which 
can result in the number

of the previous page when the text is moved to the next one.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread ai2472206007
Thank you for your careful and patient explanation. 
I'll check my code again. 
Because it's still very simple, 
and some situations haven't been taken into account.
In particular, the condition judgment to split the part of the box.

Regarding the part about referencing commands, 
I inadvertently forgot to delete it.

I have a question about the command "\warichuparameter\c!XXX" :
Why can we use "\warichuparameter\c!XXX" instead of "\warichuparameter{XXX}" in 
most cases, 
but in some cases, it says that the command is not defined? 
For example, \warichuparameter\c!pointstyle -->   Control sequence expected 
instead of undefined

I've used "\warichuparameter\c!XXX" before, but it causes the error 
because there are some keys that are specifically named. 
For the sake of stylistic consistency, I used "\warichuparameter{XXX}" for all 
command.

Maybe it's because I didn't define it? Should I define the following in advance?

%%% 
\def\c!pointstyle{pointstyle}
%%%
___
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 the correct page numbers and do the calculations with it?

2024-09-10 Thread Bruce Horrocks


> On 10 Sep 2024, at 19:47, Wolfgang Schuster 
>  wrote:
> 
> You can't use page counters in running text without problems because you're 
> working against the way how TeX constructs pages.
> 
> The only reliable way are multipass solutions like the pagestate or reference 
> mechanism.

If commands such as \pagenumber and \userpagenumber don’t work reliably then 
maybe the commands should be removed? Just a thought.

—
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: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 10.09.2024 um 06:05:

1. The usage of the command  "\definepagestate " is what I searched for in 
previous posts and source files.
I don't know exactly how he used it. (╥﹏╥)

2. I've devised a command that needs to get the current page number to 
determine if it's an odd or even page.
This is then used to get a certain width to determine the width of the command 
on that line.
Below I designed the command. The code related to this issue is mainly

%%% code related to this issue
 \rest@linewidth=\dimexpr%
 \ifdoublesided%   if singlesided restlinewidth = 
oddpos  - xpos
   \ifodd\pageno%  if doublesided
   \oddpos@warichu%   and if odd  restlinewidth = oddpos  - 
xpos
 \else\evenpos@warichu\fi%and if even restlinewidth = evenpos - xpos
 \else\oddpos@warichu \fi%
 -\MPx\xpos@warichu\relax%
%%%

 main code
\unprotect
\installnamespace {warichu}
\installsimplecommandhandler \warichu {warichu} \warichu
\setupwarichu[style=\ssxx,
   voffset=-1.5pt,
   distance=\hskip1pt\relax,
   left={},right={},
   reference=,]


There is no need to set empty default values \warichuparameter checks if 
there is value.



\newcount\cnt@warichu
\newdimen\rest@linewidth
\newdimen\oddpos@warichu
\newdimen\evenpos@warichu


The current naming system for count and dimen register is

- \c_xxx (e.g. \c_warichu_n) for counters and
- \d_... (e.g. \d_warichu_odd) for dimensions.

We also use underbar instead of @ to create internal commands names.


\oddpos@warichu =\dimexpr\backspace+\textwidth\relax
\evenpos@warichu=\dimexpr\paperwidth-\cutspace\relax


You have to do these assignment in your \warichu command because now you use
the current values for \textwidth etc. which is a problem when you 
create a module

for your command.

When you load the module the register for the odd and even values use 
whather

was set for \textwidth etc. when you loaded the module. This means you have
to always change the layout of the document before you load the module,
otherwise the text width of the document can be different from the one used
in your module to calculate both values.


\def\get@split@box#1{%
 \setbox\scratchboxone\hbox{%
 \hsplit\scratchbox %
   to #1%
   shrinkcriterium 1%
 \par\allowbreak}%
 \box\scratchboxone}
\def\warichu{\dosingleempty\warichu@indeed}
\def\warichu@indeed[#1]#2{\begingroup%


You can drop the two-step definition for optional parameters when you use
the \tolerant for the command definition.

\tolerant\def\warichu[#1]#:#2%
  {...}


 \global\advance\cnt@warichu by 1\relax%


You don't need % at the end when you end the line with a command (e.g. 
\relax).



 \iffirstargument\setupwarichu[#1]\fi%


Change this to

\ifparameter#1\or\setupwarichu[#1]\fi

when you use \tolerant or drop the check for the optional parameter and 
just use


\setupwarichu[#1]%


 \warichuparameter{distance}%


I would change this to

\hskip\warichuparameter\c!distance\relax

and set the distance value as

\setupwarichu[distance=1pt]


 \warichuparameter{left}%


Can be changed to (no need for %)

\warichuparameter\c!left


 \pagereference[warichu:\number\cnt@warichu]% may be useful
 \textreference[\warichuparameter{reference}]{\warichuparameter{reference}}%


Do you need both references (what even is the purpose of \textreference 
here)?


You should also add \dontleavehmode at the start of \warichu because 
references (and also

the following \xypos) whould be part of a paragraph.


 \xypos{warichu:\number\cnt@warichu}%
 \edef\xpos@warichu{warichu:\number\cnt@warichu}%


You can change the order of both lines:

   \edef\xpos@warichu{warichu:\number\c_warichu_n}%
   \xypos\xpos@warichu


 \rest@linewidth=\dimexpr%
 \ifdoublesided%   if singlesided restlinewidth = 
oddpos  - xpos
   \ifodd\pageno%  if doublesided
   \oddpos@warichu%   and if odd  restlinewidth = oddpos  - 
xpos
 \else\evenpos@warichu\fi%and if even restlinewidth = evenpos - xpos
 \else\oddpos@warichu \fi%
 -\MPx\xpos@warichu\relax%
 \setbox\scratchbox\hbox{\usewarichustyleandcolor\c!style\c!color #2\relax}%
 \raise\warichuparameter{voffset}\relax%
 \vbox{\offinterlineskip%
 \get@split@box{\the\rest@linewidth}%
 \get@split@box{\the\rest@linewidth}}\allowbreak%
 \doloop{%
 \ifdim\wd\scratchbox>\dimexpr\textwidth*2\relax%
 \raise\warichuparameter{voffset}%
 \vbox{\offinterlineskip%
 \get@split@box{\the\textwidth}%
 \get@split@box{\the\textwidth}}\allowbreak%
 \else%
 \raise\warichuparameter{voffset}%
 \vbox{\offinterlineskip%
 \get@split@box{\dimexpr\wd\scratchbox/2+1pt\relax}%
  

[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

Bruce Horrocks schrieb am 09.09.2024 um 23:27:

On 9 Sep 2024, at 08:57, ai2472206...@yeah.net wrote:

As the title suggests, how do I get the correct page numbers?


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.


You can't use page counters in running text without problems because 
you're working against the way how TeX constructs pages.


The only reliable way are multipass solutions like the pagestate or 
reference mechanism.


Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 10.09.2024 um 06:05:

1. The usage of the command  "\definepagestate " is what I searched for in 
previous posts and source files.
I don't know exactly how he used it. (╥﹏╥)

2. I've devised a command that needs to get the current page number to 
determine if it's an odd or even page.
This is then used to get a certain width to determine the width of the command 
on that line.
Below I designed the command. The code related to this issue is mainly


You have to differentiate between odd and even and right hand and left 
hand pages.


When you want to check whether you have an right hand or left hand page 
you can use the following method.
To get the correct result ensure you start a paragraph before you set 
the flag with \signalrightpage.


 begin example
%\setuppagenumbering[alternative=doublesided]
%\setuppagenumbering[alternative={singlesided,doublesided}]

\starttext

\dorecurse{20}
  {\dontleavehmode\signalrightpage\doifelserightpage{\bold{Right 
page}}{\bold{Left page}}

   \samplefile{lorem}}

\stoptext
 end example

To have a check which works for odd and even pages you have to use the 
pagestate mechanism.
Even in this case it is important to start a paragraph before save the 
current state, afterwards

you can check the stored pagenumber.

 begin example
\definepagestate[warichu]

\starttext

\dorecurse{20}
  {\dontleavehmode\autosetpagestate{warichu}%
   \ifodd0\autopagestaterealpage{warichu}%
 \bold{Odd page}
   \else
 \bold{Even page}
   \fi
   \samplefile{lorem}}

\stoptext
 end example

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-10 Thread vm via ntg-context




On 10/09/2024 06:32, ai2472206...@yeah.net wrote:

I changed the command, and now I get the correct page number with this command, 
\
but how should he do the calculation?



this gives an interesting result with a colorful mix of page numbers,
although it is not obvious to me as why.


\setupinterlinespace[18pt]
\definepagestate[test][delay=yes]
\starttext
\dorecurse{15}{
{\ssd\color[red]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
\input knuth
{\ssd\color[green]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
}
\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: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
I changed the command, and now I get the correct page number with this command, 
\
but how should he do the calculation?

\starttext
\definepagestate[test][delay=yes]
\dorecurse{10}{%
\input knuth %
{\ssd\color[red]{\setpagestate[test]\pagestaterealpage{test}{#1}}}
}
\stoptext

Regards,
---
Muyik
___
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 the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
That's true, but there seems to be a problem with all three examples, 
the first page number on the second page is all wrong with an output of 1. 
There must be some kind of  mechanism that we don't know.
___
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 the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
I used serif fonts and added color just to emphasize this page number. 
However, it is true that in some cases it is not possible to get the correct 
page correctly with these commands.
___
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 the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
1. The usage of the command  "\definepagestate " is what I searched for in 
previous posts and source files. 
I don't know exactly how he used it. (╥﹏╥)

2. I've devised a command that needs to get the current page number to 
determine if it's an odd or even page. 
This is then used to get a certain width to determine the width of the command 
on that line. 
Below I designed the command. The code related to this issue is mainly

%%% code related to this issue
\rest@linewidth=\dimexpr%
\ifdoublesided%   if singlesided restlinewidth = 
oddpos  - xpos
  \ifodd\pageno%  if doublesided
  \oddpos@warichu%   and if odd  restlinewidth = oddpos  - 
xpos
\else\evenpos@warichu\fi%and if even restlinewidth = evenpos - xpos
\else\oddpos@warichu \fi%
-\MPx\xpos@warichu\relax%
%%%

 main code
\unprotect
\installnamespace {warichu}
\installsimplecommandhandler \warichu {warichu} \warichu
\setupwarichu[style=\ssxx,
  voffset=-1.5pt,
  distance=\hskip1pt\relax,
  left={},right={},
  reference=,]
\newcount\cnt@warichu
\newdimen\rest@linewidth
\newdimen\oddpos@warichu 
\newdimen\evenpos@warichu
\oddpos@warichu =\dimexpr\backspace+\textwidth\relax
\evenpos@warichu=\dimexpr\paperwidth-\cutspace\relax
\def\get@split@box#1{%
\setbox\scratchboxone\hbox{%
\hsplit\scratchbox %
  to #1%
  shrinkcriterium 1%
\par\allowbreak}%
\box\scratchboxone}
\def\warichu{\dosingleempty\warichu@indeed}
\def\warichu@indeed[#1]#2{\begingroup%
\global\advance\cnt@warichu by 1\relax%
\iffirstargument\setupwarichu[#1]\fi%
\warichuparameter{distance}%
\warichuparameter{left}%
\pagereference[warichu:\number\cnt@warichu]% may be useful
\textreference[\warichuparameter{reference}]{\warichuparameter{reference}}%
\xypos{warichu:\number\cnt@warichu}%
\edef\xpos@warichu{warichu:\number\cnt@warichu}%
\rest@linewidth=\dimexpr%
\ifdoublesided%   if singlesided restlinewidth = 
oddpos  - xpos
  \ifodd\pageno%  if doublesided
  \oddpos@warichu%   and if odd  restlinewidth = oddpos  - 
xpos
\else\evenpos@warichu\fi%and if even restlinewidth = evenpos - xpos
\else\oddpos@warichu \fi%
-\MPx\xpos@warichu\relax%
\setbox\scratchbox\hbox{\usewarichustyleandcolor\c!style\c!color #2\relax}%
\raise\warichuparameter{voffset}\relax%
\vbox{\offinterlineskip%
\get@split@box{\the\rest@linewidth}%
\get@split@box{\the\rest@linewidth}}\allowbreak%
\doloop{%
\ifdim\wd\scratchbox>\dimexpr\textwidth*2\relax%
\raise\warichuparameter{voffset}%
\vbox{\offinterlineskip%
\get@split@box{\the\textwidth}%
\get@split@box{\the\textwidth}}\allowbreak%
\else%
\raise\warichuparameter{voffset}%
\vbox{\offinterlineskip%
\get@split@box{\dimexpr\wd\scratchbox/2+1pt\relax}%
\get@split@box{\dimexpr\wd\scratchbox+1pt\relax}}\allowbreak%
 \exitloop%
  \fi}%
\warichuparameter{right}%
\warichuparameter{distance}\endgroup}
\protect
\starttext
\section{}
\input darwin \warichu[reference=warichu:44]{\input darwin \input knuth }
\input knuthmath  \warichu{\input knuth } \input knuth
\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: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread vm via ntg-context

this will go wrong as well:

\starttext
\dorecurse{15}{\ssd
\input knuth
{\color[red]{\pagenumber}}
}
\stoptext


and this as well:

\starttext
\dorecurse{15}{\tfb
\input knuth
{\color[red]{\pagenumber}}   % as expected
}
\stoptext


and so does this:

\setupinterlinespace[16pt]
\starttext
\dorecurse{15}{
\input knuth
{\color[red]{\pagenumber}}   % as expected
}
\stoptext



(and there is probably a valid reason to it ;-)


.F



On 09/09/2024 23:27, Bruce Horrocks wrote:

On 9 Sep 2024, at 08:57,ai2472206...@yeah.net wrote:

As the title suggests, how do I get the correct page numbers?


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.

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
___



___
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 the correct page numbers and do the calculations with it?

2024-09-09 Thread Bruce Horrocks
On 9 Sep 2024, at 08:57, ai2472206...@yeah.net wrote:
> 
> As the title suggests, how do I get the correct page numbers? 


There does seem to be an anomaly here. Simpler MWE:

\starttext
\dorecurse{15}{
\input knuth
%{\ssd\color[red]{\pagenumber}} % not as expected
{\color[red]{\pagenumber}}   % as expected
}
\stoptext

With the \ssd the first number at the top of the second and subsequent pages is 
one less than it should be. Without the \ssd then the numbers are as expected.

@Muyik: Are you able to use \pagenumber without using \ssd or similar to change 
the size? That might be a work-around for you. There is also \userpagenumber.

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: how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 09.09.2024 um 09:57:

Thank to all who answered my questions before.
As the title suggests, how do I get the correct page numbers?
For example, in the example below,
the first line on the 2nd page, but the page number showed is 1,
In the meantime, I tried using \definepagestate,
but it didn't seem to work either.
What I can think of is to use citations to get the correct page number.
But it seems that what is obtained is not a pure number,
and it cannot do the calculations.

so ,how do I get the correct page numbers and do the calculations with it?


1. You save only 1 pagestate with index 0 but you try to access the data 
of the pagestates with index 1 to 10.


2. What do you try to achieve here?

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] how do I get the correct page numbers and do the calculations with it?

2024-09-09 Thread ai2472206007
Thank to all who answered my questions before. 
As the title suggests, how do I get the correct page numbers? 
For example, in the example below, 
the first line on the 2nd page, but the page number showed is 1,
In the meantime, I tried using \definepagestate, 
but it didn't seem to work either. 
What I can think of is to use citations to get the correct page number. 
But it seems that what is obtained is not a pure number, 
and it cannot do the calculations.

so ,how do I get the correct page numbers and do the calculations with it?

thanks.
%% start example
\starttext

%%% try page state
\definepagestate[test][delay=yes]
\newcount\test
\let\testfloatrealpage\realpageno
\def\testsavedata
  {\setpagestate[test][\number\test]}
\def\testloaddata % precedes save !
  {\global\advance\test\plusone
   \xdef\testfloatrealpage{\pagestaterealpage{test}{\number\test}}
   \ifx\testfloatrealpage\empty
\glet\testfloatrealpage\realpageno
   \fi}
\testsavedata%
%%%
\dorecurse{10}{%
\testloaddata%
\input knuth \pagereference[XX:#1]
{\ssd\color[red]{\the\pageno}}%   on page 2 and show page 1
{\ssd\color[red]{\the\testfloatrealpage}}%on page 2 and show page 1
{\ssd\color[red]{\ref[page][XX:#1]}}% on page 2 and show page 2
}
\stoptext
% stop example

  Muyik
___
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: Inserting text between end notes

2024-09-03 Thread Rik Kabel

Thank you for that, Bruce.

While it is still a hack, as you note, it is less fraught since one does 
not have to keep track of the last end note in each chapter.


I would still like to see a real ability to add text to the note collection.

--
Rik

On 2024-09-01 14:31, Bruce Horrocks wrote:



On 1 Sep 2024, at 03:53, Rik Kabel wrote:

Hello all,
I am trying to implement some style-guide-defined (Chicago 17, and now, 18) 
requirements to the end notes in a book. The need is to insert non-end-note 
text into the list of end notes. But end notes are not a list (as far as I can 
see) and \writetolist and such are no help.
The text to be inserted is of two types. The first is the name of the chapter 
from which the following notes were generated. It would be nice to 
automatically generate these.
The second type is pseudo-end-notes crediting the book and chapter epigraphs, 
which should appear as unnumbered end notes (at the start of the note section 
and the start of each chapter's notes). Ideally these would be generated in the 
same way as regular end notes but will not increment the note numbers (and 
should not, at least in my use case, require cross-referencing or bookmarking).
I can hack the first requirement with:
\define[1]\EndNoteChapter{\testpage[3]
   \blank
   \midaligned{\tfa{Chapter #1}}
   \blank}
in the environment and
\EndNoteChapter{6 How I Saved the World}
at the end of the last end note in the preceding chapter, but this is obviously 
prone to mistakes. I would rather integrate the handling into the chapter 
heading environment.
I suppose that this hack might be extended to handle the epigraph notes as 
well, but it is just a hack.
Has anyone successfully dealt with this before? If not, is there the 
possibility of adding similar functionality to \writetolist and such for end 
note structures?

Here’s a bit of a hack for the chapter splitting and might also enable the 
epigraphs for you as well (not quite sure what these should look like from your 
description.)

\definenote[mynote]
\setupnote[mynote][location=text]
\setupnotation[mynote][]

\definenote[chapone][mynote]
\definenote[chaptwo][mynote]
\definenote[chapthree][mynote] % etc

\starttext

\startchapter[title={AAA}]
\def\note#1{\chapone{#1}}
\dorecurse{15}
{ See my note at \note{something important}. }
\stopchapter

\startchapter[title={BBB}]
\def\note#1{\chaptwo{#1}}
\dorecurse{5}
{ See my note at \note{something important}. }
\stopchapter

\title{Endnotes}
Chapter 1 notes
\placenotes[chapone]
\blank[2*line]

Chapter 2 notes
\placenotes[chaptwo]

\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
__
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: Inserting text between end notes

2024-09-01 Thread Bruce Horrocks


> On 1 Sep 2024, at 03:53, Rik Kabel  wrote:
> 
> Hello all,
> I am trying to implement some style-guide-defined (Chicago 17, and now, 18) 
> requirements to the end notes in a book. The need is to insert non-end-note 
> text into the list of end notes. But end notes are not a list (as far as I 
> can see) and \writetolist and such are no help.
> The text to be inserted is of two types. The first is the name of the chapter 
> from which the following notes were generated. It would be nice to 
> automatically generate these.
> The second type is pseudo-end-notes crediting the book and chapter epigraphs, 
> which should appear as unnumbered end notes (at the start of the note section 
> and the start of each chapter's notes). Ideally these would be generated in 
> the same way as regular end notes but will not increment the note numbers 
> (and should not, at least in my use case, require cross-referencing or 
> bookmarking).
> I can hack the first requirement with:
> \define[1]\EndNoteChapter{\testpage[3]
>   \blank
>   \midaligned{\tfa{Chapter #1}}
>   \blank}
> in the environment and
> \EndNoteChapter{6 How I Saved the World}
> at the end of the last end note in the preceding chapter, but this is 
> obviously prone to mistakes. I would rather integrate the handling into the 
> chapter heading environment.
> I suppose that this hack might be extended to handle the epigraph notes as 
> well, but it is just a hack.
> Has anyone successfully dealt with this before? If not, is there the 
> possibility of adding similar functionality to \writetolist and such for end 
> note structures?

Here’s a bit of a hack for the chapter splitting and might also enable the 
epigraphs for you as well (not quite sure what these should look like from your 
description.)

\definenote[mynote]
\setupnote[mynote][location=text]
\setupnotation[mynote][]

\definenote[chapone][mynote]
\definenote[chaptwo][mynote]
\definenote[chapthree][mynote] % etc

\starttext

\startchapter[title={AAA}]
\def\note#1{\chapone{#1}}
\dorecurse{15}
{ See my note at \note{something important}. }
\stopchapter

\startchapter[title={BBB}]
\def\note#1{\chaptwo{#1}}
\dorecurse{5}
{ See my note at \note{something important}. }
\stopchapter

\title{Endnotes}
Chapter 1 notes
\placenotes[chapone]
\blank[2*line]

Chapter 2 notes
\placenotes[chaptwo]

\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] Inserting text between end notes

2024-08-31 Thread Rik Kabel

Hello all,

I am trying to implement some style-guide-defined (Chicago 17, and now, 
18) requirements to the end notes in a book. The need is to insert 
non-end-note text into the list of end notes. But end notes are not a 
list (as far as I can see) and \writetolist and such are no help.


The text to be inserted is of two types. The first is the name of the 
chapter from which the following notes were generated. It would be nice 
to automatically generate these.


The second type is pseudo-end-notes crediting the book and chapter 
epigraphs, which should appear as unnumbered end notes (at the start of 
the note section and the start of each chapter's notes). Ideally these 
would be generated in the same way as regular end notes but will not 
increment the note numbers (and should not, at least in my use case, 
require cross-referencing or bookmarking).


I can hack the first requirement with:

   \define[1]\EndNoteChapter{\testpage[3]
  \blank
  \midaligned{\tfa{Chapter #1}}
  \blank}

in the environment and

   \EndNoteChapter{6 How I Saved the World}

at the end of the last end note in the preceding chapter, but this is 
obviously prone to mistakes. I would rather integrate the handling into 
the chapter heading environment.


I suppose that this hack might be extended to handle the epigraph notes 
as well, but it is just a hack.


Has anyone successfully dealt with this before? If not, is there the 
possibility of adding similar functionality to \writetolist and such for 
end note structures?


--
Rik
___
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: Is there an alternative to \reference[]{} that won't interfere with the document design?

2024-08-31 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 31.08.2024 um 16:37:
I had to place \reference[]{} in various places in my document as I need 
to refer to page numbers of a lot of various items in the document. 
There are hundreds of these. When placing them, I hadn't realized it 
would impact the document design--I assumed such a command would be 
invisible.


Though I've tried placing as many inside the section titles, where they 
become invisible, I've found just placing \reference[]{} anywhere on a 
page will create extra blank spaces, leading my document to expand from 
440 lines to 448. It added up quite quickly to 8 whole pages. No matter 
how much I use % or try to hide it within the page, it still produces 
weird results. It isn't invisible, its doing things to the document, 
moving text around, leaving gaps. In addition, it makes the document 
look haphazard, creating random formatting "glitches".


I'm assuming because \reference has a curly bracket {} that its causing 
something to be rendered, even it its not really something visible 
always, it often makes a carriage return on the page if placed say after 
a table, or before a section title. Sadly, the way the document was 
designed I don't have a way to integrate them inside the section titles 
everywhere, there are too many and some need to mark a specific page 
within a section.


I haven't placed anything inside the {} and only use the square brackets 
to mark the reference name. Is there an alternative command that won't 
occupy space like this?


Did you learn anything from the answers of your last question [1] with 
similar content?


Hint: Minimal example!

[1] https://www.mail-archive.com/ntg-context@ntg.nl/msg108092.html

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Is there an alternative to \reference[]{} that won't interfere with the document design?

2024-08-31 Thread Joel via ntg-context
I had to place \reference[]{} in various places in my document as I need to 
refer to page numbers of a lot of various items in the document. There are 
hundreds of these. When placing them, I hadn't realized it would impact the 
document design--I assumed such a command would be invisible.
Though I've tried placing as many inside the section titles, where they become 
invisible, I've found just placing \reference[]{} anywhere on a page will 
create extra blank spaces, leading my document to expand from 440 lines to 448. 
It added up quite quickly to 8 whole pages. No matter how much I use % or try 
to hide it within the page, it still produces weird results. It isn't 
invisible, its doing things to the document, moving text around, leaving gaps. 
In addition, it makes the document look haphazard, creating random formatting 
"glitches".

I'm assuming because \reference has a curly bracket {} that its causing 
something to be rendered, even it its not really something visible always, it 
often makes a carriage return on the page if placed say after a table, or 
before a section title. Sadly, the way the document was designed I don't have a 
way to integrate them inside the section titles everywhere, there are too many 
and some need to mark a specific page within a section.
I haven't placed anything inside the {} and only use the square brackets to 
mark the reference name. Is there an alternative command that won't occupy 
space like this?
--Joel
___
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: digits / units setup

2024-08-25 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 24.08.2024 um 20:59:

Am 24.08.24 um 20:38 schrieb Henning Hraban Ramm:

According to docs,

\setupunit[method=3]

should change the rendering of numbers in

\unit{10,123.99 mm} or \digits{10,123.99} to “10\,123,99”,

but it doesn’t.

\setdigitmode{3} works, though.


Seems to be a problem of my environment.

In a minimal example, \setupunit changes \unit, \setdigitmode changes 
\digits.


The \digits mechanism was never extended to provide a basic setup mechanism
which means you have to use the \set... commands to change the output.

Wolfgang

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Is there a short-cut to adding sub-categories for index entries?

2024-08-25 Thread Henning Hraban Ramm

Am 25.08.24 um 15:38 schrieb Joel via ntg-context:

I have a document with thousands of index entries. Here’s a sample code:
Some people lived in 
\index{cliff-dwelling}\index{dwellings+cliff-dwelling}cliff-dwellings, 
while others lived in \index{lean-to}\index{dwellings+lean-to}lean-tos.




I’m wondering if there is a short-cut means to set this up, such that if 
I can tell the document that any time it sees “cliff-dwellings” in an 
index, it will also add its page numbers to under 
“dwellings+cliff-dwelling”? In other words, is there an easier way to 
add these categories, then to go through the entire document and mark 
them? I already have a list of all the words.


For instance, in my above code, I must find every \index{cliff-dwelling} 
entry and add a \index{dwellings+cliff-dwelling} next to it...which 
would take hundreds of hours if I did that for every word. Is there a 
quicker way to tell it always also add it under "dwellings" too?


If it’s just a few instances, define a macro:

\define[1]\DwIndex{\index{#1}\index{dwellings+#1}#1}

For a list of words, a lookup table and a Lua function make sense.

With a comparable problem, normalizing location names, I used this:

-- lookups.lua
userdata = userdata or { }

userdata.Mapping = {
  ["Albano"] = "Albano (Provinz Rom)",
  ["Altona"] = "Altona (Hamburg)",
  ["Aurich"] = "Aurich (Ostfriesland)",
-- …
}

function userdata.Lookup(name)
  context(userdata.Mapping[name] or name)
end


%%% environment

\loadluafile[lookups.lua]
\defineregister[Location][]
\define[1]\LocIndex{\expanded{\Location{%
  \ctxlua{userdata.Lookup("#1")


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] Is there a short-cut to adding sub-categories for index entries?

2024-08-25 Thread Joel via ntg-context
 
I have a document with thousands of index entries. Here’s a samplecode:




\starttext

 Some people livedin \index{cliff-dwelling}cliff-dwellings, while others lived 
in\index{lean-to}lean-tos.




\placeindex

\stoptext




This produces anindex like this:







c

cliff-dwelling 1







 l

 lean-to 1




I’d like to createan index with much more sub-categories to find the same 
entries, forinstance, a category of “dwellings”:




c

cliff-dwelling 1







d

dwellings

 cliff-dwelling 1

 lean-to 1




 l

 lean-to 1




As I’m aware, theway to code this is as follows:

\starttext

 Some people 
livedin\index{cliff-dwelling}\index{dwellings+cliff-dwelling}cliff-dwellings,while
 others lived in\index{lean-to}\index{dwellings+lean-to}lean-tos.




\placeindex

\stoptext



I’m wondering ifthere is a short-cut means to set this up, such that if I can 
tellthe document that any time it sees “cliff-dwellings” in an index,it will 
also add its page numbers to under “dwellings+cliff-dwelling”? In other words, 
is there an easierway to add these categories, then to go through the entire 
documentand mark them? I already have a list of all the words. 
For instance, in my above code, I must find every \index{cliff-dwelling} entry 
and add a \index{dwellings+cliff-dwelling} next to it...which would take 
hundreds of hours if I did that for every word. Is there a quicker way to tell 
it always also add it under "dwellings" too?




--Joel

___
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: digits / units setup

2024-08-24 Thread Henning Hraban Ramm

Am 24.08.24 um 20:38 schrieb Henning Hraban Ramm:

According to docs,

\setupunit[method=3]

should change the rendering of numbers in

\unit{10,123.99 mm} or \digits{10,123.99} to “10\,123,99”,

but it doesn’t.

\setdigitmode{3} works, though.


Seems to be a problem of my environment.

In a minimal example, \setupunit changes \unit, \setdigitmode changes 
\digits.


Sorry for the noise.

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] digits / units setup

2024-08-24 Thread Henning Hraban Ramm

According to docs,

\setupunit[method=3]

should change the rendering of numbers in

\unit{10,123.99 mm} or \digits{10,123.99} to “10\,123,99”,

but it doesn’t.

\setdigitmode{3} works, though.


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 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] Missing \endcsname inserted error

2024-08-13 Thread Jeong Dal via ntg-context
Hi, 

I draw a figure using MetaFun and insert it \startplacefigure and 
\stopplacefigure.
(Sample file is listed below)
But, I got an error as following:

Missing \endcsname inserted

 

\defcsname 
 \mult_interfaces_get_parameters_item_okay 
#1=#S#2,->\ifarguments \or \mult_interfaces_get_parameters_item_error 
{#1}\else \defcsname \m_mult_interfaces_namespace #1
\endcsname {#2}\fi 
 \mult_interfaces_get_parameters_item 
#*#S#1,->\ifarguments \expandafter \gobbleoneargument \else 
\mult_interfaces_get_parameters_item_okay #1,


If I remove "\startplacefigure and \stopplacefigure”, then there is no error, 
but the figure is not centered.

Please tell me how to fix it.

Thank you for reading.

Best regards,

Dalyoung


\startbuffer[numbers]
path p,q;

p =  unitsquare xyscaled(3,2) superellipsed .85 ;
q :=  p scaled 1cm;
draw q;
label.bot(textext("\naturalnumbers"), point 2 of q);

q :=  p scaled 1.5cm shifted (-.75cm,-.2cm);
draw q ;
label.bot(textext("\integers"), point 2 of q);

q :=  p scaled 2cm shifted (-1.5cm,-.4cm);
draw q;
label.bot(textext("\rationals"), point 2 of q);

q :=  p scaled 2.5cm shifted (-2.25cm,-.6cm);
draw q;
label.bot(textext("\reals"), point 2 of q);

q :=  p scaled 3cm shifted (-3cm,-.8cm);
draw q;
label.bot(textext("\Bbb C"), point 2 of q);
\stopbuffer
\starttext
\startplacefigure[location=none,\title=]
{\scale[scale=1400]{\processMPbuffer[numbers]}}
\stopplacefigure
\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: How can I force ConTeXt to display my footnote on the same page as my foot note marker?

2024-07-29 Thread Hans Hagen via ntg-context

On 7/27/2024 3:35 PM, ai2472206...@yeah.net wrote:

Hi,

I have a document that contains a lot of footnotes.
Therefore, I used to separate the footnote number from the footnote text,
which would make the source file look more readable.

Therefore, I used a similar approach to 'CASE 1', but not 'CASE 2' ,
placing footnotes related to the previous paragraphs every few paragraphs.
But when I was generating a PDF,
  I found that the footnote didn't always appear on the same page as its 
footnote number,
even though the footnote had very little text.

What can I do to get my idea to work?

Thanks for any suggestions.

  Muyik.


% The above text was translated through Bing
% because I am not a native English speaker.
% If there is anything unclear, whatever it is, tell me.

%%
\setuppapersize[A6]
\starttext

% case 1

\input knuthmath \note[1]

\input knuthmath \note[2]
\input knuthmath
\input knuthmath

\footnotetext[1]{\input knuthmath }
\footnotetext[2]{\input knuth }

% In this case, the text of footnotes 1 and 2 is placed on the same page,
% but they are separated from the footnote numbers on different pages

\page

% case 2

\input knuthmath \note[1]
\footnotetext[1]{\input knuthmath }

\input knuthmath \note[2]
\input knuthmath
\input knuthmath

\footnotetext[2]{\input knuth }

% Maybe this situation might get what I wanted, but after all,
% footnotes are not as important as the main text,
% and working on the footnotes while writing the main text may not be the right 
way for me

\stoptext
footnotes are implemented using inserts so the text, when entered is 
kept with the 'location' .. this permits the page builders to choose 
breakpoints that


decoupling the location and test itself should be done in a controlled 
way because otherwise a page break can already have been decided


\starttext

\startbuffer[note:1]
\input{knuthmath}
\stopbuffer
\startbuffer[note:2]
\input{knuth}
\stopbuffer

\input knuthmath \footnote{\inlinebuffer[note:1]}
\input knuthmath \footnote{\inlinebuffer[note:2]}
\input knuthmath
\input knuthmath

\stoptext

-
  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] How can I force ConTeXt to display my footnote on the same page as my foot note marker?

2024-07-27 Thread ai2472206007
Hi,

I have a document that contains a lot of footnotes. 
Therefore, I used to separate the footnote number from the footnote text, 
which would make the source file look more readable.

Therefore, I used a similar approach to 'CASE 1', but not 'CASE 2' , 
placing footnotes related to the previous paragraphs every few paragraphs. 
But when I was generating a PDF,
 I found that the footnote didn't always appear on the same page as its 
footnote number, 
even though the footnote had very little text.

What can I do to get my idea to work?

Thanks for any suggestions.

 Muyik.


% The above text was translated through Bing 
% because I am not a native English speaker. 
% If there is anything unclear, whatever it is, tell me.

%%
\setuppapersize[A6]
\starttext

% case 1

\input knuthmath \note[1]

\input knuthmath \note[2]
\input knuthmath 
\input knuthmath

\footnotetext[1]{\input knuthmath }
\footnotetext[2]{\input knuth } 

% In this case, the text of footnotes 1 and 2 is placed on the same page, 
% but they are separated from the footnote numbers on different pages

\page

% case 2

\input knuthmath \note[1]
\footnotetext[1]{\input knuthmath }

\input knuthmath \note[2]
\input knuthmath 
\input knuthmath

\footnotetext[2]{\input knuth }

% Maybe this situation might get what I wanted, but after all, 
% footnotes are not as important as the main text, 
% and working on the footnotes while writing the main text may not be the right 
way for me

\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: Extra space in numbers

2024-07-16 Thread Hans Hagen

On 7/16/2024 10:32 AM, Shiv Shankar Dayal wrote:

Much thanks, Hans. I am curious why this is not default behavior?

if could be(come) but we're not sure how it affects existing documents

tex has not really a concept of space and in math even less but in 
luametatex we carry around some more info so there we can actually plug 
into that and act upon it, meaning that in


  1, 2

meaning

  atom(1) atom(,) atom(2)

in our case the middle one among other things knows that it was followed 
by a space or not. Also, in (1,2) one actually might want the space so 
soem additional (lua) processing can be enabled to deal with that too.


Hans

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

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

maillist : ntg-context@ntg.nl / 
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: Extra space in numbers

2024-07-16 Thread Shiv Shankar Dayal
Much thanks, Hans. I am curious why this is not default behavior?

On Tue, Jul 16, 2024 at 6:20 AM Hans Hagen  wrote:

> On 7/16/2024 7:01 AM, Shiv Shankar Dayal wrote:
> > Dear Lits,
> >
> > Suppose I have  $10,000$ then in the output there is extra space after
> > comma. How can I get rid of it?
> \setupmathematics[autopunctuation=yes]
>
> $10,000$
>
> $10, 000$
>
> no | yes | all | comma | {yes,semicolon} | {all,semicolon}
>
> see math manual for all kinds of control
>
> 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
>
> ___
>


-- 
Respect,
Shiv Shankar Dayal
___
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: [External] Extra space in numbers

2024-07-15 Thread Hans Hagen

On 7/16/2024 1:50 AM, Rogers, Michael K wrote:

Hi,
Braces around the comma, $10{,}000$, works for me. It’s the plain TeX 
way. If there’s a way to set up mathematics in ConTeXt to do this, 
perhaps someone else will fill us in.
in lmtx { } in math is just grouping, so no ordinary math atom is 
created; also, digits have their own class which is hoe we control 
inter-atom spacing


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: Extra space in numbers

2024-07-15 Thread Hans Hagen

On 7/16/2024 7:01 AM, Shiv Shankar Dayal wrote:

Dear Lits,

Suppose I have  $10,000$ then in the output there is extra space after 
comma. How can I get rid of it?

\setupmathematics[autopunctuation=yes]

$10,000$

$10, 000$

no | yes | all | comma | {yes,semicolon} | {all,semicolon}

see math manual for all kinds of control

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: [External] Extra space in numbers

2024-07-15 Thread Rogers, Michael K
Hi,
Braces around the comma, $10{,}000$, works for me. It’s the plain TeX way. If 
there’s a way to set up mathematics in ConTeXt to do this, perhaps someone else 
will fill us in.

Michael

On Jul 15, 2024, at 10:01 PM, Shiv Shankar Dayal  
wrote:

Suppose I have  $10,000$ then in the output there is extra space after comma. 
How can I get rid of it?


___
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] Extra space in numbers

2024-07-15 Thread Shiv Shankar Dayal
Dear Lits,

Suppose I have  $10,000$ then in the output there is extra space after
comma. How can I get rid of it?

-- 
Respect,
Shiv Shankar Dayal
___
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 float split behavior

2024-07-08 Thread vm via ntg-context




On 08/07/2024 16:25, Henning Hraban Ramm wrote:

Try #1, it often works where \recurselevel fails.


That gives the intended numbers.
Thank you

___
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: No roman numerals in frontmatter header

2024-06-29 Thread Henning Hraban Ramm

Am 29.06.24 um 11:33 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 29.06.2024 um 10:10:

Am 29.06.24 um 06:49 schrieb jbf:
But if I change to \setuppagenumbering[location= ], and choose, for 
example:


\setupheadertexts

    [ ]    [{\getmarking[chapter]\hskip1em \pagenumber}]

    [{\pagenumber \hskip1em 
\documentvariable{metadata:title}}]    [ ]


I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I 
still get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?


Try \convertnumber{R}{\pagenumber}


Just use \userpagenumber.


Right, another detail missing in my book and apparently in the wiki.

I already marked sooo many emails to process the interesting code in 
them, at least this is easy.


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: No roman numerals in frontmatter header

2024-06-29 Thread jbf
Thank you very much for this. After you mentioned \userpagenumber I was 
able to discover its (single) mention in 
https://wiki.contextgarden.net/Headers_and_Footers. But perhaps in any 
reorganisation of the wiki, this could be more clearly indicated as 
applying more specifically to the need to get roman numerals in 
\setupheadertexts situations, as my own case demonstrates.


Grateful as always,

Julian

On 29/6/24 19:33, Wolfgang Schuster wrote:

Henning Hraban Ramm schrieb am 29.06.2024 um 10:10:

Am 29.06.24 um 06:49 schrieb jbf:
But if I change to \setuppagenumbering[location= ], and choose, for 
example:


\setupheadertexts

    [ ]    [{\getmarking[chapter]\hskip1em \pagenumber}]

    [{\pagenumber \hskip1em 
\documentvariable{metadata:title}}]    [ ]


I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I 
still get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?


Try \convertnumber{R}{\pagenumber}


Just use \userpagenumber.

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: No roman numerals in frontmatter header

2024-06-29 Thread jbf
Thanks for this... though the later indication from Wolfgang is clearly 
the easiest.


On 29/6/24 18:10, Henning Hraban Ramm wrote:

Am 29.06.24 um 06:49 schrieb jbf:
But if I change to \setuppagenumbering[location= ], and choose, for 
example:


\setupheadertexts

    [ ]    [{\getmarking[chapter]\hskip1em \pagenumber}]

    [{\pagenumber \hskip1em 
\documentvariable{metadata:title}}]    [ ]


I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I 
still get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?


Try \convertnumber{R}{\pagenumber}

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
___ 


___
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: No roman numerals in frontmatter header

2024-06-29 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 29.06.2024 um 10:10:

Am 29.06.24 um 06:49 schrieb jbf:
But if I change to \setuppagenumbering[location= ], and choose, for 
example:


\setupheadertexts

    [ ]    [{\getmarking[chapter]\hskip1em \pagenumber}]

    [{\pagenumber \hskip1em 
\documentvariable{metadata:title}}]    [ ]


I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I 
still get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?


Try \convertnumber{R}{\pagenumber}


Just use \userpagenumber.

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: No roman numerals in frontmatter header

2024-06-29 Thread Henning Hraban Ramm

Am 29.06.24 um 06:49 schrieb jbf:

But if I change to \setuppagenumbering[location= ], and choose, for example:

\setupheadertexts

[ ][{\getmarking[chapter]\hskip1em \pagenumber}]

[{\pagenumber \hskip1em \documentvariable{metadata:title}}][ ]

I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I still 
get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?


Try \convertnumber{R}{\pagenumber}

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] No roman numerals in frontmatter header

2024-06-28 Thread jbf

Perhaps someone can advise me where I am going wrong.

I have no trouble getting roman numeral page numbers in the footer text 
in frontmatter with


\startsectionblockenvironment [frontpart]

\setupuserpagenumber [numberconversion=romannumerals]

  \setcounter [userpage] [5]

\stopsectionblockenvironment

\startsectionblockenvironment [bodypart]

  \setcounter [userpage] [1]

\stopsectionblockenvironment

\setuppagenumbering

  [alternative=doublesided,location={footer,middle}]

But if I change to \setuppagenumbering[location= ], and choose, for example:

\setupheadertexts

   [ ][{\getmarking[chapter]\hskip1em \pagenumber}]

   [{\pagenumber \hskip1em \documentvariable{metadata:title}}][ ]

I get my header texts with page numbers in arabic numerals in 
frontmatter. I have tried various \setupheadertexts options, but I still 
get arabic numerals in frontmatter. The conversion does not work.


What am I missing or doing wrong?

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: weekend update

2024-06-24 Thread Gerion Entrup
Am Sonntag, 23. Juni 2024, 15:28:37 MESZ schrieb Hans Hagen:
> On 6/23/2024 2:35 PM, Gerion Entrup wrote:
> > Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> >> -- support for stacking at the tex end (maybe for presentations)
> >>
> >> \starttext
> >>
> >> \definestacking[one]
> >> \definestacking[two]
> >>
> >> \startbuffer
> >> This is a test \stacking [one] {and a proof} of \stacking [two]
> >> {concept} indeed
> >> \stacking [one] {\blackrule [width=4cm]} is it and the question is how
> >> \stacking
> >> [two] {\scale [s=2] {fancy}} we can go
> >>
> >> \startstacking[one]
> >> \startformula
> >>   \sqrt{1+x}
> >> \stopformula
> >> \stopstacking
> >>
> >> and how useful \stacking[two]{\inframed{it}} is.
> >> \stopbuffer
> >>
> >> \startstackingsteps[one,two,{one,two}]
> >>   \startTEXpage[offset=1ts]
> >>   \getbuffer
> >>   \stopTEXpage
> >> \stopstackingsteps
> >>
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer
> >> \stopTEXpage
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer
> >> \stopTEXpage
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer
> >> \stopTEXpage
> >>
> >> \stoptext
> > 
> > Very nice, thank you!
> > 
> > I see some similarities to the "visible on" technique [1], I posted in a 
> > previous thread.
> 
> You mean the horrible transparency hack there?

Sure, exactly that :)

> > What comes there really handy are range specifiers, what seems not possible 
> > with this interface.
> > For example: "visible on=<2->" renders the content on every page except the 
> > first one
> > or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
> > page 13 to 15.
> > 
> > The mechanism stems from the Beamer overlay specifications, see section 9.3 
> > of the manual [2]
> > and can be much more complicated with modes (section 9.6.2).
> 
> I don't know beamer other than seeing presentations at meetings but I 
> assume that it has some accumulator. We do have steppers in mkii / mkiv 
> already in the presentation styles. The conceptual cleanest of them 
> depends on the viewer and free ones never catched up so that one is 
> acrobat specific. The stacker discussed now is just similar to the 
> metapost one but then at the tex end. (A quick hack with room for more a 
> bit more effiency if ther ei sneed for it.)
> 
> > To add this to the new interface, if you want that, the stack layers above 
> > need some kind of order,
> > which is implicit for numbers:
> > ```
> > \definestacking{one}
> > \definestacking{two}
> > \definestacking{three}
> > \definestackingorder{one,two, three}
> > ...
> > \setupstacking[criterium={one-three}]
> > ```
> > The order could also be implicitly defined after the order of the 
> > \definestacking calls.
> > 
> > Or would it be possible to have numbers always automatically (additionally) 
> > available as stacking layer?
> > So that this "just" works:
> > ```
> > \startbuffer
> > This is a test \stacking [1] {and a proof} of \stacking [2] {concept} 
> > indeed.
> > \stopbuffer
> > ...
> > \setupstacking[criterium={1-}]
> > ```
> > 
> > I also wondered, if it is possible to define a lot of layers 
> > semiautomatically in Lua
> > (in some graphics I needed around 20 layers). It seems that numbers in 
> > layer names currently are not allowed.
> > Is code like this possible somehow?
> > 
> > ```
> > \startluacode
> > for i = 1, 20 do
> >  context.definestacking(string.format("l\letterpercent.d", i))
> > end
> > \stopluacode
> > ```
> 
> The next version already will have this:
> 
> %D For Aditya Mahajan: ranges and such.
> %D
> %D \starttyping
> %D \starttext
> %D \startstackingsteps[1,{1:2,201},{1:3,301},{1,2,4},{1-5},{1-6},{1-7}]
> %D \startTEXpage
> %D \startstacking[1]   \framed{ONE}\stopstacking
> %D \startstacking[2]   \framed{TWO}\stopstacking
> %D \startstacking[201] \framed{MORE}   \stopstacking
> %D \startstacking[3]   \framed{THREE}  \stopstacking
> %D \startstacking[301] \framed{INDEED} \stopstacking
> %D   

[NTG-context] Re: weekend update

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

On 6/23/2024 2:35 PM, Gerion Entrup wrote:

Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:

-- support for stacking at the tex end (maybe for presentations)

\starttext

\definestacking[one]
\definestacking[two]

\startbuffer
This is a test \stacking [one] {and a proof} of \stacking [two]
{concept} indeed
\stacking [one] {\blackrule [width=4cm]} is it and the question is how
\stacking
[two] {\scale [s=2] {fancy}} we can go

\startstacking[one]
\startformula
  \sqrt{1+x}
\stopformula
\stopstacking

and how useful \stacking[two]{\inframed{it}} is.
\stopbuffer

\startstackingsteps[one,two,{one,two}]
  \startTEXpage[offset=1ts]
  \getbuffer
  \stopTEXpage
\stopstackingsteps

\startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer
\stopTEXpage
\startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer
\stopTEXpage
\startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer
\stopTEXpage

\stoptext


Very nice, thank you!

I see some similarities to the "visible on" technique [1], I posted in a 
previous thread.


You mean the horrible transparency hack there?


What comes there really handy are range specifiers, what seems not possible 
with this interface.
For example: "visible on=<2->" renders the content on every page except the 
first one
or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
page 13 to 15.

The mechanism stems from the Beamer overlay specifications, see section 9.3 of 
the manual [2]
and can be much more complicated with modes (section 9.6.2).


I don't know beamer other than seeing presentations at meetings but I 
assume that it has some accumulator. We do have steppers in mkii / mkiv 
already in the presentation styles. The conceptual cleanest of them 
depends on the viewer and free ones never catched up so that one is 
acrobat specific. The stacker discussed now is just similar to the 
metapost one but then at the tex end. (A quick hack with room for more a 
bit more effiency if ther ei sneed for it.)



To add this to the new interface, if you want that, the stack layers above need 
some kind of order,
which is implicit for numbers:
```
\definestacking{one}
\definestacking{two}
\definestacking{three}
\definestackingorder{one,two, three}
...
\setupstacking[criterium={one-three}]
```
The order could also be implicitly defined after the order of the 
\definestacking calls.

Or would it be possible to have numbers always automatically (additionally) 
available as stacking layer?
So that this "just" works:
```
\startbuffer
This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
\stopbuffer
...
\setupstacking[criterium={1-}]
```

I also wondered, if it is possible to define a lot of layers semiautomatically 
in Lua
(in some graphics I needed around 20 layers). It seems that numbers in layer 
names currently are not allowed.
Is code like this possible somehow?

```
\startluacode
for i = 1, 20 do
 context.definestacking(string.format("l\letterpercent.d", i))
end
\stopluacode
```


The next version already will have this:

%D For Aditya Mahajan: ranges and such.
%D
%D \starttyping
%D \starttext
%D \startstackingsteps[1,{1:2,201},{1:3,301},{1,2,4},{1-5},{1-6},{1-7}]
%D \startTEXpage
%D \startstacking[1]   \framed{ONE}\stopstacking
%D \startstacking[2]   \framed{TWO}\stopstacking
%D \startstacking[201] \framed{MORE}   \stopstacking
%D \startstacking[3]   \framed{THREE}  \stopstacking
%D \startstacking[301] \framed{INDEED} \stopstacking
%D \startstacking[4]   \framed{FOUR}   \stopstacking
%D \startstacking[5]   \framed{\im {\sqrt {
%D  \stacking[6] { 1 + x ^ {
%D  \stacking[7] { 2 } } } } }}
%D \stopstacking
%D \stopTEXpage
%D \stopstackingsteps
%D \stoptext
%D \stoptyping

The range interface is not different from the one we use in other places 
so it was a braindead patch. Numeric stacking id's don't need to be 
allocated. The example shows that it is rather general applicable 
although there are some border cases (that if needed we can intercept 
but I assume sane usage).


No upload yet unless there is a hurry.

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 

[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
Am Sonntag, 23. Juni 2024, 14:35:13 MESZ schrieb Gerion Entrup:
> Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> > -- support for stacking at the tex end (maybe for presentations)
> > 
> > \starttext
> > 
> > \definestacking[one]
> > \definestacking[two]
> > 
> > \startbuffer
> > This is a test \stacking [one] {and a proof} of \stacking [two] 
> > {concept} indeed
> > \stacking [one] {\blackrule [width=4cm]} is it and the question is how 
> > \stacking
> > [two] {\scale [s=2] {fancy}} we can go
> > 
> > \startstacking[one]
> > \startformula
> >  \sqrt{1+x}
> > \stopformula
> > \stopstacking
> > 
> > and how useful \stacking[two]{\inframed{it}} is.
> > \stopbuffer
> > 
> > \startstackingsteps[one,two,{one,two}]
> >  \startTEXpage[offset=1ts]
> >  \getbuffer
> >  \stopTEXpage
> > \stopstackingsteps
> > 
> > \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer 
> > \stopTEXpage
> > \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer 
> > \stopTEXpage
> > \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer 
> > \stopTEXpage
> > 
> > \stoptext
> 
> Very nice, thank you!
> 
> I see some similarities to the "visible on" technique [1], I posted in a 
> previous thread.
> What comes there really handy are range specifiers, what seems not possible 
> with this interface.
> For example: "visible on=<2->" renders the content on every page except the 
> first one
> or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
> page 13 to 15.
> 
> The mechanism stems from the Beamer overlay specifications, see section 9.3 
> of the manual [2]
> and can be much more complicated with modes (section 9.6.2).
> 
> To add this to the new interface, if you want that, the stack layers above 
> need some kind of order,
> which is implicit for numbers:
> ```
> \definestacking{one}
> \definestacking{two}
> \definestacking{three}
> \definestackingorder{one,two, three}
> ...
> \setupstacking[criterium={one-three}]
> ```
> The order could also be implicitly defined after the order of the 
> \definestacking calls.
> 
> Or would it be possible to have numbers always automatically (additionally) 
> available as stacking layer?
> So that this "just" works:
> ```
> \startbuffer
> This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
> \stopbuffer
> ...
> \setupstacking[criterium={1-}]
> ```
> 
> I also wondered, if it is possible to define a lot of layers 
> semiautomatically in Lua
> (in some graphics I needed around 20 layers). It seems that numbers in layer 
> names currently are not allowed.
> Is code like this possible somehow?
> 
> ```
> \startluacode
> for i = 1, 20 do
> context.definestacking(string.format("l\letterpercent.d", i))
> end
> \stopluacode
> ```
> 
> Gerion
> 
> 
> [1] 
> https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
> [2] https://ctan.org/pkg/beamer
> 

I need to correct myself (I had a typo in my tests before). Numbers as stacking 
layer names are possible.
This Lua code works fine:

```
\startluacode
   for i = 1, 20 do
   context("\\definestacking[l\letterpercent.d]", i)
   end
\stopluacode
```

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: weekend update

2024-06-23 Thread Gerion Entrup
Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> -- support for stacking at the tex end (maybe for presentations)
> 
> \starttext
> 
> \definestacking[one]
> \definestacking[two]
> 
> \startbuffer
> This is a test \stacking [one] {and a proof} of \stacking [two] 
> {concept} indeed
> \stacking [one] {\blackrule [width=4cm]} is it and the question is how 
> \stacking
> [two] {\scale [s=2] {fancy}} we can go
> 
> \startstacking[one]
> \startformula
>  \sqrt{1+x}
> \stopformula
> \stopstacking
> 
> and how useful \stacking[two]{\inframed{it}} is.
> \stopbuffer
> 
> \startstackingsteps[one,two,{one,two}]
>  \startTEXpage[offset=1ts]
>  \getbuffer
>  \stopTEXpage
> \stopstackingsteps
> 
> \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer 
> \stopTEXpage
> \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer 
> \stopTEXpage
> \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer 
> \stopTEXpage
> 
> \stoptext

Very nice, thank you!

I see some similarities to the "visible on" technique [1], I posted in a 
previous thread.
What comes there really handy are range specifiers, what seems not possible 
with this interface.
For example: "visible on=<2->" renders the content on every page except the 
first one
or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
page 13 to 15.

The mechanism stems from the Beamer overlay specifications, see section 9.3 of 
the manual [2]
and can be much more complicated with modes (section 9.6.2).

To add this to the new interface, if you want that, the stack layers above need 
some kind of order,
which is implicit for numbers:
```
\definestacking{one}
\definestacking{two}
\definestacking{three}
\definestackingorder{one,two, three}
...
\setupstacking[criterium={one-three}]
```
The order could also be implicitly defined after the order of the 
\definestacking calls.

Or would it be possible to have numbers always automatically (additionally) 
available as stacking layer?
So that this "just" works:
```
\startbuffer
This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
\stopbuffer
...
\setupstacking[criterium={1-}]
```

I also wondered, if it is possible to define a lot of layers semiautomatically 
in Lua
(in some graphics I needed around 20 layers). It seems that numbers in layer 
names currently are not allowed.
Is code like this possible somehow?

```
\startluacode
for i = 1, 20 do
context.definestacking(string.format("l\letterpercent.d", i))
end
\stopluacode
```

Gerion


[1] 
https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
[2] https://ctan.org/pkg/beamer


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: line numbering respecting original lines

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

On 6/17/2024 6:46 PM, Henning Hraban Ramm wrote:

Am 17.06.24 um 18:16 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line 
breaking, I need line numbering to adhere to that, even if some lines 
are too long and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 
and 4.


Same problem with source code examples, i.e. \starttyping with 
numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.



\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop


Thank you – that works for the minimal example, but the options for 
paragraph numbering are very limited, I can’t even use my own command.

And I can’t combine it with \starttyping.


\def\CodeNumber#1{\hfill\tt\bfx\color[orange]{#1}}

% ok
\setuplinenumbering[
   command=\CodeNumber,
   width=3em,]

% invalid
\setupparagraphnumbering[
   command=\CodeNumber,
   width=3em,]

\starttext

\setuplines[keeptogether=paragraph]

\setupparagraphnumbering[width=3em]

\setuplinenumbering[distance=1em,align=flushright]

\setupparagraphnumbering[state=start,color=red,style=bold]
\startlinenumbering
\startlines
\input tufte
\stoplines
\stoplinenumbering

\stoptext

the keeptogether option is also available for typing and it listens to 
widow and club penalties


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: line numbering respecting original lines

2024-06-17 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 17.06.2024 um 19:30:

Am 17.06.24 um 19:07 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 18:46:

Am 17.06.24 um 18:16 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line 
breaking, I need line numbering to adhere to that, even if some 
lines are too long and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 
3 and 4.


Same problem with source code examples, i.e. \starttyping with 
numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) 
would address that, but apparently not.



\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop


Thank you – that works for the minimal example, but the options for 
paragraph numbering are very limited, I can’t even use my own command.

And I can’t combine it with \starttyping.


\def\CodeNumber#1{\hfill\tt\bfx\color[orange]{#1}}

% ok
\setuplinenumbering[
   command=\CodeNumber,
   width=3em,]

% invalid
\setupparagraphnumbering[
   command=\CodeNumber,
   width=3em,]


You can use the style and color keys

   \setupparagraphnumbering[state=start,style=\tt\bfx,color=orange]


but the location of the number in the left margin is fixed.


Yes, I’m just documenting line and paragraph numbering, and I wonder 
why the latter is so limited – is it just too old to use the usual 
parameters, or is it so much more complicated internally?


Maybe Hans (or somebody) needed this for a single document and the 
current version was enough at the time.


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: line numbering respecting original lines

2024-06-17 Thread Henning Hraban Ramm

Am 17.06.24 um 19:07 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 18:46:

Am 17.06.24 um 18:16 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line 
breaking, I need line numbering to adhere to that, even if some 
lines are too long and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 
and 4.


Same problem with source code examples, i.e. \starttyping with 
numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.



\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop


Thank you – that works for the minimal example, but the options for 
paragraph numbering are very limited, I can’t even use my own command.

And I can’t combine it with \starttyping.


\def\CodeNumber#1{\hfill\tt\bfx\color[orange]{#1}}

% ok
\setuplinenumbering[
   command=\CodeNumber,
   width=3em,]

% invalid
\setupparagraphnumbering[
   command=\CodeNumber,
   width=3em,]


You can use the style and color keys

   \setupparagraphnumbering[state=start,style=\tt\bfx,color=orange]


but the location of the number in the left margin is fixed.


Yes, I’m just documenting line and paragraph numbering, and I wonder why 
the latter is so limited – is it just too old to use the usual 
parameters, or is it so much more complicated internally?


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: line numbering respecting original lines

2024-06-17 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 17.06.2024 um 18:46:

Am 17.06.24 um 18:16 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line 
breaking, I need line numbering to adhere to that, even if some lines 
are too long and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 
and 4.


Same problem with source code examples, i.e. \starttyping with 
numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.



\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop


Thank you – that works for the minimal example, but the options for 
paragraph numbering are very limited, I can’t even use my own command.

And I can’t combine it with \starttyping.


\def\CodeNumber#1{\hfill\tt\bfx\color[orange]{#1}}

% ok
\setuplinenumbering[
   command=\CodeNumber,
   width=3em,]

% invalid
\setupparagraphnumbering[
   command=\CodeNumber,
   width=3em,]


You can use the style and color keys

  \setupparagraphnumbering[state=start,style=\tt\bfx,color=orange]


but the location of the number in the left margin is fixed.

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: line numbering respecting original lines

2024-06-17 Thread Henning Hraban Ramm

Am 17.06.24 um 18:16 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line 
breaking, I need line numbering to adhere to that, even if some lines 
are too long and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 
and 4.


Same problem with source code examples, i.e. \starttyping with numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.



\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop


Thank you – that works for the minimal example, but the options for 
paragraph numbering are very limited, I can’t even use my own command.

And I can’t combine it with \starttyping.


\def\CodeNumber#1{\hfill\tt\bfx\color[orange]{#1}}

% ok
\setuplinenumbering[
  command=\CodeNumber,
  width=3em,]

% invalid
\setupparagraphnumbering[
  command=\CodeNumber,
  width=3em,]


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: line numbering respecting original lines

2024-06-17 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 17.06.2024 um 14:03:
When discussing verses or other texts that have distinct line breaking, 
I need line numbering to adhere to that, even if some lines are too long 
and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 and 4.

Same problem with source code examples, i.e. \starttyping with numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.


Hraban



\mainlanguage[de]
\setuppapersize[A7,landscape]
\setuplayout[topspace=0mm,bottom=0mm,width=90mm,height=70mm]
\setuppagenumbering[location=none,state=stop]
%\setuplinenumbering[method=file]
\starttext

\startlinenumbering
\startlines
Und doch, wie viel wahnsinniger, einen Freund,
weil ers in einer Kleinigkeit versah,
die nur ein Mensch, mit dem gar nicht zu leben ist,
ihm nicht verzeihen konnte, gleich dafür
zu hassen und zu fliehen, wie den Ruso …
\stoplines
\stoplinenumbering
% aus: C. M. Wieland, Horazens Satiren. Weimar 1786 (2. Aufl. 1804)
\stoptext


\start \setupparagraphnumbering[state=start]
\startlines
...
\stoplines
\stop

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] line numbering respecting original lines

2024-06-17 Thread Henning Hraban Ramm
When discussing verses or other texts that have distinct line breaking, 
I need line numbering to adhere to that, even if some lines are too long 
and need breaking. Is that possible?


In my example below the 3rd line is too long and gets line numbers 3 and 4.

Same problem with source code examples, i.e. \starttyping with numbering.
I thought numbering=file (or \setuplinenumbering[method=file]) would 
address that, but apparently not.


Hraban



\mainlanguage[de]
\setuppapersize[A7,landscape]
\setuplayout[topspace=0mm,bottom=0mm,width=90mm,height=70mm]
\setuppagenumbering[location=none,state=stop]
%\setuplinenumbering[method=file]
\starttext

\startlinenumbering
\startlines
Und doch, wie viel wahnsinniger, einen Freund,
weil ers in einer Kleinigkeit versah,
die nur ein Mensch, mit dem gar nicht zu leben ist,
ihm nicht verzeihen konnte, gleich dafür
zu hassen und zu fliehen, wie den Ruso …
\stoplines
\stoplinenumbering
% aus: C. M. Wieland, Horazens Satiren. Weimar 1786 (2. Aufl. 1804)
\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: Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread ai2472206007
I must have made a mistake with something, I changed a counter and it somehow 
worked properly. Because I've designed too many counters, I still haven't 
figured out exactly what the problem is doing. But admittedly, the question I 
asked is non-existent. It's a problem with my design.
___
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: Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread ai2472206007
Thank you. I will try again.
___
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: Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread ai2472206007
Thanks, probably interfered with his output in other parts of my command. I 
didn't locate the error correctly.
___
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: Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread Wolfgang Schuster

ai2472206...@yeah.net schrieb am 29.05.2024 um 14:05:

I'm defining a command to generate options for multiple choice questions,
but at the moment I'm stuck at this step.
I want to get a number and assign a value to the counter, but why can't I get 
it?


\starttext
\definedataset [myset]
\setdataset[myset] [foo=1,boo=4]
\newcount\tempa
\datasetvariable{myset}{1}{boo} % definitely get 4
%\tempa=\datasetvariable{myset}{1}{boo} % why i cannt pass 4 to tempa?
%\number\tempa
\stoptext
%

If anyone can fix it, thanka very much


You have to add a check to ensure there is a value stored in the 
aux-file before you pass the value to the counter. This is necessary 
because when you process the document for the first time Context only 
saves the value and can access it only in the next run after.


 begin example
\definedataset [myset]

\starttext

\setdataset [myset] [foo=1,boo=4]

\doifelsesomething{\datasetvariable{myset}{1}{boo}}
  {\scratchcounter\datasetvariable{myset}{1}{boo}}
  {\scratchcounter\zerocount}

boo = \number\scratchcounter

\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: Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread Taco Hoekwater



> On 29 May 2024, at 14:05, ai2472206...@yeah.net wrote:
> 
> I'm defining a command to generate options for multiple choice questions, 
> but at the moment I'm stuck at this step. 
> I want to get a number and assign a value to the counter, but why can't I get 
> it?
> 
> 
> \starttext
> \definedataset [myset]
> \setdataset[myset] [foo=1,boo=4]
> \newcount\tempa
> \datasetvariable{myset}{1}{boo} % definitely get 4
> %\tempa=\datasetvariable{myset}{1}{boo} % why i cannt pass 4 to tempa?
> %\number\tempa
> \stoptext

Works for me (minus comment signs of course):

 ConTeXt  ver: 2024.03.11 09:34 LMTX

Best wishes,
Taco


___
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] Numbers obtained by commands <\datasetvariable> cannot be copied to counters

2024-05-29 Thread ai2472206007
I'm defining a command to generate options for multiple choice questions, 
but at the moment I'm stuck at this step. 
I want to get a number and assign a value to the counter, but why can't I get 
it?


\starttext
\definedataset [myset]
\setdataset[myset] [foo=1,boo=4]
\newcount\tempa
\datasetvariable{myset}{1}{boo} % definitely get 4
%\tempa=\datasetvariable{myset}{1}{boo} % why i cannt pass 4 to tempa?
%\number\tempa
\stoptext
%

If anyone can fix it, thanka very much

Muyik
___
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: Number in a circle

2024-05-28 Thread Kip Warner
On Tue, 2024-05-28 at 15:02 -0700, Kip Warner wrote:
> On Tue, 2024-05-28 at 17:38 +0200, Wolfgang Schuster wrote:
> > Add
> > 
> >  framecolor=colour_text,
> > 
> > to the frame settings.
> 
> Thanks Wolfgang. That does work.
> 
> But another problem I've found is the font and circle are not
> automatically resized when used in a formula:
> 
>    \definecolor[colour_text][r=0.754,g=0.516,b=0.324] % RGB 0xc08453
>    
>    \setupcolors[
>    state=start,
>    textcolor=colour_text,
>    pagecolormodel=rgb] % gray rgb cmyk auto none
>    
>    % Commands for MetaPost interpreter to draw a circle...
>    \startuseMPgraphic{textcircle}
>     draw fullcircle
>     xscaled OverlayWidth
>     yscaled OverlayWidth
>     withcolor OverlayLineColor;
>    \stopuseMPgraphic
>    
>    % Define an overlay using the above image...
>    \defineoverlay[textcircle][\useMPgraphic{textcircle}]
>    
>    % Define a frame we can use via \textcircled{X} that uses as its
>    background
>    %  the above overlay...
>    \defineframed
>   [textcircled]
>   [width=1.4em,
>    height=1.4em,
>    frame=off,
>    background=textcircle,
>    framecolor=colour_text,
>    location=low,
>    offset=none]
>    
>    \starttext
>    Here are the numbers \textcircled{1}, \textcircled{2}, and
>    \textcircled{3}.
>    
>    And when used in formula, \math{\Sigma_{i^b
> x_{\textcircled{3}}^i}}
>    \stoptext
> 
> What I was hoping would happen there was the circled 3 in the formula
> would shrink to look like a subscript for the x variable. Any help
> appreciated.

Wolfgang, please don't tax yourself further on this. I've managed to
find another way of expressing the same ideas in my publication without
having to resort to the above magic. Thanks again.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


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: Number in a circle

2024-05-28 Thread Kip Warner
On Tue, 2024-05-28 at 17:38 +0200, Wolfgang Schuster wrote:
> Add
> 
>  framecolor=colour_text,
> 
> to the frame settings.

Thanks Wolfgang. That does work.

But another problem I've found is the font and circle are not
automatically resized when used in a formula:

   \definecolor[colour_text][r=0.754,g=0.516,b=0.324] % RGB 0xc08453
   
   \setupcolors[
   state=start,
   textcolor=colour_text,
   pagecolormodel=rgb] % gray rgb cmyk auto none
   
   % Commands for MetaPost interpreter to draw a circle...
   \startuseMPgraphic{textcircle}
draw fullcircle
xscaled OverlayWidth
yscaled OverlayWidth
withcolor OverlayLineColor;
   \stopuseMPgraphic
   
   % Define an overlay using the above image...
   \defineoverlay[textcircle][\useMPgraphic{textcircle}]
   
   % Define a frame we can use via \textcircled{X} that uses as its
   background
   %  the above overlay...
   \defineframed
  [textcircled]
  [width=1.4em,
   height=1.4em,
   frame=off,
   background=textcircle,
   framecolor=colour_text,
   location=low,
   offset=none]
   
   \starttext
   Here are the numbers \textcircled{1}, \textcircled{2}, and
   \textcircled{3}.
   
   And when used in formula, \math{\Sigma_{i^b x_{\textcircled{3}}^i}}
   \stoptext

What I was hoping would happen there was the circled 3 in the formula
would shrink to look like a subscript for the x variable. Any help
appreciated.

-- 
Kip Warner
OpenPGP signed/encrypted mail preferred
https://www.thevertigo.com


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: LUA API for page numbers

2024-05-21 Thread Luc Chabassier
Excerpts from Wolfgang Schuster's message of May 21, 2024 3:54 pm:
> Luc Chabassier schrieb am 21.05.2024 um 15:35:
>> Excerpts from Hans Hagen's message of May 21, 2024 11:45 am:
>>> concerning notes in the margin ... did you try the built in magin text
>>> mechanisms?
>> I did, but as far as I know they place the text on the margin next to
>> the \inmargin invocation in the text, so they may overlap, which is what
>> I want to avoid.
> 
> \setupmarginblocks[inbetween=]
> 
> \starttext
> 
> \dorecurse{100}
>{\bold{#1:} \samplefile{ward}%
> \startmarginblock Note #1\stopmarginblock
> \par}
> 
> \stoptext
I did not know about margin blocks, they are nice. But is there a way to
place them next to the \startmarginblock invocation, instead of flushing
them all either to the top or bottom of the page ?
___
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: LUA API for page numbers

2024-05-21 Thread Wolfgang Schuster

vm via ntg-context schrieb am 21.05.2024 um 16:07:



On 21/05/2024 15:54, Wolfgang Schuster wrote:

\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
   {\bold{#1:} \samplefile{ward}%
    \startmarginblock Note #1\stopmarginblock
    \par}

\stoptext



when I compile this, i get per page with
\par 1..10 -> the notes 1..11
\par 11..20 -> the notes 12..21
\par 21..30 -> the notes 32..31

...

is this expected standard?

i'd expect \par and notes synced on page.
1..10 -> 1..10


TeX was still on page 1 to collect text when it put note 11 into the 
buffer for the margin and the decision to make the break after block 10 
happened afterwards.


You can control page breaks to a certain degree with the \testpage 
command between paragraphs.


\starttext

\dorecurse{100}
  {\testpage[3]
   \bold{#1:} \samplefile{ward}%
   \startmarginblock Note #1\stopmarginblock
   \par}

\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: LUA API for page numbers

2024-05-21 Thread vm via ntg-context
just noticed that if the notes need more margin space then are pages 
available by the text, they get lost. e.g. this mwe generates 10 pages 
with 100 par but only 80 notes will show up.



\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
  {\bold{#1:} \samplefile{ward}%
   \startmarginblock {\bf #1} one two three four five six seven eight 
nine ten eleven twelve thirteen\stopmarginblock

   \par}

\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: LUA API for page numbers

2024-05-21 Thread vm via ntg-context



On 21/05/2024 15:54, Wolfgang Schuster wrote:

\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
   {\bold{#1:} \samplefile{ward}%
    \startmarginblock Note #1\stopmarginblock
    \par}

\stoptext



when I compile this, i get per page with
\par 1..10 -> the notes 1..11
\par 11..20 -> the notes 12..21
\par 21..30 -> the notes 32..31

...

is this expected standard?

i'd expect \par and notes synced on page.
1..10 -> 1..10



___
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: LUA API for page numbers

2024-05-21 Thread Wolfgang Schuster

Luc Chabassier schrieb am 21.05.2024 um 15:35:

Excerpts from Hans Hagen's message of May 21, 2024 11:45 am:

you have to provide some mwe so that we can see what is intended; in
principle much info is available one way or the other

I joined a minimal working example. The lua function
`userdata.sidenotes_save_run` places the notes so that they do not
intersect (the method I actually use is more complicated, but the idea
is the same).


concerning notes in the margin ... did you try the built in magin text
mechanisms?

I did, but as far as I know they place the text on the margin next to
the \inmargin invocation in the text, so they may overlap, which is what
I want to avoid.


\setupmarginblocks[inbetween=]

\starttext

\dorecurse{100}
  {\bold{#1:} \samplefile{ward}%
   \startmarginblock Note #1\stopmarginblock
   \par}

\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: LUA API for page numbers

2024-05-21 Thread Hans Hagen

On 5/21/2024 10:26 AM, Luc Chabassier wrote:

Hi everyone,

I have recently migrated my PhD dissertation from LaTeX to ConTeXt. In
LaTeX I was using kaobook, a template with lots of margin notes, but I
was frustrated with the automatic placement of the notes.

I implemented a system using overlays that automatically places the
notes using lua. To know where the ideal placement should be (if they do
not interact with each other), I use lua to insert a latelua whatsit
that uses lpdf.getpos() to get the coordinate on the rendered page.
However, I haven't found a way to get the page number using lua, and the
tex macro \pagenumber is unreliable near pagebreaks.

Furthermore, it would be helpful to know if there is a way to access the
position and sizes of figures at the end.
you have to provide some mwe so that we can see what is intended; in 
principle much info is available one way or the other


concerning notes in the margin ... did you try the built in magin text 
mechanisms?


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] LUA API for page numbers

2024-05-21 Thread Luc Chabassier
Hi everyone,

I have recently migrated my PhD dissertation from LaTeX to ConTeXt. In
LaTeX I was using kaobook, a template with lots of margin notes, but I
was frustrated with the automatic placement of the notes.

I implemented a system using overlays that automatically places the
notes using lua. To know where the ideal placement should be (if they do
not interact with each other), I use lua to insert a latelua whatsit
that uses lpdf.getpos() to get the coordinate on the rendered page.
However, I haven't found a way to get the page number using lua, and the
tex macro \pagenumber is unreliable near pagebreaks.

Furthermore, it would be helpful to know if there is a way to access the
position and sizes of figures at the end.

Thanks,
Luc

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost limitation ?

2024-05-12 Thread Fabrice Couvreur
Sorry for the comment !
I use Evince

Le dim. 12 mai 2024 à 17:30, Hans Hagen  a écrit :

> On 5/12/2024 3:57 PM, Fabrice Couvreur wrote:
> > Hi,
> > When I want to draw the curve which corresponds to n=60 (blue curve), it
> > doesn't seem possible: I don't understand.
> > Thanks
> > Fabrice
> >
> >   \startMPpage[offset=1DK]
> >
> >numeric u;
> >u = 6cm;
> >
> >interim linejoin := mitered;
> >interim ahangle := 30;
> >
> >path xx, yy;
> >xx = ( (-0.3,0) -- 1.4 right) scaled u;
> >yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;
> >
> >def compute_curve(suffix f)(expr xmin, xmax, xinc) =
> >((xmin,f(xmin))
> >for x=xmin+xinc step xinc until xmax:
> > .. (x,f(x))
> >endfor)
> >enddef;
> >
> >
> >for i = 1 upto 4:
> >
> >vardef f(expr x) =x+exp(-i*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >endfor;
> >
> >vardef f(expr x) =x+exp(-6*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >vardef f(expr x) =x+exp(-15*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;
> >
> >draw curve;
> >
> >
> >vardef f(expr x) =x+exp(-60*x) enddef;
> >
> >path curve;
> >
> >curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; ->>>>> not
> > drawn
>
> best put a comment before the ->>>>>>>
>
> >draw curve withcolor blue;
> >
> >
> >drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
> >drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;
> >
> >
> >label.urt("A",(0,1u));
> >
> >draw xx;
> >draw  yy;
> >
> >draw (1u,0) -- (1u,1.8u);
> >
> >
> >label.llft("0",(0,0));
> >
> > vardef mark_y_axis(expr value, name) =
> >  save p; pair p; p = value * u * up;
> >  draw (left--right) scaled 1 shifted p;
> >  label.lft(name, p shifted 2 left);
> >enddef;
> >
> >for a = 1 upto 1:
> >  mark_y_axis(a, "");
> >endfor
> >
> > mark_y_axis(1, "$1$");
> >
> >
> >   vardef mark_x_axis(expr value, name) =
> > save p; pair p; p = value * u * right;
> > draw (up--down) scaled 1 shifted p;
> > label.bot(name, p shifted 2 down);
> >   enddef;
> >
> >   for a = 1 upto 1:
> > mark_x_axis(a, "");
> >   endfor
> >
> >   mark_x_axis(1, "$1$");
> >
> >
> >path rectangle;
> >rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) --
> > (1.3u,1.4u) -- (-0.3u,1.4u)--cycle;
> >
> >clip currentpicture to rectangle;
> >   \stopMPpage
> >
> your exp usage:
>
>exp(-60*-0.4)
>
> if you see what huge numbers come out of that, like
>
> -51.006602 11100558579.857309 l
> -50.989594 11034154639.123087 l
> -50.972586 10968147929.149401 l
> -50.955579 10902536073.687559 l
> -50.938571 10837316710.703716 l
>
> you could imagine a viewer crapping out on that because no matter what
> one clips it still is 'kind of drawn', so what viewer do you use?
>
> 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: Metapost limitation ?

2024-05-12 Thread Hans Hagen

On 5/12/2024 3:57 PM, Fabrice Couvreur wrote:

Hi,
When I want to draw the curve which corresponds to n=60 (blue curve), it 
doesn't seem possible: I don't understand.

Thanks
Fabrice

  \startMPpage[offset=1DK]

           numeric u;
           u = 6cm;

           interim linejoin := mitered;
           interim ahangle := 30;

           path xx, yy;
           xx = ( (-0.3,0) -- 1.4 right) scaled u;
           yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;

           def compute_curve(suffix f)(expr xmin, xmax, xinc) =
               ((xmin,f(xmin))
               for x=xmin+xinc step xinc until xmax:
                    .. (x,f(x))
               endfor)
           enddef;


           for i = 1 upto 4:

           vardef f(expr x) =x+exp(-i*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;

           endfor;

           vardef f(expr x) =x+exp(-6*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;

           vardef f(expr x) =x+exp(-15*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

           draw curve;


           vardef f(expr x) =x+exp(-60*x) enddef;

           path curve;

           curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; ->>>>> not 
drawn


best put a comment before the ->>>>>>>


           draw curve withcolor blue;


           drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
           drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;


           label.urt("A",(0,1u));

           draw xx;
           draw  yy;

           draw (1u,0) -- (1u,1.8u);


           label.llft("0",(0,0));

            vardef mark_y_axis(expr value, name) =
             save p; pair p; p = value * u * up;
             draw (left--right) scaled 1 shifted p;
             label.lft(name, p shifted 2 left);
           enddef;

           for a = 1 upto 1:
             mark_y_axis(a, "");
           endfor

            mark_y_axis(1, "$1$");


          vardef mark_x_axis(expr value, name) =
            save p; pair p; p = value * u * right;
            draw (up--down) scaled 1 shifted p;
            label.bot(name, p shifted 2 down);
          enddef;

          for a = 1 upto 1:
            mark_x_axis(a, "");
          endfor

          mark_x_axis(1, "$1$");


           path rectangle;
           rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) -- 
(1.3u,1.4u) -- (-0.3u,1.4u)--cycle;


           clip currentpicture to rectangle;
          \stopMPpage


your exp usage:

  exp(-60*-0.4)

if you see what huge numbers come out of that, like

-51.006602 11100558579.857309 l
-50.989594 11034154639.123087 l
-50.972586 10968147929.149401 l
-50.955579 10902536073.687559 l
-50.938571 10837316710.703716 l

you could imagine a viewer crapping out on that because no matter what 
one clips it still is 'kind of drawn', so what viewer do you use?


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] Is there a way to consolidate index reference numbers by book?

2024-05-10 Thread Joel via ntg-context
\useregister[workbookA][03_workbook][learnedlong][WB~1:~]
\useregister[workbookB][04_workbook][learnedlong][WB~2:~]
\useregister[workbookC][05_workbook][learnedlong][WB~3:~]
\useregister[workbookD][06_workbook][learnedlong][WB~4:~]




    \startchapter[title=Standards]                    
\placeregister[learnedlong,workbookA,workbookB,workbookC,workbookD]
        \stopchapter

I setup a custon index that lists items from four different workbooks. 

The problem is in the indexi, it displays entreis like this:
WHST.1.1: 11, 231, WB 1: 124, WB 1: 133, WB 2: 325, WB 2: 345, etc.
In other words, it says WB 1 in front of every page number from the first 
workbook.
Is there any way to consolidate the page numbers by book, e.g. output instead 
like this:
WHST.1.1: 11, 231, WB1: 124, 133, WB 2: 325, 345
In other words, it list all page numbers for Workbook 1 right after WB 1: 
instead of placing WB 1 in front of every single page from Workbook 1?
--Joel
___
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
ch, 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, publications.cite, publications.strings]
> > > > 
> > > > \usebtxdataset[main][testdata.buffer]
> > > > \usebtxdefinitions[aps]
> > > > \setupbtx[dataset=main]
> > > > \definebtxrendering[bibrendering][aps][dataset=main]
> > > > 
> > > > % this seems to have no effect?
> > > > \setupbtx[alternative=short]
> > > > 
> > > > \starttext
> > > > 
> > > > Knuth developed \TeX \cite[knuth1].
> > > > Several persons said something \cite[someother].
> > > > 
> > > > \placelistofpublications[bibrendering]
> > > > 
> > > > \stoptext
> > > > ```
> > > > 
> > > > It should be rendered as:
> > > > ```
> > > > Knuth developed TeX [>Knu79].
> > > > Several persons said something [PO00].
> > > > 
> > > > [Knu79] D.E. Knuth, TEX and METAFONT. New directions in
> > > > typesetting (Addi­son-Wesley, 1979). [PO00] S. Person and S.
> > > > Otherperson, Another title, (1900). ```
> > > > 
> > > > How can I achieve that \cite[something] always renders in the short
> > > > form by default? How can I customize that references to Knuth contain
> > > > this extra '>'? How can I customize the APS style to also use the
> > > > short form in the list of publications instead of numbers?
> > > > 
> > > > Best
> > > > Gerion
> > > > 
> > > > [1]
> > > > https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname
> 



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] 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
ons.cite, publications.strings]
> > > 
> > > \usebtxdataset[main][testdata.buffer]
> > > \usebtxdefinitions[aps]
> > > \setupbtx[dataset=main]
> > > \definebtxrendering[bibrendering][aps][dataset=main]
> > > 
> > > % this seems to have no effect?
> > > \setupbtx[alternative=short]
> > > 
> > > \starttext
> > > 
> > > Knuth developed \TeX \cite[knuth1].
> > > Several persons said something \cite[someother].
> > > 
> > > \placelistofpublications[bibrendering]
> > > 
> > > \stoptext
> > > ```
> > > 
> > > It should be rendered as:
> > > ```
> > > Knuth developed TeX [>Knu79].
> > > Several persons said something [PO00].
> > > 
> > > [Knu79]   D.E. Knuth, TEX and METAFONT. New directions in
> > > typesetting (Addi­son-Wesley, 1979). [PO00]   S. Person and S.
> > > Otherperson, Another title, (1900). ```
> > > 
> > > How can I achieve that \cite[something] always renders in the short
> > > form by default? How can I customize that references to Knuth contain
> > > this extra '>'? How can I customize the APS style to also use the
> > > short form in the list of publications instead of numbers?
> > > 
> > > Best
> > > Gerion
> > > 
> > > [1]
> > > https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname


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: Customize citation format of a bibliography (use the short form as reference format)

2024-04-17 Thread 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, publications.cite, publications.strings]
> > 
> > \usebtxdataset[main][testdata.buffer]
> > \usebtxdefinitions[aps]
> > \setupbtx[dataset=main]
> > \definebtxrendering[bibrendering][aps][dataset=main]
> > 
> > % this seems to have no effect?
> > \setupbtx[alternative=short]
> > 
> > \starttext
> > 
> > Knuth developed \TeX \cite[knuth1].
> > Several persons said something \cite[someother].
> > 
> > \placelistofpublications[bibrendering]
> > 
> > \stoptext
> > ```
> > 
> > It should be rendered as:
> > ```
> > Knuth developed TeX [>Knu79].
> > Several persons said something [PO00].
> > 
> > [Knu79] D.E. Knuth, TEX and METAFONT. New directions in
> > typesetting (Addi­son-Wesley, 1979). [PO00] S. Person and S.
> > Otherperson, Another title, (1900). ```
> > 
> > How can I achieve that \cite[something] always renders in the short
> > form by default? How can I customize that references to Knuth contain
> > this extra '>'? How can I customize the APS style to also use the
> > short form in the list of publications instead of numbers?
> > 
> > Best
> > Gerion
> > 
> > [1]
> > https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname



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: Customize citation format of a bibliography (use the short form as reference format)

2024-04-17 Thread Alan Braslau via ntg-context
Hello,

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.

Is there some specification for your short tag-based citation style?

Alan



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, publications.cite, publications.strings]
> 
> \usebtxdataset[main][testdata.buffer]
> \usebtxdefinitions[aps]
> \setupbtx[dataset=main]
> \definebtxrendering[bibrendering][aps][dataset=main]
> 
> % this seems to have no effect?
> \setupbtx[alternative=short]
> 
> \starttext
> 
> Knuth developed \TeX \cite[knuth1].
> Several persons said something \cite[someother].
> 
> \placelistofpublications[bibrendering]
> 
> \stoptext
> ```
> 
> It should be rendered as:
> ```
> Knuth developed TeX [>Knu79].
> Several persons said something [PO00].
> 
> [Knu79]   D.E. Knuth, TEX and METAFONT. New directions in
> typesetting (Addi­son-Wesley, 1979). [PO00]   S. Person and S.
> Otherperson, Another title, (1900). ```
> 
> How can I achieve that \cite[something] always renders in the short
> form by default? How can I customize that references to Knuth contain
> this extra '>'? How can I customize the APS style to also use the
> short form in the list of publications instead of numbers?
> 
> Best
> Gerion
> 
> [1]
> https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname



-- 
Alan Braslau
816 West Mountain Avenue
Fort Collins, CO 80521 USA
mobile: (970) 237-0957

Conserve energy! ;-)
___
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] Customize citation format of a bibliography (use the short form as reference format)

2024-04-15 Thread Gerion Entrup
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, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main]

% this seems to have no effect?
\setupbtx[alternative=short]

\starttext

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

\placelistofpublications[bibrendering]

\stoptext
```

It should be rendered as:
```
Knuth developed TeX [>Knu79].
Several persons said something [PO00].

[Knu79] D.E. Knuth, TEX and METAFONT. New directions in typesetting 
(Addi­son-Wesley, 1979).
[PO00]  S. Person and S. Otherperson, Another title, (1900).
```

How can I achieve that \cite[something] always renders in the short form by 
default?
How can I customize that references to Knuth contain this extra '>'?
How can I customize the APS style to also use the short form in the list of 
publications instead of numbers?

Best
Gerion

[1] 
https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname

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 apply metapost effects to section title?

2024-04-09 Thread Wolfgang Schuster

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

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

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

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


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

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


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

\starttext

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

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

\stoptext
 end example


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

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

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

what is best method?
\stopMysection
 
\stoptext


what is your suggestion?


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


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

\starttext

\setuphead
  [section]
  [command=\Mystyle]

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

\stoptext
 end example

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


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

2024-04-09 Thread seyal . zavira
i want to produce a gradient header
i tried this code but it does not produce any result:

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

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

and the code below works but does not colorize numbers of this heads:
\starttext  



\def\Mystyle#1{\startMPcode 

  picture tt ; tt := lmt_outline [  

  kind = "path",

  text = "#1",  

  ] ;   

  fill  

  for i within tt : pathpart i && endfor cycle  

 withshademethod "linear"   

 withshadedirection up  

 withshadecolors (red, blue) ;  

\stopMPcode 

}   



\def\startMysection#1{\startsection[title=\Mystyle{#1}]}

\def\stopMysection{\stopsection}



\startMysection{hello}  

what is best method?

\stopMysection  



\stoptext

what is your suggestion?
___
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] Re: last page number for a list

2024-04-03 Thread Bruce Horrocks


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


[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-20 Thread Andres Conrado Montoya
As I understand, Thomas needs a layout in which the header shows something
like

1. Chapter title -- 1.1. Section title (including the numbers! *This is the
important bit!*)

There are a couple things about this:

1. In a section (part, chapter, section, etc.) you can introduce three
versions of the title for that section. title= is the general one and if
nothing else is specified, this will be used in markings (headers or footer
or wherever you want to put therm) and in listings (contents). If you give
those arguments, marking= and listing=, you will get those texts in those
places: marking= on markings (you can call them with \getmarking) and
listing= in the table of contents.

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:

\setuppagenumbering[alternative=doublesided,location=,]

\setupheadertexts[{\headnumber[section].~\getmarking[section]}---{\headnumber[chapter].~\getmarking[chapter]}]
\setupfootertexts[][pagenumber][pagenumber][]
\setuphead[chapter][header=high]

\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

But with a caveat: the `header=high` setting in setuphead for the chapter
needs to be included, or you will get a section number in the first page,
even if there is no section. I have not found a better mechanism yet, but
I'm quite sure there is a correct solution for this... I just haven't found
it yet. Checking for the presence of \getmarking[section] with
\doifsomething does not work, or I could not make it work.

A little bit more info here:
https://wiki.contextgarden.net/Command/getmarking
https://wiki.contextgarden.net/Command/headnumber


El mié, 20 mar 2024 a las 9:23, Hraban Ramm () escribió:

> \setupheadtext[de][section=Aufgabe]
> Rename the section, then you don’t need marking.
>
> Sorry, I'm in a hurry and must look up how to get the number…
>
>
> Am 20.03.24 um 12:18 schrieb Thomas Meyer:
>
> Hi Hraban,
>
> and thanks.
>
> setuphead[chapter,section][numberwidth=2em] or "fit"
> works!
>
> I know \setupheadertexts, but do not know what shall I write here:
> \startsection[titel=Aufgabe, marking=?]
> If I write marking=Aufgabe I get Aufgabe, no number! For chapter the same.
>
> \setupheadertexts
>[] [{\getmarking[chapter]} - {\getmarking[section]}]
> [{\getmarking[chapter]} - {\getmarking[section]}] []
> > Kapitel - Aufgabe
>
>
> Thanks in advance
> Greetings
> Thomas
>
>
> Am 20.03.24 um 09:09 schrieb Hraban Ramm:
>
>
> Am 20.03.24 um 08:18 schrieb Thomas Meyer:
>
> HI folks,
>
> yesterday while reading along I learned how to suppress the chapter
> numbers in sections. That was something I was looking for myself.
>
> But how do you use marking correctly in startsection? I would like to see
> "1. Kapitel - 1. Aufgabe" in the header on the right. How can I automate
> this with marking?
> And how can I reduce the space between the number (1.) and the title
> (Kapitel or Aufgabe)?
>
> Thanks for your help
> Thomas
>
> Hi Thomas,
>
> do you know how to use \setupheadertexts?
>
> https://wiki.contextgarden.net/Command/setupheadertexts
>
> I guess you're using the section level for "Aufgabe"?
>
> Then something like {\getmarking{chapter} – \getmarking{section}} might
> fit your request.
>
> The formatting should be possible with
> \setuphead[chapter,section][numberwidth=2em] or "fit".
>
> 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
> ___
>
>
>
> ___
> 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.c

[NTG-context] Re: Use of marking

2024-03-20 Thread Hraban Ramm

\setupheadtext[de][section=Aufgabe]
Rename the section, then you don’t need marking.

Sorry, I'm in a hurry and must look up how to get the number…

Am 20.03.24 um 12:18 schrieb Thomas Meyer:

Hi Hraban,

and thanks.

setuphead[chapter,section][numberwidth=2em] or "fit"
works!

I know \setupheadertexts, but do not know what shall I write here:
\startsection[titel=Aufgabe, marking=?]
If I write marking=Aufgabe I get Aufgabe, no number! For chapter the same.

\setupheadertexts
   [] [{\getmarking[chapter]} - {\getmarking[section]}] 
[{\getmarking[chapter]} - {\getmarking[section]}] []

> Kapitel - Aufgabe


Thanks in advance
Greetings
Thomas


Am 20.03.24 um 09:09 schrieb Hraban Ramm:



Am 20.03.24 um 08:18 schrieb Thomas Meyer:

HI folks,

yesterday while reading along I learned how to suppress the chapter 
numbers in sections. That was something I was looking for myself.


But how do you use marking correctly in startsection? I would like 
to see "1. Kapitel - 1. Aufgabe" in the header on the right. How can 
I automate this with marking?
And how can I reduce the space between the number (1.) and the title 
(Kapitel or Aufgabe)?


Thanks for your help
Thomas


Hi Thomas,

do you know how to use \setupheadertexts?

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

I guess you're using the section level for "Aufgabe"?

Then something like {\getmarking{chapter} – \getmarking{section}} 
might fit your request.


The formatting should be possible with 
\setuphead[chapter,section][numberwidth=2em] or "fit".


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
___



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

2024-03-20 Thread Thomas Meyer

Hi Hraban,

and thanks.

setuphead[chapter,section][numberwidth=2em] or "fit"
works!

I know \setupheadertexts, but do not know what shall I write here:
\startsection[titel=Aufgabe, marking=?]
If I write marking=Aufgabe I get Aufgabe, no number! For chapter the same.

\setupheadertexts
   [] [{\getmarking[chapter]} - {\getmarking[section]}] 
[{\getmarking[chapter]} - {\getmarking[section]}] []

> Kapitel - Aufgabe


Thanks in advance
Greetings
Thomas


Am 20.03.24 um 09:09 schrieb Hraban Ramm:



Am 20.03.24 um 08:18 schrieb Thomas Meyer:

HI folks,

yesterday while reading along I learned how to suppress the chapter 
numbers in sections. That was something I was looking for myself.


But how do you use marking correctly in startsection? I would like to 
see "1. Kapitel - 1. Aufgabe" in the header on the right. How can I 
automate this with marking?
And how can I reduce the space between the number (1.) and the title 
(Kapitel or Aufgabe)?


Thanks for your help
Thomas


Hi Thomas,

do you know how to use \setupheadertexts?

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

I guess you're using the section level for "Aufgabe"?

Then something like {\getmarking{chapter} – \getmarking{section}} 
might fit your request.


The formatting should be possible with 
\setuphead[chapter,section][numberwidth=2em] or "fit".


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
___
___
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-20 Thread Hraban Ramm


Am 20.03.24 um 08:18 schrieb Thomas Meyer:

HI folks,

yesterday while reading along I learned how to suppress the chapter 
numbers in sections. That was something I was looking for myself.


But how do you use marking correctly in startsection? I would like to 
see "1. Kapitel - 1. Aufgabe" in the header on the right. How can I 
automate this with marking?
And how can I reduce the space between the number (1.) and the title 
(Kapitel or Aufgabe)?


Thanks for your help
Thomas


Hi Thomas,

do you know how to use \setupheadertexts?

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

I guess you're using the section level for "Aufgabe"?

Then something like {\getmarking{chapter} – \getmarking{section}} might 
fit your request.


The formatting should be possible with 
\setuphead[chapter,section][numberwidth=2em] or "fit".


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] Use of marking

2024-03-20 Thread Thomas Meyer

HI folks,

yesterday while reading along I learned how to suppress the chapter 
numbers in sections. That was something I was looking for myself.


But how do you use marking correctly in startsection? I would like to 
see "1. Kapitel - 1. Aufgabe" in the header on the right. How can I 
automate this with marking?
And how can I reduce the space between the number (1.) and the title 
(Kapitel or Aufgabe)?


Thanks for your help
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
___


  1   2   3   4   5   6   7   8   9   10   >