[NTG-context] Re: BibTeX choking on comments in database

2024-05-29 Thread Kip Warner
On Wed, 2024-05-29 at 06:49 -0600, Alan Braslau wrote:
> 1) You appear to be using the long-frozen mkii bibliography code.

I think you are right! I just realized that. I'm using in my
Environment file...

   % \BIBTEX macro...
   \usemodule[abr-02]
   
   % Setup bibliography...
   
   % References database and other general settings...
   \setupbibtex[database={./References}, sort=author]
   
   % Global settings...
   \setuppublications[
   alternative=apa,
   numbering=yes,
   monthconversion=month,
   autohang=yes,
   sorttype=cite]
   
   % Without this, no hyperlinks at all in the output...
   \setupinteraction[state=start]
   
   % This two-part helper creates a hyperlink for url fields...
   \unprotect
   \def\bibgotoURL#1#2%
{\useURL[#1][#2][][#1]\from[#1]}
   \def\bibinsertbiburl#1#2#3%
{\bibdoifelse{\@@pb@biburl}
  {#1\expanded{\bibgotoURL{\@@pb@title}{\@@pb@biburl}}#2}{#3}}
   \protect
   
   % Book reference layout...
   \setuppublicationlayout[book]{%
\insertauthors{}{. }{\insertthekey{}{. }{}}%
\inserttitle{\bgroup\it }{.\egroup\space }{}%
\insertpubname{}{. }{}%
\insertday{}{ }{}%
\insertmonth{\Word }{. }{}%
\insertpubyear{}{. }{}%
\insertnote{}{.}{}%
   }
   
   % Adjusted version of 'misc' typesetting, using \insertbiburl
   % instead of \inserttitle (and \insertbiburl runs the
   % \bibinsertbiburl macro defined above)
   \setuppublicationlayout[misc]{%
\insertauthors{}{. }{\insertthekey{}{. }{}}%
\insertbiburl{\bgroup\it }{.\egroup\space }{}%
\insertpubname{}{. }{}%
\insertday{}{ }{}%
\insertmonth{\Word }{. }{}%
\insertpubyear{}{. }{}%
\insertnote{}{.}{}%
   }
   
   % finally, this is a horrible hack needed due to bibtex inserting
   % line breaks in the middle of urls in the output bbl (!)
   % If you find this hack too ugly, consider editing the .bbl by
   % hand and forgetting about the .bib file altogether...
   \let\mydodostartpublication\dodostartpublication
   \def\dodostartpublication{\catcode`\%=14 \mydodostartpublication}
   
   % Macro to put the citations as footnotes...
   \unexpanded\def\footnotecite{\dodoubleempty\domycite}
   \def\domycite[#1][#2]%
   {\ifsecondargument
   \footnote{\cite[alternative=data,#1][#2]}%
   \else
   \footnote{\cite[data][#1]}%
   \fi}
   
   % Individial citation settings...
   
   % Enable clickable links...
   \setupcite[alternative=interaction=start, compress=no]
   
   % Publication list setups for end of the book list...
   
   % Settings for triggering et al...
   \setuppublicationlist[authoretallimit=3]
   \setuppublicationlist[authoretaltext={\it\ et al.}]
   \setuppublicationlist[authoretaldisplay=2]
   
   % List the author, editor, or article author's full name, inverted...
   \setuppublicationlist[%
   author=\invertedauthor,%
   artauthor=\invertedauthor,%
   editor=\invertedauthor,%
   title=References]
   
   % Setup footnotes...
   
   \setupnotation[footnote]
   [color=colour_footnote_text,
backgroundcolor=colour_footnote_background,
width=0.3cm, % Space between footnote number and footnote itself
numbercommand=] % Remove elevated footnote notation at bottom of 
page
   
   \setupnote[footnote]
   [textseparator={\textcomma}, % Comma delineated
before={\crlf\crlf}] %
   
   \setupfootnotes
 [rule=on, % Disable horizontal rule
  textstyle={\hskip.03em}] % Vertical space between footnotes and the 
text
   
   % To move footnotes inside of text boxes to the bottom of the page with
   %  the rest of the footnotes. Disabled temporarily to fix issue of text
   %  background frame borders vanishing...
   \kindofpagetextareas\plusone

Whenever I wanted to use a citation I'd just write
\footnotecite[something]. But I see now there is this page that
describes a different process for using BibTeX:

   https://wiki.contextgarden.net/Bibliography

I will take a look today and try to incorporate the new best practice
for using the database and its citations. If you have any suggestions I
will try and incorporate them.

-- 
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  : ht

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

2024-05-28 Thread Wolfgang Schuster

Kip Warner schrieb am 28.05.2024 um 06:29:

On Mon, 2024-05-27 at 19:44 +0200, Wolfgang Schuster wrote:

You can use the \framed solution and modify it to use a metapost
graphic as background, it also easy to replace the circle with a
hexagon etc.

\startuseMPgraphic{textcircle}
  draw fullcircle
  xscaled OverlayWidth
  yscaled OverlayWidth
  withcolor OverlayLineColor ;
\stopuseMPgraphic

\defineoverlay[textcircle][\useMPgraphic{textcircle}]

\defineframed
    [textcircled]
    [  width=1.5em,
  height=1.5em,
  frame=off,
     background=textcircle,
   location=low,
     offset=none]

\starttext
\dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
\stoptext


Thank you again Wolfgang. This is very helpful and works well.

One question I have for you is how to set the colour of the circle to
match the other text on my page. I currently do the following in my
environment file:

\definecolor[colour_text][r=0.754,g=0.516,b=0.324]
   
\setupcolors[state=start,textcolor=colour_text,pagecolormodel=rgb]


Add

framecolor=colour_text,

to the frame settings.

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

2024-05-27 Thread Kip Warner
On Mon, 2024-05-27 at 19:44 +0200, Wolfgang Schuster wrote:
> You can use the \framed solution and modify it to use a metapost
> graphic as background, it also easy to replace the circle with a
> hexagon etc.
> 
> \startuseMPgraphic{textcircle}
>  draw fullcircle
>  xscaled OverlayWidth
>  yscaled OverlayWidth
>  withcolor OverlayLineColor ;
> \stopuseMPgraphic
> 
> \defineoverlay[textcircle][\useMPgraphic{textcircle}]
> 
> \defineframed
>    [textcircled]
>    [  width=1.5em,
>  height=1.5em,
>  frame=off,
>     background=textcircle,
>   location=low,
>     offset=none]
> 
> \starttext
> \dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
> \stoptext

Thank you again Wolfgang. This is very helpful and works well.

One question I have for you is how to set the colour of the circle to
match the other text on my page. I currently do the following in my
environment file:

   \definecolor[colour_text][r=0.754,g=0.516,b=0.324]
  
   \setupcolors[state=start,textcolor=colour_text,pagecolormodel=rgb]

-- 
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-27 Thread Wolfgang Schuster

Kip Warner schrieb am 27.05.2024 um 19:23:

On Mon, 2024-05-27 at 05:43 -0400, seyal zavira wrote:

if you don't want to use metapost you can also use svg for background
for example:

\startuniqueMPgraphic{centered_svg}
   draw lmt_svg [
     filename = "badge.svg",
     width  = OverlayWidth,
     y      = OverlayHeight/2,  ] ;
\stopuniqueMPgraphic

\defineoverlay
   [svgback]
   [\useMPgraphic{centered_svg}]

\defineframed[Sback][location=low,background=svgback,frame=off,offset=8pt]

\starttext
this is a sample \Sback{1} text
\stoptext


Hello Seyal,

This does work but it's a bit annoying that I have to create an SVG of
just a circle and store it somewhere. I'm fine with using MetaPost,
especially if it makes this easier, but I just don't know how.


You can use the \framed solution and modify it to use a metapost graphic 
as background, it also easy to replace the circle with a hexagon etc.


\startuseMPgraphic{textcircle}
draw fullcircle
xscaled OverlayWidth
yscaled OverlayWidth
withcolor OverlayLineColor ;
\stopuseMPgraphic

\defineoverlay[textcircle][\useMPgraphic{textcircle}]

\defineframed
  [textcircled]
  [  width=1.5em,
height=1.5em,
frame=off,
   background=textcircle,
 location=low,
   offset=none]

\starttext
\dostepwiserecurse{0}{9}{1}{#1 = \textcircled{#1}\blank}
\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: Number in a circle

2024-05-27 Thread Kip Warner
On Mon, 2024-05-27 at 05:43 -0400, seyal zavira wrote:
> if you don't want to use metapost you can also use svg for background
> for example:
> 
> \startuniqueMPgraphic{centered_svg}
>   draw lmt_svg [
>     filename = "badge.svg",
>     width  = OverlayWidth,
>     y      = OverlayHeight/2,  ] ;
> \stopuniqueMPgraphic
> 
> \defineoverlay
>   [svgback]
>   [\useMPgraphic{centered_svg}]
> 
> \defineframed[Sback][location=low,background=svgback,frame=off,offset
> =8pt]
> 
> \starttext
> this is a sample \Sback{1} text
> \stoptext

Hello Seyal,

This does work but it's a bit annoying that I have to create an SVG of
just a circle and store it somewhere. I'm fine with using MetaPost,
especially if it makes this easier, but I just don't know how.

-- 
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-27 Thread seyal zavira
if you don't want to use metapost you can also use svg for background
for example:

\startuniqueMPgraphic{centered_svg}
  draw lmt_svg [
filename = "badge.svg",
width  = OverlayWidth,
y  = OverlayHeight/2,  ] ;
\stopuniqueMPgraphic

\defineoverlay
  [svgback]
  [\useMPgraphic{centered_svg}]

\defineframed[Sback][location=low,background=svgback,frame=off,offset=8pt]

\starttext
this is a sample \Sback{1} text
\stoptext

On Mon, May 27, 2024 at 12:38 AM Kip Warner  wrote:

> Hello list,
>
> I would like to typeset a number in a circle. Nothing fancy. No special
> colours, transforms, or complex metapost magic (which I am not familiar
> with).
>
> I have tried \circled{3} and \textcircled{3}, but ConTeXt does not
> appear to recognize these commands. Any help appreciated.
>
> --
> Kip Warner
> OpenPGP signed/encrypted mail preferred
> https://www.thevertigo.com
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___
>


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

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


[NTG-context] Re: Problem with PNG images in the latest standalone version

2024-05-24 Thread Hajtmar Jaroslav
Thanks Wolfgang for the analysis and explanation. Both pictures are "not from 
my workshop" and I received them as background material. Moreover, I have 
reduced them a lot today for the purpose of sending them to the conference (I 
have reduced the quality a lot to reduce their size). Strangely, I have been 
translating documents with this image for several years with the old version of 
ConTeXt, so I was surprised that the new ConTeXt was not able to process them 
as I expected. Unfortunately, it didn't really occur to me that the problem 
might be with the image rather than ConTeXt, but the images were commonly 
displayed on several computers (Windows and OS X), and I didn't think to look 
at the log file.
Thanks again for the explanation and for the lesson, which I will certainly 
remember.
Have a nice day.
Jaroslav


> 24. 5. 2024 v 15:22, Wolfgang Schuster :
> 
> Hajtmar Jaroslav schrieb am 24.05.2024 um 13:48:
>> Hello, thanx for reply.
>> PNG and JPG files are available at the URL given, as well as PDF documents 
>> with the compilation results. The old ConTeXt seems to be able to embed PNGs 
>> from the local disk, but no longer from a remote address.
>> The new ConTeXt handles both local and remote PNG image in different ways.
> 
> I tested both of your images and I had a problem with the png-version as well 
> but when you look at the log-file you should find the following message:
> 
> graphics> inclusion > image 'gyzalogo-new.png' has bad dimensions 
> (0pt,0pt), discarding
> 
> My next step was to open the file with a image viewer which showed my the 
> file is a jpeg rather than a png, afterwards i changed the file extension 
> from png to jpg and it appears in my document.
> 
> The conclusion here is that somebody just changed the file extension to 
> *convert* the image from jpeg to png which of yourse is nonsense. Another 
> clue to notice there is something wrong is the size of both value because 
> there should be a difference between jpeg and png but both have the same file 
> size.
> 
> 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: build_parshape and \getshapetext - need for a deeper understanding

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

On 5/19/2024 2:29 PM, garu...@azules.eu wrote:

I still get some difficulties with build_parshape, \getshapetex and sectionning.

I though I find a solution by removing \blank with
   \setuphead  [subsection]  [before=,  after=, style=, 
command=\MySubSectionCommand, alternative=text ]

But actually it's not enough : when I add text before the first section, new 
issues appear.

I tried to build a MVE by refactoring and tidying as much as I could.
It build 3 comparative pages (i) basic issue, (ii) solution, (iii) remaining 
issue.

Your guidance are most welcome :-)


you have to fight several issues:

- parshapes being reset at the end paragraph (handled here by luametatex 
context)
- parshapes operate on lines, not dimension (i might add an aletnative 
one day)

- you use a bit old mechanism (checkout the luametafun-paragraphs chapter)

Now, is there a solution? It really depends on the circumstances, so 
here is one.


\setupbodyfont[11pt]

\definemeasure [mywidth]  [7cm]
\definemeasure [mywidtha] [5cm]
\definemeasure [myheight] 
[{\the\dimexpr\baselineskip*37+\lineskip\relax}]
\definemeasure [myheighta] 
[{\the\dimexpr\baselineskip*18+\lineskip*1\relax}]
\definemeasure [myheightb] 
[{\the\dimexpr\baselineskip*25-\lineskip*1\relax}]


\startuseMPgraphic{shape:1}
  path p ;
  numeric mywidth   ; mywidth   := \measure{mywidth};
  numeric mywidtha  ; mywidtha  := \measure{mywidtha};
  numeric myheight  ; myheight  := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0)-- (mywidth,0) --
   (mywidth,myheighta)  -- (mywidtha,myheighta) --
   (mywidtha,myheightb) -- (mywidth,myheightb) --
   (mywidth,myheight)   -- (0cm,myheight) -- cycle;

build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) 
;

  path SavedShape ; SavedShape := p ;
\stopuseMPgraphic

\startuseMPgraphic{shape:2}
  SavedShape := SavedShape shifted (0,-ypart urcorner OverlayBox) ;
  SavedShape := SavedShape shifted (0,positiony("test")) ;
  fill SavedShape withcolor red;
 setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\showframe

\defineoverlay[myoverlay][\useMPgraphic{shape:2}]

\setupbackgrounds[text][text][background=myoverlay]

\startsection[title={test}]

\startshapedparagraph[mp=shape:1]%
\setupalign[verytolerant,stretch]%
\hpos{test}{!}\samplefile{tufte}
\samplefile{tufte}
\stopshapedparagraph

\stopsection

The "test" position is hard coded but should be namespaced, the ! can be 
a \strut instead.


So, more thinking from the end of the text flow.

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] build_parshape and \getshapetext - need for a deeper understanding

2024-05-19 Thread garulfo
I still get some difficulties with build_parshape, \getshapetex and sectionning.

I though I find a solution by removing \blank with
  \setuphead  [subsection]  [before=,  after=, style=, 
command=\MySubSectionCommand, alternative=text ]

But actually it's not enough : when I add text before the first section, new 
issues appear.

I tried to build a MVE by refactoring and tidying as much as I could.
It build 3 comparative pages (i) basic issue, (ii) solution, (iii) remaining 
issue.

Your guidance are most welcome :-)


\setupbodyfont[11pt]

%--

\usecolors[svg]

\definemeasure [mywidth]  [7cm]
\definemeasure [mywidtha] [5cm]
\definemeasure [myheight] [{\the\dimexpr\baselineskip*37+\lineskip\relax}]
\definemeasure [myheighta][{\the\dimexpr\baselineskip*18+\lineskip*1\relax}]
\definemeasure [myheightb][{\the\dimexpr\baselineskip*25-\lineskip*1\relax}]

\startuseMPgraphic{mymetafunpath}
  path p ;
  numeric mywidth   ; mywidth   := \measure{mywidth};
  numeric mywidtha  ; mywidtha  := \measure{mywidtha};
  numeric myheight  ; myheight  := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0)-- (mywidth,0) --
   (mywidth,myheighta)  -- (mywidtha,myheighta) --
   (mywidtha,myheightb) -- (mywidth,myheightb) --
   (mywidth,myheight)   -- (0cm,myheight) -- cycle;
  build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  fill p withcolor \MPcolor{tan};
\stopuseMPgraphic

\defineoverlay[myoverlay][\useMPgraphic{mymetafunpath}]

%--

\define[2]\MySubSectionCommand{\leftaligned{#2}}

%--

\define[2]\MyPageBuilder{%
\page
\setupbackgrounds[page][background=testA]
\definelayer[testA] [x=0mm, y=0mm,width=\paperwidth, height=\paperheight]
~

\startshapetext[mymetafunpath, mymetafunpath]   % <=== WITHOUT \startsubsection
#2
%\startsubsection[title={Title for section  #1}]
\MySubSectionCommand{1}{Title for section #1}
\input knuth \endgraf \input ward
%\stopsubsection
\stopshapetext

\setlayer
  [testA]
  [hoffset={\the\dimexpr\backspace\relax},
   voffset={\the\dimexpr\topspace+\headerheight+\headerdistance\relax},]
  {\framed[background=myoverlay,frame=off]{\strut\getshapetext}}

\startshapetext[mymetafunpath, mymetafunpath]   % <=  WITH \startsubsection
#2
\startsubsection[title={Title for section  #1}]
%\MySubSectionCommand{1}{Title for section #1}
\input knuth \endgraf \input ward
\stopsubsection
\stopshapetext

\setlayer
  [testA]
  [hoffset={\the\dimexpr\backspace+\measure{mywidth}+5mm\relax},
   voffset={\the\dimexpr\topspace+\headerheight+\headerdistance\relax},]
  {\framed[background=myoverlay,frame=off]{\strut\getshapetext}}
}

%==

%\showboxes

\starttext

\MyPageBuilder{A}{}

\setuphead
  [subsection]
  [
   before=,
   after=,
   style=,
   command=\MySubSectionCommand,
   alternative=text,
   ]

\MyPageBuilder{B}{}

\MyPageBuilder{C}{\strut Hi from here. \endgraf}

\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: Why is only the first frame protruding into the margin?

2024-05-17 Thread Wolfgang Schuster

madiazm.eo...@gmail.com schrieb am 17.05.2024 um 00:05:

Hi,
I used some code from the meta-fun manual to recreate a labelled frame around 
my sections. But the first framedtext protrudes a couple of mm into the margin. 
Only the first one in the page. I intentionaly added other sections and the 
frames aline to the margin ok.
I tried to put something before the first frame (noindentation, dontleavehmode) 
because I sometimes read it solves problems, but not the case here.
so Why is the first frame protruding and only the first?


[...]



Include only setups in your examples which are necessary to show the 
problem, the custom layout isn't necessary and can be left out.




\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := textext.rt(\MPstring{FunnyFrame}) ;
w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
p := p shifted (2o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled .25pt withcolor blue) ;
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
%draw boundingbox p ; %%%quitamos el frame pequeño
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][width=.85\textwidth, height=20mm, frame=off,  
background=FunnyFrame, align=flushright,location=right, 
after={\blank[2*big]}]%foregroundsytel amplía la palabra Apartado

\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut \color[blue]{\tfx Apartado 
#1}\hss}}}

\setMPtext{FunnyFrame}{} % initialize the text variable



\define[2]\firstHeadings{%
\dontleavehmode \switchtobodyfont[miCorm]
\FrameTitle#1%

\dontleavehmode \startFunnyText  {\switchtobodyfont[miCorm,20.7pt] #2} 
\stopFunnyText
}

\setuphead [section] [color=blue, command=\firstHeadings, indentnext=no]



Get rid of \dontleavehmode in your custom section layout, avoid blank 
lines in definitions and move the font changes to \setuphead.



\define[2]\firstHeadings
  {\FrameTitle{#1}%
   \startFunnyText
 #2%
   \stopFunnyText}

\setuphead
  [section]
  [color=blue,
   style={\switchtobodyfont[miCorm]},
   textstyle={\switchtobodyfont[20.7pt]},
   command=\firstHeadings,
   indentnext=no]



\startsection[title=Aspectos generales]
Esta guía contiene toda la documentación necesaria para administrar la prueba 
unificada de certificación que ha diseñado la comisión de alemán. Se ruega al 
profesorado\footnote{Todas las alusiones a la forma del masculino genérico que 
se recogen en este documento deberán entenderse referidas a la condición 
masculina o femenina de cada persona según corresponda.} que se familiarice con 
las secciones del documento a través del índice y acuda a ellas según vaya 
siendo necesario, de manera que se pueda administrar y corregir la prueba de la 
manera más satisfactoria posible.
\stopsection



Use dummy text when it possible to keep the example short and clean.

\startsection[title=Aspectos generales]
\samplefile{lorem}
\stopsection


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] Why is only the first frame protruding into the margin?

2024-05-16 Thread madiazm . eoicc
Hi,
I used some code from the meta-fun manual to recreate a labelled frame around 
my sections. But the first framedtext protrudes a couple of mm into the margin. 
Only the first one in the page. I intentionaly added other sections and the 
frames aline to the margin ok.
I tried to put something before the first frame (noindentation, dontleavehmode) 
because I sometimes read it solves problems, but not the case here.
so Why is the first frame protruding and only the first?


\definepapersize[vertical][A4, portrait]
\definepapersize[horizontal][A4, landscape] 
\setuppapersize[vertical]


\setuplayout[location=middle,
 marking=off,
 topspace=1cm,
 topdistance=0cm,
 backspace=2.5cm,   
 height=fit,
 width=fit,
 rightedge=5mm,
 rightedgedistance=0cm,
 rightmargin=20mm,
 rightmargindistance=7mm,
 leftmargin=1.5cm,
 header=1cm,
 headerdistance=.5cm,
 bottomspace=.5cm,
 bottomdistance=0mm,
 footer=.8cm,
 footerdistance=.2cm,
 setup=strict,]



\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := textext.rt(\MPstring{FunnyFrame}) ;
w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
p := p shifted (2o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled .25pt withcolor blue) ;
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
%draw boundingbox p ; %%%quitamos el frame pequeño
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][width=.85\textwidth, height=20mm, frame=off,  
background=FunnyFrame, align=flushright,location=right, 
after={\blank[2*big]}]%foregroundsytel amplía la palabra Apartado

\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut \color[blue]{\tfx Apartado 
#1}\hss}}}

\setMPtext{FunnyFrame}{} % initialize the text variable



\define[2]\firstHeadings{%
\dontleavehmode \switchtobodyfont[miCorm] 
\FrameTitle#1%

\dontleavehmode \startFunnyText  {\switchtobodyfont[miCorm,20.7pt] #2} 
\stopFunnyText
}

\setuphead [section] [color=blue, command=\firstHeadings, indentnext=no]


\starttext
\noindentation 
\dontleavehmode 

\startsection[title=Aspectos generales]


Esta guía contiene toda la documentación necesaria para administrar la prueba 
unificada de certificación que ha diseñado la comisión de alemán. Se ruega al 
profesorado\footnote{Todas las alusiones a la forma del masculino genérico que 
se recogen en este documento deberán entenderse referidas a la condición 
masculina o femenina de cada persona según corresponda.} que se familiarice con 
las secciones del documento a través del índice y acuda a ellas según vaya 
siendo necesario, de manera que se pueda administrar y corregir la prueba de la 
manera más satisfactoria posible.
\stopsection


\startsection[title=another section]
Las carpetas con las pruebas aparecen nombradas por idioma, nivel y set de 
pruebas, no apareciendo ninguna referencia a convocatorias anuales ni tampoco 
fechas. Sí aparece la referencia a la convocatoria en cada una de las guías de 
administración para los diferentes niveles.
 \stopsection
\startsection[title=another section]
La carpeta correspondiente a cada nivel contiene las distintas actividades de 
lengua, los audios para CTO y el audio/vídeo base para la mediación escrita. 
Además contiene esta guía con la información necesaria para tener una visión 
global de la prueba: los solucionarios, transcripciones, tablas de corrección, 
tablas de conversión y la rúbrica para la mediación escrita. Igualmente se 
incorporarán o enlazarán subcarpetas con los archivos necesarios para las 
pruebas orales: monólogos, diálogos y mediaciones orales.
 \stopsection

\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] compatibility between \startshapetext and \startsection ?

2024-05-14 Thread garulfo
Hi all,

\startshapetext works pretty well, but when I use \startsection \stopsection, 
shapes are not respected  anymore.
I use layers, to be able to place the content anywhere, but the issue remains 
without layers.

Any clues ?
(\placeinitial seems also to break the shaping)


Example : 2 pages without sectioning, and after 2 pages by uncommenting the 
\startsection and \stopsection commands.


\setupbodyfont [pagella, 8pt]
\setupframed
  [frame=on,
   offset=0.000pt,
   rulethickness=0.000pt,
   location=top,
   align=normal,
   strut=yes,
   ]
\setuplayout [grid=yes]
\setupinteraction [state=start]

%--

\definemeasure [myheight] [{\the\dimexpr\baselineskip*33+\lineskip\relax}]
\definemeasure [myheighta][{\the\dimexpr\baselineskip*10+\lineskip*2\relax}]
\definemeasure [myheightb][{\the\dimexpr\baselineskip*20-\lineskip*2\relax}]

\startuseMPgraphic{mp1}
  path p ;
  numeric myheight  ; myheight := \measure{myheight};
  numeric myheighta ; myheighta := \measure{myheighta};
  numeric myheightb ; myheightb := \measure{myheightb};
  p := (0,0) -- (6cm,0) --
   (6cm,myheighta) -- (4cm,myheighta) -- (4cm,myheightb) -- (6cm,myheightb) 
--
   (6cm,myheight) -- (0cm,myheight) -- cycle;
  build_parshape(p,0,0,0,\baselinedistance,\strutheight,\strutdepth,\topskip) ;
  fill p withcolor \MPcolor{lightyellow};
\stopuseMPgraphic

\defineoverlay[ol1][\useMPgraphic{mp1}]


%==
\starttext
%==

{\sc\bfd Version A, without sectionning, pages 1\ampersand 2}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref1]{MyRef1}Here is the first reference.\par
See reference \in[myref2] on \at{page}[myref2]\par
%
\dorecurse{5}{
%\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
%\stopsection
}

\reference[myref2]{MyRef2} Here is the second reference.\par
See reference \in[myref1] on \at{page}[myref1]\par

\stopshapetext

\definelayer[testA]

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page

\setlayer[testA][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testA][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testA]

\page
%==

{\sc\bfd Version B, with sectionning, pages 3\ampersand 4}

\startshapetext[mp1, mp1, mp1, mp1, mp1, mp1]
\setupalign[hz,hanging,verytolerant,stretch,normal]%
\setupindenting[yes,small]%
\strut%
\reference[myref3]{MyRef3}Here is the first reference.\par
See reference \in[myref4] on \at{page}[myref4]\par
%
\dorecurse{5}{
\startsection[title={Title for section{\recurselevel}}]
\darkred\input knuth \par
\darkblue\input ward
\stopsection
}

\reference[myref4]{MyRef4} Here is the second reference.\par
See reference \in[myref3] on \at{page}[myref3]\par

\stopshapetext

\definelayer[testB]

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

\page

\setlayer[testB][x=-1cm,y=3cm]{\framed[background=ol1]{\strut\getshapetext}}
\setlayer[testB][x=9cm,y=3cm] {\framed[background=ol1]{\strut\getshapetext}}
\flushlayer[testB]

%==
\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: transparent color

2024-05-06 Thread Wolfgang Schuster

Bruce Horrocks schrieb am 06.05.2024 um 15:30:

On 6 May 2024, at 09:41, Hans van der Meer via ntg-context  
wrote:

I would like to use a transparent version of an existing color. Thus
\definecolor[transparentcolor][color,t=0.2,a=1]
instead of
\definecolor[transparentcolor][r=..,g=..,b=..,t=0.2,a=1]
because I do not know the rgb values of the color that must be made 
transparent, only its name.

How to accomplish?

The Wiki page <https://wiki.contextgarden.net/Color> gives the source files for 
various sets of colours (built in, crayola etc) and the source has the RGB values in 
a fairly obvious format.


\definecolor [wolley] [\colorcomponents{yellow},t=0.5,a=1]

\starttext

%\showcolorcomponents [yellow]

\framed[background=color,backgroundcolor=darkblue,foregroundcolor=yellow]{yellow}

\framed[background=color,backgroundcolor=darkblue,foregroundcolor=wolley]{wolley}

\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] Hbox error with itemized list on second page

2024-04-30 Thread Ross Schulman
Hello,
I'm attempting to format a resume in Context building off of a template I found 
online. I'm having an odd error with some bullets on the second page, however. 
I'm guessing it has something to do with my \definelayout for the second (and 
subsequent) pages, but I can't figure it out for sure. What is happening is 
that whichever bullets are at the top of the second page are being wrapped as 
if they were appearing on the first page, which has a different layout 
structure.

I've pasted a sanitized version of the tex file below. Any assistance would be 
greatly appreciated!

Thanks,
Ross Schulman


\usemodule[ipsum]
\setuppapersize[letter]
\setuppagenumbering[location=]
\definelayout[first]
  [% horizontal
   backspace=2.5in,
   leftmargin=1.75in,
   leftmargindistance=0.25in,
   width=5.5in,
   rightmargin=0in,
   % vertical
   topspace=0pt,
   header=1.2in,
   headerdistance=.1in,
   height=middle,
   footerdistance=0pt,
   footer=\lineheight,
   bottomspace=.5in]

\definelayout[rest]
  [% horizontal
leftmargin=0in,
width=6.5in,
rightmargin=0in,
% % vertical
topspace=0pt,
header=1in,
headerdistance=.1in,
height=middle,
footerdistance=0pt,
footer=\lineheight,
bottomspace=.3in]

\definelayout[1][first]
\definelayout[2][rest]

\setupmarginblock
  [location=left,
   width=\leftmarginwidth,
   align=flushright]

\usecolors[svg]

\definehead[contacts][title]
\setuphead
[contacts]
[
align=center,
page=no,
after={\thinrule\blank[big]}]

\definehead[topic][subject]
\setuphead
[topic]
[
after={\hairline}]

\defineitemgroup
  [timeline]
  [before=,
   inbetween=,
   width=6em]

\setuplines[before=,after=,command=\strut]

\definelayer[mybkgr][x=0mm,y=0mm,
  width=\paperwidth,height=\paperheight]

\setupbackgrounds[page][background={mybkgr}]

\starttext
\setlayerframed
  [mybkgr]
  []
  [background=color,
   framecolor=forestgreen,
   backgroundcolor=forestgreen,
   foregroundcolor=white,
   width=\paperwidth,
   height=\dimexpr\topspace+\headerheight\relax]
{\dontleavehmode{\tfd ROSS SCHULMAN}\blank[medium]
policy technologist
}

\startmarginblock
\topic{CONTACT}
\startlines
1234 Main St NW
Washington, DC 20011
\stoplines

\topic{LANGUAGES}
\startlines
English (Native Speaker)
Spanish (Conversational)
\stoplines

\topic{TECH}
\startlines
Rust
Javascript \letterampersand\space Typescript
Linux Administration
Google and Microsoft Office Suites
\stoplines
\stopmarginblock

\setupalign[flushleft]
\topic{EXPERIENCE}
\starttimeline
\sym{2021--Now}\color[forestgreen]{Lorem Ipsum Foundation}\hfill
\color[darkgrey]{\tfx San Francisco, CA (remote)}

Senior Fellow
\startitemize[packed]
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
\stopitemize

\sym{2015--2021}\color[forestgreen]{Other Place About Lorem}\hfill
\color[darkgrey]{\tfx Washington, DC}

Senior Lorem Counsel
\startitemize[packed]
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
\stopitemize

\sym{2014--2015}\color[forestgreen]{Lorems R Us}\hfill
\color[darkgrey]{\tfx Washington, DC}

Lorem Manager
\startitemize[packed]
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
\stopitemize

\sym{2010--2014}\color[forestgreen]{Computer and Communications Industry 
Association}\hfill
\color[darkgrey]{\tfx Washington, DC}

Lorem Project Manager
\startitemize[packed]
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
\stopitemize

\sym{2005--2007}\color[forestgreen]{Center for Lorem Ipsum}\hfill
\color[darkgrey]{\tfx Washington, DC}

Program Associate
\startitemize[packed]
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
  \item \ipsum[alternative=words, n=10, inbetween=\space] \par
\stopitemize
\stoptimeline
\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

[NTG-context] Re: Why Difference Between \placefloat and \definefloat

2024-04-29 Thread Wolfgang Schuster

urba...@ca.rr.com schrieb am 28.04.2024 um 19:54:
I swear I used to understand this stuff.  I plead old age.   Why do I 
get two different results from the float placements here:


\definefloat[mysidebar][mysidebars]
\setupfloat[mysidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]


1. You can't pass assignments and keywords to the same argument.

2. The \setupfloat command accepts only assignments as arguments, this 
means "outer" and "none" are ignored.


To set a default location for the float use 
\setupfloat[...][default={outer,none}]



\defineframedtext [sidebartext]
[width=.4\textwidth,bodyfont=small,corner=round,background=color,backgroundcolor=lightgray,align=flushleft]

\starttext
This is a bit of text
\placefloat[sidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]{}{


1. You're again passing assignments and keywords with a single argument.

2. The \placefloat commands accepts only keywords and ignores all 
assignments, this means your distance settings have no effect.


Wolfgang

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

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


[NTG-context] Re: Why Difference Between \placefloat and \definefloat

2024-04-28 Thread urban . m
I don't think that 'sidebar' has much to do with it. The part that is
not working as expected is the 'mysidebar', which is not getting the
'outer' location, nor the 'none' captioning that I get with
placefloat.

setupfloat[mysidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]

defineframedtext [sidebartext]
[width=.4textwidth,bodyfont=small,corner=round,background=color,backgroundcolor=lightgray,align=flushleft]

starttext
This is a bit of text
placefloat[newsidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]{}{
startsidebartext
This is a short sidebar
stopsidebartext
}
And something to follow.

A bit of text
placemysidebar{}{
startsidebartext
This is a short sidebar
stopsidebartext
}
And something to follow.

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: Why Difference Between \placefloat and \definefloat

2024-04-28 Thread Henning Hraban Ramm
Where’s the float type "sidebar" defined? AFAIK it’s not a default type. 
And it might interfere with the actual sidebar stuff from 
https://source.contextgarden.net/tex/context/base/mkxl/anch-bar.mkxl, 
see also https://wiki.contextgarden.net/Command/setupsidebar


Hraban

Am 28.04.24 um 19:54 schrieb urba...@ca.rr.com:
I swear I used to understand this stuff.  I plead old age.   Why do I 
get two different results from the float placements here:


\definefloat[mysidebar][mysidebars]
\setupfloat[mysidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]

\defineframedtext [sidebartext]
[width=.4\textwidth,bodyfont=small,corner=round,background=color,backgroundcolor=lightgray,align=flushleft]

\starttext
This is a bit of text
\placefloat[sidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]{}{
\startsidebartext
This is a short sidebar
\stopsidebartext
}
And something to follow.

A bit of text
\placemysidebar{}{
\startsidebartext
This is a short sidebar
\stopsidebartext
}
And something to follow.

\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] Why Difference Between \placefloat and \definefloat

2024-04-28 Thread urban . m
I swear I used to understand this stuff. I plead old age. Why do I get
two different results from the float placements here:

definefloat[mysidebar][mysidebars]
setupfloat[mysidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]

defineframedtext [sidebartext]
[width=.4textwidth,bodyfont=small,corner=round,background=color,backgroundcolor=lightgray,align=flushleft]

starttext
This is a bit of text
placefloat[sidebar][leftmargindistance=-.25in,rightmargindistance=-.25in,outer,none]{}{
startsidebartext
This is a short sidebar
stopsidebartext
}
And something to follow.

A bit of text
placemysidebar{}{
startsidebartext
This is a short sidebar
stopsidebartext
}
And something to follow.

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] \par and \startlines

2024-04-26 Thread denis.maier
Hi,

I'm trying to typeset a poem from XML, but I can't figure out how to make the 
inbetween key working here.
As the source is XML, I cannot just add an empty line to start a new group of 
lines inside \startlines...\stoplines. I guess, there must be a command to do 
that, but \par seems to have no effect here.
How can this be done?

Best,
Denis

%%%
\setuplines[before={\blank},after={\blank},inbetween={ARE WE INBETWEEN?\blank}]

% XML Nodes auswählen
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|poem|stanza|line}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:test}

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

\startxmlsetups xml:poem
\startlines
   \xmlflush{#1}
\stoplines
\stopxmlsetups

\startxmlsetups xml:stanza
   \xmlflushlinewise{#1}\par %this has no effect
\stopxmlsetups

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

\startbuffer[test]




The
lines
are
there!


The
lines
are
there!



\stopbuffer


\starttext

This works:

\startlines
The
lines
are
there!

The
lines
are
there!
\stoplines

Apparently, \type{\par} has no effect here:

\startlines
The
lines
are
there!\par% \par has no effect here
The
lines
are
there!
\stoplines

For background, this is what I'm actually trying to do:

\xmlprocessbuffer{test}{test}{}

\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: what are the interaction between \showframe and \realpageno in \startuseMPgraphic ?

2024-04-24 Thread Wolfgang Schuster

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

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

\showframe

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

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

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

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

Any clue is warmly welcome


You need

    \setupbackgrounds[state=repeat]

which is set when you use \showframe.

Wolfgang

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

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


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

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

\showframe

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

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

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

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

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] Wiki - question about Command/ pages which start with a space character

2024-04-14 Thread garulfo
Hi all,

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

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

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

If it is not: 
- Is there a way to automatically merge the content of the couple of pages, and 
to remove the "wrong" pages, or should it be done manually ?

Thanks for your help.

List :
Command/ attachment
Command/ background
Command/ bar
Command/ beginblock
Command/ button
Command/ characterkerning
Command/ comment
Command/ completecombinedlist
Command/ completelistoffloats
Command/ completelistofsorts
Command/ completelistofsynonyms
Command/ completeregister
Command/ copylabeltext
Command/ ctxfunction
Command/ ctxfunctiondefinition
Command/ currentlabel
Command/ delimitedtext
Command/ description
Command/ enumeration
Command/ fence
Command/ fraction
Command/ framed
Command/ framedtext
Command/ getbuffer
Command/ hbox
Command/ help
Command/ high
Command/ highlight
Command/ label
Command/ labellanguage
Command/ labeltext
Command/ labeltexts
Command/ language
Command/ leftlabeltext
Command/ linenote
Command/ low
Command/ lowhigh
Command/ lowmidhigh
Command/ margindata
Command/ mathcommand
Command/ mathdoubleextensible
Command/ mathextensible
Command/ mathframed
Command/ mathmatrix
Command/ mathornament
Command/ mathoverextensible
Command/ mathovertextextensible
Command/ mathradical
Command/ mathtriplet
Command/ mathunderextensible
Command/ mathundertextextensible
Command/ mathunstacked
Command/ nextparagraphs
Command/ note
Command/ ornament
Command/ paragraphs
Command/ placecombinedlist
Command/ placefloat
Command/ placelistoffloats
Command/ placelistofsorts
Command/ placelistofsynonyms
Command/ placement
Command/ placepairedbox
Command/ placeregister
Command/ presetlabeltext
Command/ referenceformat
Command/ register
Command/ rightlabeltext
Command/ script
Command/ section
Command/ seeregister
Command/ setupcombinedlist
Command/ setupitemgroup
Command/ setuplabeltext
Command/ setuppairedbox
Command/ setupregister
Command/ shift
Command/ sorting
Command/ startattachment
Command/ startbackground
Command/ startbuffer
Command/ startcolumnset
Command/ startcomment
Command/ startdelimitedtext
Command/ startdescription
Command/ starteffect
Command/ startenumeration
Command/ startfittingpage
Command/ startfloattext
Command/ startformula
Command/ startframedtext
Command/ starthelp
Command/ startindentedtext
Command/ startitemgroup
Command/ startlabeltext
Command/ startlinenote
Command/ startlines
Command/ startmakeup
Command/ startmathalignment
Command/ startmathcases
Command/ startmathmatrix
Command/ startmixedcolumns
Command/ startnarrower
Command/ startnote
Command/ startpagecolumns
Command/ startparagraphs
Command/ startparallel
Command/ startplacefloat
Command/ startplacepairedbox
Command/ startsection
Command/ startsectionblock
Command/ startstartstop
Command/ startstop
Command/ startstyle
Command/ starttabulate
Command/ starttextbackground
Command/ starttyping
Command/ startviewerlayer
Command/ startxtable
Command/ stoplinenote
Command/ style
Command/ synonym
Command/ textbackground
Command/ textnote
Command/ tooltip
Command/ type
Command/ typebuffer
Command/ unit
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Re: Fwd: Re: how to apply gradient color to a piece of text?

2024-04-07 Thread Keith McKay
I've found my original file and the image is as Hraban says below. The 
code is the original in the post I quoted  and gives a green background 
with shaded colours in the text.


Best Wishes

Keith

On 07/04/2024 18:42, Henning Hraban Ramm wrote:

Am 07.04.24 um 19:05 schrieb Hans Hagen:

\startMPpage
 picture tt ; tt := lmt_outline [
 kind = "fillup",
 text = "\definedfont[name:texgyrepagellabold*default]foo f o 
o",

 ] xsized 12cm ;

 path bb ; bb := boundingbox tt ;
 path pp ; pp := bb enlarged 2cm ;

 fill pp
 withshademethod "linear"
 withshadedirection down
 withshadecolors (red, blue) ;

 draw tt withcolor green ;
\stopMPpage

no need to loop over tt


But the intention was to get a gradient _within_ the text.

Might there be a problem with the latest changes to gradients?

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: Struggling with the distance and right margin text

2024-03-22 Thread Ursula Hermann
Dear Pablo,


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

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


\setuppapersize[A8,landscape]
\setupbodyfont[termes, 12.50pt]
\setuplayout[inrightmargin=5.1cm
 backspace=2.9cm,
 inleftmargin=0cm,width=4cm]
\inrightmargin{\blackrule\\{3.2.2}}\par \dontleavehmode \blackrule
\showframe
\starttext
Me

\stoptext




Von: Pablo Rodriguez via ntg-context 
Gesendet: Freitag, 15. März 2024 20:00:35
An: ntg-context@ntg.nl
Cc: Pablo Rodriguez
Betreff: [NTG-context] Re: Struggling with the distance and right margin text

On 3/15/24 14:06, Ursula Hermann wrote:
> Dear List,

Dear Ursula,

this might help you (it isn’t perfect, but you just seem to copy and
paste fragments from your source files):

  %\showframe\showstruts
  \mainlanguage[de-at]
  \setuppagenumbering[alternative=doublesided]
  \definemargindata  [MyInMargin][ininner]
  \definemarginframed[MyInMargin]
[topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
  \defineframed[topruletitle]
[width=max,
 frame=off,
 topframe=on,
 rulethickness=1pt,
 align={justify},
 extras=\dontleavehmode]
  \starttext
  \topruletitle{\MyInMargin {1.1.1}\bf
  Beispiel 3.2.17. (Vertauschung von All- und Existenzquantor).} \par
  \input knuth\page

  \topruletitle{\MyInMargin{3.2.22}{\bf
  Theorem 3.2.22 (Rechenregeln für Quantoren)}. Seien \m P(\m x)und
\input zapf b}
  \stoptext

Sorry for saying that again, but please elaborate both your minimal
samples and your descriptions of the issues you are experiencing.

Some comments on the code fragments you sent.

First of all, please include always code that can be compiled simply
after being copied and pasted.

This requires \starttext (most of the time) and \stoptext (mandatory to
avoid stupid errors).

> \definepapersize[MyBook][width=19cm,height=29.7cm]
> \setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook
> %\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
> \setupbodyfont[modern, 12.50pt]

If these lines are irrelevant for the issue you are experiencing, please
don’t include them.

> \definemargindata  [MyInMargin][inleft]
> \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]

You define this margin framed, but your sample makes no use of it.

Sorry, but I don’t get it.

> \defineenumeration
>   [theorem]
>   [
> text=Theorem,
> title=yes,
> width=fit,
> distance=0.2em,
> alternative=serried,
>   ]
> \definetextbackground[GrayBackground][
>   location=paragraph,
>   background=color,
>   backgroundcolor=lightgray,
>   leftoffset=.5\bodyfontsize,
>   rightoffset=.5\bodyfontsize,
>   topoffset=.5\bodyfontsize,
>   bottomoffset=.5\bodyfontsize,
>   frame=off,]
>   \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
>   \blackrule[color=black, height=0.10ex, width=13.50cm]

If your sample includes no theorem or text background, please remove
these definitions when sending code.

BTW, avoid include text content (such as margin and body rules [but not
their definitions]) before \starttext.

Also, use \clrf instead of \\ (since the mailing list displays the
relevant line as ("\" instead of "\\"):

>   \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\}

Here starts your text:

> \starttext
> \margintext {1.1.1}
> {\bf Beispiel 3.2.17. (Vertauschung von All- und Existenzquantor).} \par

Your margin text is undefined. Your code has a defined margin text
command, but it isn’t used.

> So  I have here an example from the second page:

Sorry, but I’m having the impression you are using ConTeXt as a kind of
command-based DTP software (which I think it isn’t at all).

Or, do you define commands for each page?

I think it is better to define a single margin text command and use a
doublesided page setup.

> \definemargindata[inrightmargin][right][margin=margin,width=.50em\rightmarginwidth,style=,color=]
> \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt, 
> width=.90cm]

Again, margin text commands defined, but never used.

> \blackrule[color=black, height=0.10ex, width=13.40cm]
> {\blackrule[color=black, height=0.10ex, width=1cm, distance=.90cm]\par

Here you open a brace that is not closed at all.

At least, consider that this won’t be extremely readable for other
people (this is only a sample).

It also may be problematic for you, if you leave the source untouched
for some weeks.

> \defineenumeration
>   [theorem]
>   [
> text=Theorem,
> title=yes,
> width=fit,
> distance=0.2em,
> alternative=serried,
>   ]

At least, it would be better not to include a definition inside content
that seems to (or may) be grouped with braces.

BTW, it is exactly t

[NTG-context] command line arguments

2024-03-19 Thread Hraban Ramm
Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command line 
arguments.


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


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

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

\setuparranging[\Schema]

Find the full example attached, I call it like

context --autopdf=auto --arrange impositiontest.tex --schema=TRYPTICHON 
--numberofpages=32

Hraban
% context --autopdf=auto --arrange --arguments=schema=2\*4,pages=16

\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuppapersize[A9,landscape][A7,landscape]

\setuparranging[\Schema]

\setupbodyfont[ss,10pt]

\setuplayout[margin=0pt, width=fit, header=2.8ex, footer=2.8ex]
\setupalign[middle,hilo]
\setuppagenumbering [alternative=doublesided,location=footer]
\setupheadertexts[\CONTEXT\ imposition test]

\showframe
\setupbackgrounds [text][text][background=color,backgroundcolor=lightgray]

% Where the block of pages is placed on the sheet
% (relevant if there is space left over.)
\setuplayout [location=middle,marking=on]

\startbuffer[Fakepage]
\strut
\blank
\bold{[\Schema]}
\vfill
This is page \recurselevel
\vfill
\stopbuffer

\starttext
\dorecurse{\Pages}{\getbuffer[Fakepage]\page}
\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: Struggling with the distance and right margin text

2024-03-15 Thread Pablo Rodriguez via ntg-context
On 3/15/24 14:06, Ursula Hermann wrote:
> Dear List, 

Dear Ursula,

this might help you (it isn’t perfect, but you just seem to copy and
paste fragments from your source files):

  %\showframe\showstruts
  \mainlanguage[de-at]
  \setuppagenumbering[alternative=doublesided]
  \definemargindata  [MyInMargin][ininner]
  \definemarginframed[MyInMargin]
[topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
  \defineframed[topruletitle]
[width=max,
 frame=off,
 topframe=on,
 rulethickness=1pt,
 align={justify},
 extras=\dontleavehmode]
  \starttext
  \topruletitle{\MyInMargin {1.1.1}\bf
  Beispiel 3.2.17. (Vertauschung von All- und Existenzquantor).} \par
  \input knuth\page

  \topruletitle{\MyInMargin{3.2.22}{\bf
  Theorem 3.2.22 (Rechenregeln für Quantoren)}. Seien \m P(\m x)und
\input zapf b}
  \stoptext

Sorry for saying that again, but please elaborate both your minimal
samples and your descriptions of the issues you are experiencing.

Some comments on the code fragments you sent.

First of all, please include always code that can be compiled simply
after being copied and pasted.

This requires \starttext (most of the time) and \stoptext (mandatory to
avoid stupid errors).

> \definepapersize[MyBook][width=19cm,height=29.7cm]
> \setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook
> %\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
> \setupbodyfont[modern, 12.50pt]

If these lines are irrelevant for the issue you are experiencing, please
don’t include them.

> \definemargindata  [MyInMargin][inleft]
> \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]

You define this margin framed, but your sample makes no use of it.

Sorry, but I don’t get it.

> \defineenumeration
>   [theorem]
>   [
>     text=Theorem,
>     title=yes,
>     width=fit,
>     distance=0.2em,
>     alternative=serried,
>   ]
> \definetextbackground[GrayBackground][
>   location=paragraph,
>   background=color,
>   backgroundcolor=lightgray,
>   leftoffset=.5\bodyfontsize,
>   rightoffset=.5\bodyfontsize,
>   topoffset=.5\bodyfontsize,
>   bottomoffset=.5\bodyfontsize,
>   frame=off,]
>   \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
>   \blackrule[color=black, height=0.10ex, width=13.50cm]

If your sample includes no theorem or text background, please remove
these definitions when sending code.

BTW, avoid include text content (such as margin and body rules [but not
their definitions]) before \starttext.

Also, use \clrf instead of \\ (since the mailing list displays the
relevant line as ("\" instead of "\\"):

>   \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\}

Here starts your text:

> \starttext
> \margintext {1.1.1}
> {\bf Beispiel 3.2.17. (Vertauschung von All- und Existenzquantor).} \par

Your margin text is undefined. Your code has a defined margin text
command, but it isn’t used.

> So  I have here an example from the second page: 

Sorry, but I’m having the impression you are using ConTeXt as a kind of
command-based DTP software (which I think it isn’t at all).

Or, do you define commands for each page?

I think it is better to define a single margin text command and use a
doublesided page setup.

> \definemargindata[inrightmargin][right][margin=margin,width=.50em\rightmarginwidth,style=,color=]
> \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt, 
> width=.90cm]

Again, margin text commands defined, but never used.

> \blackrule[color=black, height=0.10ex, width=13.40cm]
> {\blackrule[color=black, height=0.10ex, width=1cm, distance=.90cm]\par

Here you open a brace that is not closed at all.

At least, consider that this won’t be extremely readable for other
people (this is only a sample).

It also may be problematic for you, if you leave the source untouched
for some weeks.

> \defineenumeration
>   [theorem]
>   [
>     text=Theorem,
>     title=yes,
>     width=fit,
>     distance=0.2em,
>     alternative=serried,
>   ]

At least, it would be better not to include a definition inside content
that seems to (or may) be grouped with braces.

BTW, it is exactly the same definition as the one included before.

It isn’t just to be removed in minimal samples, your final code doesn’t
need the duplicated command definition.

> \inright{3.2.22}
> {\bf Theorem 3.2.22 (Rechenregeln für Quantoren)}. Seien \m P(\m x)und 
>
> My problem here is that there is not the same distance between the  the
> text and the  margintext .

Please, always compile the minimal samples that you send to the list.

This is simply to ensure other list subscribers will get the same
results as you.

After adding a final \stoptext command, I had to run:

  mtxrun --script check source-sample.tex

This allowed me to sp

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

2024-03-15 Thread Ursula Hermann
Dear List,



On the first page I had this example:
\definepapersize[MyBook][width=19cm,height=29.7cm]
\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook 
%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
\setupbodyfont[modern, 12.50pt]
\definemargindata  [MyInMargin][inleft]
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\definetextbackground[GrayBackground][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.5\bodyfontsize,
  rightoffset=.5\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off,]
  \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
  \blackrule[color=black, height=0.10ex, width=13.50cm]
\starttext
\margintext {1.1.1}
{\bf Beispiel 3.2.17. (Vertauschung von All- und Existenzquantor).} \par


So  I have here an example from the second page:


\definemargindata[inrightmargin][right][margin=margin,width=.50em\rightmarginwidth,style=,color=]

\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt, 
width=.90cm]
\blackrule[color=black, height=0.10ex, width=13.40cm]
{\blackrule[color=black, height=0.10ex, width=1cm, distance=.90cm]\par
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\inright{3.2.22}
{\bf Theorem 3.2.22 (Rechenregeln für Quantoren)}. Seien \m P(\m x)und

My problem here is that there is not the same distance between the  the text 
and the  margintext .

And now the margintext should be on the right side.

So maybe someone could help me please.
Many thanks.



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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Max Chernoff
Hi all,

Often I want to include a sentence/paragraph in the middle of a long
multipart formula. With the old \startalign/\stopalign formulas, I could
use \intertext{...} to do this, but this doesn't work with the new
\alignhere/\breakhere formulas. I've managed to find a "solution" for
this, although I'd prefer something a bit less hacky. Any ideas?

Also, is there a way to highlight an equation across an \alignhere? Once
again, I've found a "solution", but like before, it's pretty hacky.

Example files are attached.

Thanks,
-- Max
\setupindenting[yes, 3em]
\setuphead[section][page=yes]

\unprotect
\newbox\intertext_tmp_box
\newdimen\intertext_tmp_dimen

\starttexdefinition protected newintertext #1
\texthere[left]{
\setbox\intertext_tmp_box=\hbox{
\startframedtext[
offset=none,
width=\hsize,
frame=off,
]
\parindent = \v_spac_indentation_normal
\noindent
#1
\stopframedtext
}
\global\intertext_tmp_dimen = \ht\intertext_tmp_box
\vbox to 0pt{
\vskip\dimexpr 1ex - \baselineskip \relax
\box\intertext_tmp_box
\vss
}
\aftergrouped{
\aftergrouped{
\vadjust{
\penalty 1
\vskip\dimexpr \intertext_tmp_dimen - \baselineskip \relax
}
}
}
}
\breakhere
\stoptexdefinition
\protect

\starttext
\section{Old alignment}
\samplefile{knuth}
\placeformula\startformula\startalign
\NC \text{something} + \text{really} + \text{really} + \text{long} \NC= \sqrt{x} \NR[+]
\intertext{\samplefile{knuth}}
\NC d \NC= e + f \NR[+]
\NC g \NC= h + i
\stopalign\stopformula
\samplefile{knuth}


\section{“I expect to see \tex{noalign} only after the \tex{cr} of an alignment.”}
\starttyping
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere \breakhere
\intertext{\samplefile{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}
\stoptyping


\section{Alignment not kept}
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere
\stopformula
\samplefile{knuth}
\startformula
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}


\section{My hack}
\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} \alignhere= \sqrt{x} \numberhere \breakhere
\newintertext{\samplefile{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i
\stopformula
\samplefile{knuth}
\stoptext
\unprotect
\newbox\hightlight_tmp_box

\definemathframed[_highlight][
location=mathematics,
frame=off,
background=color,
backgroundcolor=lightred,
backgroundoffset=0.25ex,
]

\tolerant\def\highlighthere#1\alignhere#2#3\breakhere{%
\setbox\hightlight_tmp_box=\hbox{%
\m{%
\forcedisplaymath%
#1#2\null%
}%
}%
\alignhere%
\phantom{%
\null#2\null%
}%
\mskip -8mu%
\hskip -\wd\hightlight_tmp_box%
\lower 1ex \hbox{%
\_highlight[
loffset=\wd\hightlight_tmp_box,
location=keep
]{%
\hskip -\wd\hightlight_tmp_box%
\forcedisplaymath%
#1#2#3%
}%
}%
\breakhere%
}
\protect

\starttext
\startformula
a \alignhere= b + c \breakhere
\highlighthere d + e \alignhere= f \breakhere
g \alignhere= h + i
\stopformula
\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 do this?

2024-03-08 Thread Otared Kavian
Hi Ursula,

The reason for which you did not get the expected result is that you have « } » 
missing in your file, that is the closing brace after your italic command
« {\it » at the end of your document. 
Moreover you did not have a \stoptext in your file, and a math command « \m » 
was not written correctly. Talking of math, I personnaly prefer to enclose 
in-line math between dollar signs $, that is writing « $\exists x \in H$ » 
instead of  « \m{\exists x \in H} ».

Also the way you write your text is somewhat « incorrect » (or as Mikael 
Sundqvist would put it, « interesting »…), since in principle all the setups 
and definitions must be before the body of your document which begns with 
\starttext. Another point i sthat instead of using \par you can leave a blank 
line, which makes the document more readable. And you don’t need to break the 
lines by « hand », since ConTeXt does it in a better way.
Finally instead of 
\blackrule[color=black, height=0.10ex, width=13.50cm]
you can use just \hairline, and the thickness and color of such a \hairline can 
be adjusted by 
\setupthinrules[rulethickness=4pt,color=darkgreen]
(for instance), which should be put before \starttext.

Best regards: Otared

% begin textbackground-Ursula.tex
\definetextbackground[myBG][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.8\bodyfontsize,
  rightoffset=.8\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off]

\setupnarrower[left=0.80cm, right=0.80cm]
\definehspace[oneem][0.5em]
\setupinteraction
   [state=start,
color=blue]

\usecolors[svg]
\setupinteraction
  [state=start,
   contrastcolor=cornflowerblue]
   
   
\starttext
\margintext {1.1.1} {\bf Beispiel 3.2.17 (Vertauschung von All- und 
Existenzquantor).}

{\it Sei M die Menge aller Männer und F die Menge aller Frauen. Die Aussage 
h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen machen Sie sich 
die Bedeutung der beiden Aussagen klar.}

\startitemize[n,packed,broad]
\item \m{\forall m ∈ M : ∃f ∈ F : h(m, f)}  

\item $∃f ∈ F : ∀m ∈ M : h(m, f)$.

\stopitemize


\startmyBG
Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass
ein $∃\forall∀ $ oder ein $\forall∀\m∃$ versteckt ist. Dann ist es besonders 
wichtig, die
Formulierung sehr lange zu prüfen und eventuell auch formalisiert
noch einmal aufzuschreiben.”
\blank

\startnarrower[left, right]

Der\hspace[oneem] Wert \hspace[oneem] von \hspace[oneem] 
\m{y = f(x)} ist unabhängig von der Wahl

von \m{x\doubleprime} ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} 

(Beutelspacher [10, S.54])

\blank
\stopnarrower
\stopmyBG


\blank

\blackrule[color=black, height=0.10ex, width=13.50cm]

\reference[Regel:1]{3.1}

{\bf Aufgabe 3.2.18} Formulieren Sie gemäß der Regel (\goto{3.1}[Regel:1]) 
äquivalent

\startitemize[n,packed,broad]

\item \m{\forall n \in \naturalnumbers\mtp{:} n^2 > n \implies n > 1},

\item \m{\forall n \in \naturalnumbers\mtp{:} 3\divides n \implies 4 \divides 
n},

\item \m{\forall n \in \naturalnumbers\mtp{:} n^3 \mtext{ ungerade }\nospace
\implies n \mtext{ ungerade}}.

\stopitemize

\blackrule[color=black, height=0.10ex, width=13.50cm]

{\bf Aufgabe 3.2.19} Bilden Sie die Verneinung der folgenden Aussagen:

\startitemize[n,packed,broad]
\item Alle Rosen sind verwelkt oder teuer.

\item Alle rosen sind entweder verwelkt oder teuer.

\stopitemize


\reference[Abschnitt:1]{3.2.1.1}

{\it Hinweis: Beachten Sie die Konvention aus Abschnitt 
\goto{3.2.1.1}[Abschnitt:1] die Formulierung \quotation {entweder ... oder} 
entspricht dem ausschließenden Oder
und die Formulierung \quotation{oder} dem (mathematischen) einschließenden
Oder.}

\blackrule[color=black, height=0.10ex, width=13.50cm]

\stoptext
% end textbackground-Ursula.tex


> On 6 Mar 2024, at 13:52, Ursula Hermann  wrote:
> 
> Dear List,
> I need a tip how to do this:
> In the command \definepapersize[Mybook] the height should be not 24 cm, but a 
> little bit longer. My Problem is, as you can see on the PDF, that there are 
> troubles with the Gray Background. The Gray Background should begin with : 
> Mitunter. . I think it should be the topoffset, and the bottomoffset, but how 
> many .\bodyfontsize should I try?
> Many thanks 
> Uschi 
> \mainlanguage[de]
> \definepapersize[MyBook][width=19cm,height=24cm]
> \setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook 
> %\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
> \setupbodyfont[Times New Roman,12.55pt]
> \definemargindata  [MyInMargin][inright]
> \definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
> \defineenumeration
>   [theorem]
>   [
> text=Theorem,
> title=yes,
> width=fit,
> distance=0.2em,
> alternative=serried,
>   ]
> \definetextbackground[GrayBackground][
>   location=p

[NTG-context] How can I do this?

2024-03-06 Thread Ursula Hermann
Dear List,
I need a tip how to do this:
In the command \definepapersize[Mybook] the height should be not 24 cm, but a 
little bit longer. My Problem is, as you can see on the PDF, that there are 
troubles with the Gray Background. The Gray Background should begin with : 
Mitunter. . I think it should be the topoffset, and the bottomoffset, but how 
many .\bodyfontsize should I try?
Many thanks
Uschi
\mainlanguage[de]
\definepapersize[MyBook][width=19cm,height=24cm]
\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook 
%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
\setupbodyfont[Times New Roman,12.55pt]
\definemargindata  [MyInMargin][inright]
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\definetextbackground[GrayBackground][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.8\bodyfontsize,
  rightoffset=.8\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off,]
  \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
  \blackrule[color=black, height=0.10ex, width=13.50cm]
\starttext
\margintext {1.1.1} {\bf Beispiel 3.2.17 (Vertauschung von All- und 
Existenzquantor).}
\par {\it Sei M die Menge aller Männer und F die Menge aller Frauen. Die 
Aus-\par
sage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen machen Sie 
sich die Bedeutung der beiden Aussagen klar.}
\par
\startitemize[n,packed,broad]
\item \m{\forall m ∈ M : ∃f ∈ F : h(m, f)}  \item ∃f ∈ F : ∀m ∈ M : h(m, f).
\stopitemize
\startGrayBackground
\tf Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass
ein \m ∃\forall∀ oder ein \m \forall∀\m∃ versteckt ist. Dann ist es besonders 
wichtig, die
Formulierung sehr lange zu prüfen und eventuell auch formalisiert
noch einmal aufzuschreiben.”
\blank
\setupnarrower [left=0.80cm, right=0.80cm]
\startnarrower[left, right]
\definehspace[oneem][0.5em]
Der\hspace[oneem] Wert\hspace[oneem] von\hspace[oneem] \m{y = f(x)} ist 
unabhängig von der Wahl\\
von \m{x\doubleprime} ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} \\ 
(Beutelspacher [10, S.54])\par
\blank
\stopnarrower
\stopGrayBackground
\blank
\blackrule[color=black, height=0.10ex, width=13.50cm]
\setupinteraction
   [state=start,
color=blue]
\reference[Regel:1]{3.1}\par
{\bf Aufgabe 3.2.18} Formulieren Sie gemäß der Regel (\goto{3.1}[Regel:1]) 
äquivalent
\startitemize[n,packed,broad]
\item \m{\forall n \in \naturalnumbers\mtp{:} n^2 > n \implies n > 1},\item 
\m{\forall n \in \naturalnumbers\mtp{:} 3\divides n \implies 4 \divides 
n},\item \m{\forall n \in \naturalnumbers\mtp{:} n^3 \mtext{ ungerade }\nospace
\implies n \mtext{ ungerade}}.
\stopitemize
\blackrule[color=black, height=0.10ex, width=13.50cm]\par
{\bf Aufgabe 3.2.19} Bilden Sie die Verneinung der folgenden Aussagen:
\startitemize[n,packed,broad]
\item Alle Rosen sind verwelkt oder teuer.
\item Alle rosen sind entweder verwelkt oder teuer.
\stopitemize
\par
\usecolors[svg]
\setupinteraction
  [state=start,
   contrastcolor=cornflowerblue]
\reference[Abschnitt:1]{3.2.1.1}
{\it Hinweis: Beachten Sie die Konvention aus Abschnitt \goto 
{3.2.1.1}[Abschnitt:1]die For-\par
mulierung \quotation {entweder ... oder} entspricht dem ausschließenden Oder\par
und die Formulierung \quotation{oder} dem (mathematischen) einschließenden\par
Oder.\par
\blackrule[color=black, height=0.10ex, width=13.50cm]



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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] Wiki page : Mixed languages sample (French, Ancient Greek, Arabic, Chinese)

2024-03-01 Thread Jean-Pierre Delange

Dear List,

Several years ago I tried to write documents, mainly lectures, but also 
essays, in which I tried to make several languages (Romance and 
non-Romance) coexist.
Here below is an example of an attempt to compose an acceptable 
document, in the form of an exercise in which Arabic and Chinese are 
introduced into a document written in French. With footnotes and a few 
framed lines.


I submit this example for your perusal and ask you whether it could 
possibly appear on a wiki page devoted to the combination of 
non-European languages in the same text. In English translation, of course.


%We are giving below an example of a text written in a Latin language, 
in which we want to print here and there some text in ancient Greek, 
Arabic and Chinese.


\setuplanguage[fr][patterns={fr,agr}]

\mainlanguage[fr]

\setuplayout [backspace=40mm]

\setuppagenumbering[alternative=doublesided, location={header, inmargin}]

\setupmargindata[inmargin][location=inner, 
style={\ssx\setupinterlinespace[line=2.8ex]}]


\setupmarginframed[inmargin][align=right]

\setupbodyfontenvironment[default][em=italic]

% Use Theano Didot as Ancient Greek font

\definefallbackfamily[mainface][serif][Theano Didot][preset=range:greek, 
it={Old Standard Italic}, force=yes]


% Choose between Ipaexmincho font and NotoSansTC (Traditional Chinese)

%\definefallbackfamily [mainface] [rm] [ipaexmincho] 
[range=cjkunifiedideographs]


\definefallbackfamily [mainface] [rm] [notosanstc] 
[range=cjkunifiedideographs]


% Choose between two Arabic fonts

%\definefallbackfamily[mainface] [serif] [nafeesnastaleeq] [range=arabic]

\definefallbackfamily[mainface] [serif] [hussaininastaleeq] [range=arabic]

\definefontfamily [mainface] [serif] [GaramondNo8][sc=NewG8 Regular SC]

\definefontfamily [mainface] [sans] [FreeSans] [rscale=0.7]

\definefontfamily[mainface] [serif] [GFS Didot]

\setupbodyfont[mainface]

\setupindenting[1.5em]

\setupindenting[yes]

\setupcolors[state=start]


\defineframedtext

[MyFrame]

[before={\blank},

after={\blank},

frame=off,

background=MyFrame,

%width=\textwidth,

width=max,

height=fit,

style=italic]


\definelabel

[Définition]

[headstyle=\bf\smallcaps]


\startuseMPgraphic{MyFrame}

path b;

picture p;

%p := textext.rt("\white\Définition");

p := textext.rt("\white\framedtextparameter{Title}");

%p := textext.rt("\white\getvariable{text}{text1}");

p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);

b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;

fill OverlayBox withcolor lightgray; %\MPcolor{

fill b withcolor darkred;

draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor

darkred;

draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor

darkred;

draw p;

setbounds currentpicture to boundingbox currentpicture enlarged 2mm;

\stopuseMPgraphic


\defineoverlay

[MyFrame]

[\useMPgraphic{MyFrame}]



\setupwhitespace[medium]

\setupinterlinespace[line=3.2ex]


\setupitemize[each][margin=yes]


\setuphead[title][header=empty]


\setupheader[style={\sc}]

\setupfooter[style={\itxx}]

\setupheadertexts[Utilisation de plusieurs langues dans un même texte 
avec \ConTeXt][][][{\getmarking[section]}]


\setupfootertexts[][][][© J.-P. Delange, 2016 — La reproduction de ce 
texte est soumise à autorisation.]


\defineparagraphs[TwoColumns][n=2, align={hz, hanging}]

\setupparagraphs[TwoColumns][1][width=210pt, style=rm, align=left]

\starttext

\title{\ConTeXt, ou comment imprimer des langues non-romanes}

\section {\sc Préambule}


Lorsqu'il s'agit de proposer un document dans une langue nationale (le 
français), tout va bien. Lorsqu'il s'agit de rédiger en français un 
document un peu complexe, avec des citations — ou des références — dans 
une autre langue, qui en particulier n'a pas les mêmes exigences que le 
français, ni les mêmes {\em signes diacritiques} on se heurte à quelques 
difficultés. Les suites logicielles comme Microsoft Office ou 
LibreOffice ne manquent pas de puissance, mais à vrai dire, dès que nous 
entrons dans les exigences de l'édition professionnelle, qui consistent 
à présenter un texte lisible et enrichi (en notes, etc.), la situation 
devient vite techniquement assez pénible. La situation la plus courante 
que nous rencontrons dans les Lettres, en Philosophie, en Histoire, et 
plus généralement dans les Humanités, est celle d'un texte dans lequel 
il y a des citations d'auteurs grecs ou latin, avec des références en 
notes de bas de page, qui contiennent du grec. Cela pourrait être 
quelque chose comme ceci :


\blank\startnarrower[1*left,1*right]\tfx\setupinterlinespace

\noindent \quotation{Ἔφη γάρ οἱ Σωκράτη ἐντυχεῖν λελουμένον τε καὶ τὰς 
βλαύτας ὑποδεδεμένον, ἃ ἐκεῖνος ὀλιγάκις ἐποίει· καὶ ἐρέσθαι αὐτὸν ὅποι 
ἴοι οὕτω καλὸς γεγενημένος. καὶ τὸν εἰπεῖν ὅτι· Ἐπὶ δεῖπνον εἰς 
Ἀγάθωνος. χθὲς γὰρ αὐτὸν διέφυγον τοῖς ἐπινικίοις, φοβηθεὶς τὸν ὄχλον· 
ὡμολόγησα δ᾽ εἰς τήμερον παρέσεσθα

[NTG-context] Works now! At Work, and a question to paragraphs in an Theorem

2024-02-27 Thread Ursula Hermann
Dear List,

At Work everything works fine now. Many thanks for those, who have written me.

I have a question to my paragraphs:

\definetextbackground[Paragaph][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.5\bodyfontsize,
  rightoffset=.5\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off,]
  \startparagraph
\starttext
Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass ein 
\m{∃\forall} oder ein \m{\forall\m∃} versteckt ist. Dann ist es besonders 
wichtig, die Formulierung sehr lange zu prüfen und eventuell auch formalisiert 
noch einmal aufzuschreiben.”
\blank
Der Wert von \m{y = f(x)} ist unabhängig von der Wahl\par von \m{x\doubleprime} 
ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} \par (Beutelspacher [10, S.54]).
\stopparagraph
\stoptext

So this is the example. What I like to do: The first paragraph should be normal 
written, but the second one should have more space between the words. Because 
of Math: Is \hspace the right way? The right command? And using \startnarrower, 
\stopnarrower?

Many thanks

Uschi

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

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


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

2024-02-22 Thread Henning Hraban Ramm

Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of course has to 
document it.


This is nice.
Thank you, will do.

(Actually I’m not much interested in dashed borders but to have lines 
affected by my sketchy style - courtesy of Aditya et al., see below)


Taco, will the syntax pages in the wiki update automatically to a newer 
version?



"""
\startuseMPgraphic{mp:sketchy}
input mp-sketch.mp;
sketchypaths;

sketch_amount := 1 + (uniformdeviate 2);
sketch_passes := 3;
sketch_segments := 2 + (uniformdeviate 3);
sketch_length := OverlayWidth / 3;

draw topboundary withpen pensquare withcolor lightgray;
naturalizepaths;
\stopuseMPgraphic

\defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}]

\setupTABLE[r][first][style=bold]
\setupTABLE[r][each][
topoffset=1em,bottomoffset=0.5em,
    background=sketchylines,
% would be nice if the background wouldn’t start at each column
]
\setupTABLE[c][each][frame=off]
\bTABLE[]
\bTR
\bTD{Stadt}\eTD
\bTD{Land}\eTD
\bTD{Fluss}\eTD
\eTR
\dorecurse{10}{
\bTR
\bTD\strut \eTD\bTD \eTD\bTD \eTD
\eTR
}
\eTABLE
"""


Hraban%D \module
%D   [   file=mp-sketch.mp
%Dversion=2021.05.13
%D  title=\CONTEXT\ \METAPOST\ graphics,
%D   subtitle=Sketch drawing,
%D author=Aditya Mahajan,
%D   date=\currentdate,
%D  copyright={Aditya Mahajan}]

%D This metapost module is inspired by a TeX.SE question:
%D http://tex.stackexchange.com/q/39296/323
%D
%D I thought that it would be fun to implement a similar feature in MetaPost.
%D
%D To use this package in MetaPost:
%D
%D \starttyping
%Dinput mp-sketch;
%D
%Dbeginfig(1)
%D  sketchypaths; % Make draw and fill sketchy
%D  ...
%D  naturalizepaths; % Restore the value of draw and fill
%D  ...
%Dendfig
%D \stoptyping
%D
%D The code is heavily inspired by Hans Hagen's Metafun macros.
%D
%D The macro \type{sketchypaths} is modeled after \type{visualizepaths} from
%D \filename{mp-tool}.

def sketchypaths =
let draw = sketchdraw ;
let fill = sketchfill ;
enddef ;

%D Check if \filename{mp-tool} is loaded
if not known context_tool :
  let normaldraw = draw;
  let normalfill = fill;

  def naturalizepaths =
  let fill = normalfill ;
  let draw = normaldraw ;
  enddef ;
fi

%D The variable \type{sketch_amount} determines the amount of randomness in the
%D drawing
numeric sketch_amount; sketch_amount := 0.75bp;

%D The variable \type{sketch_passes} determines the number of times the path
%D is drawn
numeric sketch_passes; sketch_passes := 1;

%D Based on \type{randomized}. Assumes p is path:
numeric sketch_segments; sketch_segments := 20;

%D Length (time) of line segments:
numeric sketch_length; sketch_length := 5mm;

primarydef p sketchrandomized s = (
if path p :
for t = 0 step 1/sketch_segments until 1-1/sketch_segments :
((point   (t*arclength(p)) on p) 
randomshifted s) .. controls
((postcontrol (t*arclength(p)) on p) 
randomshifted s) and
((precontrol  ((t+1/sketch_segments)*arclength(p)) on p) 
randomshifted s) ..
endfor
% TODO: beide Ansätze kombinieren. Eckpunkte erhalten!

%for t = 0 step sketch_length until arclength p:
%  (point (arctime t of p) of p) randomshifted s ..
%endfor
if cycle p : % funktioniert nicht
  cycle
else :
  ((point   (arclength(p)) on p) randomshifted 
s)
  %(point (arctime t of p) of p) randomshifted s
fi
else :
p
fi
) enddef ;



%D The macro \type{sketchdraw} draws the randomized path. The
%D \type{expr} ... \type{text} trick is copied from the definition of
%D \type{drawarrow}
def sketchdraw expr p =
   do_sketchdraw(p)
enddef;

def do_sketchdraw(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normaldraw p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normaldraw p t;
  fi
enddef;

%D The macro \type{sketchfill} randomizes the path before filling it.
def sketchfill expr p =
  do_sketchfill(p)
enddef ;

def do_sketchfill(expr p) text t =
  if (path p) :
  for i = 1 upto max(1,sketch_passes) :
normalfill p
   sketchrandomized sketch_amount
   withtransparency ("multiply", 1/max(1,sketch_passes))
   t ;
  endfor;
  else :
  normalfill p t;
  fi
enddef;

picture NoisePattern;
NoisePattern := image(
  pickup pencircle xyscaled 0.5bp;
  numeric pmax ; pmax := 7 ;
  numeric x ; numeric y ;
for i = 1 upto pmax:
for j = 1 upto pmax:
  

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

2024-02-22 Thread Hans Hagen via ntg-context

On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:

Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can 
show me a better way…


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

   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic


Thank you!

(I’m sure I already used that somewhere… Must document…)
ok, new feature dedicated to Hraban ... who then of courese has to 
document it.


\starttext

\starttabulate
\FL[1,2] % linefactor (old) dashfactor (new)
\NC test \NC test and test and test and done \NC \NR
\ML[1,1]
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\LL[1,10]
\stoptabulate

\framed
  [align=middle,topframe=dash,frame=off]
  {\samplefile{tufte}}

\framed
  [align=middle,
   frame=dash,
   dashstep=.01hs,
   rulethickness=1pt]
  {\samplefile{tufte}}

\framed
  [align=middle,
   frame=dash,
   dashstep=10pt,
   rulethickness=2pt,
   background=color,
   backgroundcolor=gray]
  {\samplefile{tufte}}

\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] Re: MetaPost lines in tables?

2024-02-21 Thread Henning Hraban Ramm

Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can 
show me a better way…


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

   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic


Thank you!

(I’m sure I already used that somewhere… Must document…)

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: MetaPost lines in tables?

2024-02-21 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 21.02.2024 um 19:04:

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

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


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


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


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

\stopuseMPgraphic

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

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

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


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

\stopuseMPgraphic

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


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

  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

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

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


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

2024-02-21 Thread Henning Hraban Ramm

Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

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


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


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


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

\stopuseMPgraphic

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

\starttext

\bTABLE[frame=off,background=dottedborder]


Thank you!

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


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

\stopuseMPgraphic

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


My real life example (p.2 in https://yemaya.fiee.net/s/DEEHs5m49yftiqW) 
involves sketchy lines, and there it’s a bit annoying that the row is 
not its own frame that could get a continuous background… Well, it’s 
good enough, I’ll settle for it.


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

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


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

2024-02-19 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:

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


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


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


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

\stopuseMPgraphic

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

\starttext

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

\stoptext
 end example

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

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


[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
Thanks Mikael. This helped indeed.
I updated my example on the Metapost page in the wiki accordingly.

The`pagestate=start` functionality is not documented in the wiki. It's not 
clear for which context commands it can or should be used. Who is willing to 
help out here?
Best regards
Emanuel
On Feb. 19 2024, at 2:39 pm, Mikael Sundqvist  wrote:
> Hi,
>
> Try
> \startTEXpage[pagestate=start]
> /Mikael
> On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
>  wrote:
> >
> >  I just made a strange observation in the output pdf of the attached 
> > layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> > macos preview and showing miniatures, all pages except the last one show 
> > page number 1 (the last showing page number 2).
> >
> > Which was not the case with the output pdf of the attached 
> > multipage_metapost_mwe-very_simple.tex.
> >
> > How can I change my code to have proper consecutive page numbering in a pdf 
> > viewer?
> >
> > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
> >  wrote:
> >
> > I think I could solve all the problems. Attached the finalized working 
> > example. I created the 
> > https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages 
> > entry with it. Feel free to modify.
> >
> > Cheers
> > Emanuel
> >
> > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> >
> > Hi,
> >
> > not sure I get what you are missing. But you can try
> >
> > setbounds currentpicture to (fullsquare scaled 200) ;
> >
> > in base. And then do
> >
> > \dorecurse{5}{
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset#1}
> > \stopTEXpage
> > }
> >
> > if that is the looping you are after.
> >
> > /Mikael
> >
> > On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Resp. the solution should be such that each generated PDF page has the 
> > > same dimension, the same background colour and a page number and the 
> > > metapost content on each page has the same scaling factor.
> > >
> > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > >
> > > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > > because I need page numbering inside the MPpage, as done with draw 
> > > textext(decimal(currentime)).
> > >
> > > So, how can I use the \useMPgraphic{layerset1} etc. inside the 
> > > \dorecurse, assuming I name my layersets "layerset1", "layerset2", 
> > > "layerset3" etc.?
> > >
> > > Emanuel
> > >
> > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > > thanks a lot!
> > > this seems to be the solution! And it looks beatiful enough to me 
> > > I'll try to port all my layers to this new method and see if I run into 
> > > new problems again 
> > >
> > > Emanuel
> > >
> > >
> > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > >
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3"

[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Mikael Sundqvist
Hi,

Try

\startTEXpage[pagestate=start]

/Mikael

On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
 wrote:
>
>  I just made a strange observation in the output pdf of the attached 
> layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> macos preview and showing miniatures, all pages except the last one show page 
> number 1 (the last showing page number 2).
>
> Which was not the case with the output pdf of the attached 
> multipage_metapost_mwe-very_simple.tex.
>
> How can I change my code to have proper consecutive page numbering in a pdf 
> viewer?
>
> On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
>  wrote:
>
> I think I could solve all the problems. Attached the finalized working 
> example. I created the 
> https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
> with it. Feel free to modify.
>
> Cheers
> Emanuel
>
> On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
>
> Hi,
>
> not sure I get what you are missing. But you can try
>
> setbounds currentpicture to (fullsquare scaled 200) ;
>
> in base. And then do
>
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
>
> /Mikael
>
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn i

[NTG-context] Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
 I just made a strange observation in the output pdf of the attached layer_set.tex, which is that when opening it with a pdf viewer like skim or macos preview and showing miniatures, all pages except the last one show page number 1 (the last showing page number 2). Which was not the case with the output pdf of the attached multipage_metapost_mwe-very_simple.tex. How can I change my code to have proper consecutive page numbering in a pdf viewer?On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context  wrote:I think I could solve all the problems. Attached the finalized working example. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry with it. Feel free to modify.CheersEmanuelOn Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:Hi,not sure I get what you are missing. But you can trysetbounds currentpicture to (fullsquare scaled 200) ;in base. And then do\dorecurse{5}{\startTEXpage[offset=1DK]\useMPgraphic{layerset#1}\stopTEXpage}if that is the looping you are after./MikaelOn Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context wrote:>> Resp. the solution should be such that each generated PDF page has the same dimension, the same background colour and a page number and the metapost content on each page has the same scaling factor.>> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,>> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), because I need the "setbounds currentpicture to TheFrame" and also because I need page numbering inside the MPpage, as done with draw textext(decimal(currentime)).>> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?>> Emanuel>> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,> thanks a lot!> this seems to be the solution! And it looks beatiful enough to me > I'll try to port all my layers to this new method and see if I run into new problems again >> Emanuel>>> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:>> Hi>> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context>  wrote:> >> > Dear list,> >> > the attached .tex file is the minimal working example we discussed today in the online meeting.> >> > I realized that the approach of looping through k of p[k] is not fitting my needs, because it's not flexible enough.> >> > I need another approach, one which works with layer sets.> >> > I would stop using p as an array, because with the layer sets approach we don't have a fixed order of the layers.> >> > So the definition of the layers would be something like> >> > picture layerA;> > layerA:=image(> > label("Word 1", z1);> > );> >> > picture layerW;> > layerW:=image(> > label("Mot 2", z2);> > );> >> > picture layerM;> > layerM:=image(> > label("Parola 3", z3);> > );> >> > picture layerC;> > layerC:=image(> > label("Wort 4", z3+z1);> > );> >> > picture layerY;> > layerY:=image(> > label("Nummer 5", z2+z3);> > );> >> > picture layerU;> > layerU:=image(> > label("number 6", z2+z1);> > );> >> > After that, I would define layer sets and layer subsets. This will be done manually for each layer set and each layer subset.> > I don't know the proper syntax to do that. Let's assume we could use a variable type called "myset".> >> > myset layersubsetGamma;> > layersubsetGamma:={layerU,layerM};> >> > In my logic, the layers will be drawn in the order of their appearance within the {}. In the example, drawn content of layerM might cover drawn content of layerU.> >> > Contrary to a layer subset, each layer set will result in a PDF page, and thus the layer sets are related to each other by an inner order. That's why I would use an array variable here with [].> >> > I don't know how to append a set. In the following example, I assumed there would be a function myappend(, )> >> > myset layerset[];> > layerset1 := {layerW,layerA};> > layerset2 := myappend{layerset1, layerY};> > layerset3 := myappend{layerset2, layersubsetGamma};> > layerset4 := myappend{layerset2, layerU};> > layerset5 := myappend{layerset4, layersubsetGamma};> >> > Finally, I would need each layerset[k] typeset on its own pdf page. And of course on each page k, only the layers which appear in the definition of the layerset[k] should be drawn on top of each other in the order as they appear in that definition.> >>

[NTG-context] Re: Working with layer sets with Metapost

2024-02-17 Thread Emanuel Han via ntg-context
I think I could solve all the problems. Attached the finalized working example. 
I created the 
https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
with it. Feel free to modify.

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> Hi,
>
> not sure I get what you are missing. But you can try
> setbounds currentpicture to (fullsquare scaled 200) ;
> in base. And then do
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
> /Mikael
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myapp

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Mikael Sundqvist
Hi,

not sure I get what you are missing. But you can try

setbounds currentpicture to (fullsquare scaled 200) ;

in base. And then do

\dorecurse{5}{
\startTEXpage[offset=1DK]
\useMPgraphic{layerset#1}
\stopTEXpage
}

if that is the looping you are after.

/Mikael

On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
 wrote:
>
> Resp. the solution should be such that each generated PDF page has the same 
> dimension, the same background colour and a page number and the metapost 
> content on each page has the same scaling factor.
>
> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
>
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
>
> Emanuel
>
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
>
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
>
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Resp. the solution should be such that each generated PDF page has the same 
dimension, the same background colour and a page number and the metapost 
content on each page has the same scaling factor.

On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> Emanuel
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3", z3);
> > > > );
> > > >
> > > > picture layerC;
> > > > layerC:=image(
> > > > label("Wort 4", z3+z1);
> > > > );
> > > >
> > > > picture layerY;
> > > > layerY:=image(
> > > > label("Nummer 5", z2+z3);
> > > > );
> > > >
> > > > picture layerU;
> > > > layerU:=image(
> > > > label("number 6", z2+z1);
> > > > );
> > > >
> > > > After that, I would define layer sets and layer subsets. This will be 
> > > > done manually for each layer set and each layer subset.
> > > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > > variable type called "myset".
> > > >
> > > > myset layersubsetGamma;
> > > > layersubsetGamma:={layerU,layerM};
> > > >
> > > > In my logic, the layers will be drawn in the order of their appearance 
> > > > within the {}. In the example, drawn content of layerM might cover 
> > > > drawn content of layerU.
> > > >
> > > > Contrary to a layer subset, each layer set will result in a PDF page, 
> > > > and thus the layer sets are related to each other by an inner order. 
> > > > That's why I would use an array variable here with [].
> > > >
> > > > I don't know how to append a set. In the following example, I assumed 
> > > > there would be a function myappend(,  > > > initial set should be appended with>)
> > > >
> > > > myset layerset[];
> > > > layerset1 := {layerW,layerA};
> > > > layerset2 := myappend{layerset1, layerY};
> > > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > > layerset4 := myappend{layerset2, layerU};
> > > > layerset5 := myappend{layerset4, layersubsetGamma};
> > > >
> > > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > > of course on each page k, only the layers which appear in the 
> > > > definition of the layerset[k] should be drawn on top of each other in 
> > > > the order as they appear in 

[NTG-context] Re: \startcolumns and \startcolumnset

2024-02-08 Thread Otared Kavian
Dear Dalyoung,Have you tried \startsimplecolumns\stopsimplecolumns instead of the columnset mechanism?In your example I put the above commands and I got the attached PDF: is this what you want to obtain?Best regards: Otared

columns-figures.pdf
Description: Adobe PDF document
On 9 Feb 2024, at 02:22, Jeong Dal via ntg-context <ntg-context@ntg.nl> wrote:Dear all,I have a little problem to use “columns” in the following example.If I use “\startcolumnset”, then I have the following problems:	1. The figures is aligned left even though I use \startplacefigure[].	2. In the second column, the first item located at the end of the page.However, \vfill works, so I managed the items evenly spaced vertically.If I use “\startcolumns”, then I have the following problems:	1. \vfill doesn’t works, but \blank[] works. So, it isn’t easy to locate the items evenly spaced vertically.Here are sample code and its outputs of two cases for comparison.Any suggestions are welcomed.Tomorrow is the New Years day in Lunar calendar.Happy new year, again.Best regards,Dalyoung%%%\startuseMPgraphic{mark}path p;p := unitsquare scaled 3cm;draw p;draw (point 0 of p)--(point 2 of p);draw (point 1 of p)--(point 3 of p);\stopuseMPgraphic\startuseMPgraphic{verticalrule3}   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: shifted(-2mm,0) fi ;   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: shifted(2mm,0) fi ; draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;\stopuseMPgraphic\defineoverlay  [verticalrule]  [\useMPgraphic{verticalrule3}]\setuppagenumbering[state=stop]\setupexternalfigures[location={local,defalut}]\definecolumnset  [quiz]  [n=2,background=verticalrule]\setupbodyfont[bonum, rm, 11pt]\starttext %\startcolumns[n=2,background="">\startcolumnset[quiz]\startitemize[n]  \item Solve the following linear equations.  \startitemize[r]\item equation%\blank[3.5cm]\vfill\item equation%\blank[3.5cm]\vfill\item equation\blank[3.5cm]\item equation\blank[3.5cm]\item equation\blank[3.5cm]  \stopitemize  \hrule\column  \item Draw the graph of the following linear function.\startitemize[r]\item $2x +3y = 6$\startplacefigure[location={here,none},]\useMPgraphic{mark}\stopplacefigure  \item $y = 2x - 1$  \startplacefigure[location={here,none}]\useMPgraphic{mark}\stopplacefigure\stopitemize  \item Find the formula of the line 1:  \vfill  \item Find the formula of the line 2:  \vfill\stopitemize\stopcolumnset\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.nlwebpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)archive  : https://github.com/contextgarden/contextwiki : https://wiki.contextgarden.net___
Otared Kaviane-mail: ota...@gmail.comPhone: +33 6 88 26 70 95

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] \startcolumns and \startcolumnset

2024-02-08 Thread Jeong Dal via ntg-context
Dear all,I have a little problem to use “columns” in the following example.If I use “\startcolumnset”, then I have the following problems:	1. The figures is aligned left even though I use \startplacefigure[].	2. In the second column, the first item located at the end of the page.However, \vfill works, so I managed the items evenly spaced vertically.If I use “\startcolumns”, then I have the following problems:	1. \vfill doesn’t works, but \blank[] works. So, it isn’t easy to locate the items evenly spaced vertically.Here are sample code and its outputs of two cases for comparison.Any suggestions are welcomed.Tomorrow is the New Years day in Lunar calendar.Happy new year, again.Best regards,Dalyoung%%%\startuseMPgraphic{mark}path p;p := unitsquare scaled 3cm;draw p;draw (point 0 of p)--(point 2 of p);draw (point 1 of p)--(point 3 of p);\stopuseMPgraphic\startuseMPgraphic{verticalrule3}   draw rightboundary OverlayBox shifted (1mm,0); %if CurrentColumn = 1: shifted(-2mm,0) fi ;   draw leftboundary OverlayBox shifted (-1mm,0); %if CurrentColumn = 2: shifted(2mm,0) fi ; draw bottomboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;   draw topboundary OverlayBox leftenlarged 1mm rightenlarged 1mm;\stopuseMPgraphic\defineoverlay  [verticalrule]  [\useMPgraphic{verticalrule3}]\setuppagenumbering[state=stop]\setupexternalfigures[location={local,defalut}]\definecolumnset  [quiz]  [n=2,background=verticalrule]\setupbodyfont[bonum, rm, 11pt]\starttext %\startcolumns[n=2,background="">\startcolumnset[quiz]\startitemize[n]  \item Solve the following linear equations.  \startitemize[r]\item equation%\blank[3.5cm]\vfill\item equation%\blank[3.5cm]\vfill\item equation\blank[3.5cm]\item equation\blank[3.5cm]\item equation\blank[3.5cm]  \stopitemize  \hrule\column  \item Draw the graph of the following linear function.\startitemize[r]\item $2x +3y = 6$\startplacefigure[location={here,none},]\useMPgraphic{mark}\stopplacefigure  \item $y = 2x - 1$  \startplacefigure[location={here,none}]\useMPgraphic{mark}\stopplacefigure\stopitemize  \item Find the formula of the line 1:  \vfill  \item Find the formula of the line 2:  \vfill\stopitemize\stopcolumnset\stoptext%%

testColumns.pdf
Description: Adobe PDF document


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

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


[NTG-context] Re: textbackground spacing offset

2024-01-31 Thread Hans Hagen

On 1/31/2024 7:15 PM, Marco Patzer wrote:

On Thu, 16 Nov 2023 13:52:05 +0100
Marco Patzer  wrote:


I'm having problems getting the textbackground spacing offset to work.
Example:

\setupframedtext
   [offset=overlay,
width=max,
depthcorrection=off]

\setuptextbackground
   [location=paragraph,
%% offset=overlay,   %% does nothing
%% backgroundoffset=overlay, %% does nothing
%% depthcorrection=off,  %% does nothing
%% topoffset=3mm,%% works, but only for positive values
background=,
frame=on]

\starttext
   \startframedtext
 \framed{Foo}
   \stopframedtext
   \starttextbackground
 \framed{Foo}
   \stoptextbackground
\stoptext

How do it get the same spacing as in the framedtext case?


Is there a solution to this? Or an explanation why the spacing
differs?
these are fundamentally different mechanisms .. you can play with 
\inframed in the second case


-
  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: textbackground spacing offset

2024-01-31 Thread Marco Patzer
On Thu, 16 Nov 2023 13:52:05 +0100
Marco Patzer  wrote:

> I'm having problems getting the textbackground spacing offset to work.
> Example:
> 
> \setupframedtext
>   [offset=overlay,
>width=max,
>depthcorrection=off]
> 
> \setuptextbackground
>   [location=paragraph,
>%% offset=overlay,   %% does nothing
>%% backgroundoffset=overlay, %% does nothing
>%% depthcorrection=off,  %% does nothing
>%% topoffset=3mm,%% works, but only for positive values
>background=,
>frame=on]
> 
> \starttext
>   \startframedtext
> \framed{Foo}
>   \stopframedtext
>   \starttextbackground
> \framed{Foo}
>   \stoptextbackground
> \stoptext
> 
> How do it get the same spacing as in the framedtext case?

Is there a solution to this? Or an explanation why the spacing
differs?

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: Chemnitz, Leipzig, Call for Poster

2024-01-10 Thread Henning Hraban Ramm

Am 10.01.24 um 08:00 schrieb juh via ntg-context:

Am Sun, Jan 07, 2024 at 09:59:14AM +0100 schrieb Henning Hraban Ramm:

I’d like to have a poster that shows off ConTeXt/MetaFun features.
Do you have suggestions or (even better) would you like to create it?
It would be nice to have for further events (last year I presented ConTeXt
at FrOSCon and CCCamp and lacked a poster).


I just submitted a talk about how we use Markdown, Pandoc and ConTeXt at
Hostsharing eG, so maybe we'll meet in Chemnitz.


Great! Then I can leave out this workflow and refer to your talk.


A poster would be nice. ConTeXt/MetaFun are overwhelmingly flexible and 
powerful. It is hard to come up with a good idea. Who is targeted?


At an open source fair or hacker meeting, the target groups seem to be
– IT people who use TeX to create PDFs of software documentation
– students/academics who use TeX for scientific work
– people who look for open source solutions to all kind of tasks (e.g. 
at FrOSCon I had a long conversation about creating genealogy trees, 
since GRAMPS’ are ugly)


There are also authors/selfpublishers/micropublishers, but these I meet 
at book fairs, not at open source conferences. For people who don’t know 
they might be happy with a “programming system” we’d need a different 
poster. (The LaTeX-based SPBuchsatz targets this clientele.)


I want to show a few interesting things that are possible with 
ConTeXt/MetaPost and a few basics how it works.


I guess I’ll use the “christmas card memory” patterns as a background 
(thanks, Hans!).


I tried to sketch the relationship of Lua/TeX/MetaPost in LuaMetaTeX and 
ConTeXt LMTX around it, with different inputs and PDF/XML output – don’t 
know yet how to make this easily understandable…



ConTeXt is interesting for people that want to

integrate a typesetting system in a publishing environment, because
ConTeXt does not stand in your way as LaTeX often do and has many
programming features (lua, xml ...) or

typeset very customized layouts.

These two target groups are very different. Integratable building blocks
for a complex publishing system or programmable layout machine – sorry, I am 
just
brainstorming, but I like the idea of a poster.


Well, I’m using ConTeXt to produce PDFs for very different books, 
magazines, invoices/letters, presentations, jam labels, t-shirt designs…


Not any more for interactive forms or shipping documents, because the 
projects have run out. And my online crossword puzzle generator (with 
ConTeXt and LaTeX output) doesn’t work anymore…


We know ConTeXt/MetaPost is used for stock reports (hi Ramkumar), 
calendars (hi Willi), more books and magazines, textbooks and other 
educational material (e.g. math4all), energy reports (French power 
plants and Hans’ heating), planning model railways & typesetting 
stitching patterns (hi Taco), art (e.g. Eçir Baff), …


In short: There aren’t only two groups, I guess.

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: multipage metapost output from ConTeXt

2024-01-06 Thread Emanuel Han via ntg-context
023 at 12:58 PM fv leung  wrote:
> > >
> > > You didn't specify the color of path A in p2 and p4. So it's drawn in 
> > > black.
> > > The other issue, I can't help.
> > >
> > > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> > >>
> > >> So is there a way to circumvent these issues? Or an explanation for this 
> > >> behavior, so that I can try to find a solution by myself?
> > >>
> > >> Thanks
> > >> Emanuel
> > >>
> > >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> > >>  wrote:
> > >>
> > >> Dear Aditya and Fabrice,
> > >> thanks for your responses.
> > >>
> > >> I included some of Fabrice's code into mine for testing purpose, and 
> > >> indeed the multipage works now.
> > >> What is bizarre is that issues appear now that didn't appear before:
> > >>
> > >> Path A is drawn with color red on page 1, and in color black on all 
> > >> following pages, while it should stay red.
> > >> textext(, ) is overwriting  with 
> > >> "T="(currentime) which has been used previously in textext() 
> > >> before the for k=1 endfor loop. This overwriting happens only for the 
> > >> first textext() which occurs inside the for k=1 endfor loop. All other 
> > >> textext() inside the for k=1 endfor loop are not drawn at all. If the 
> > >> line « draw textext("T="(currentime)) scaled 2 shifted(0,2in) 
> > >> withcolor magenta ; » is commented out, the first textext() inside the 
> > >> for k=1 endfor loop is not drawn neither. It must be an issue with 
> > >> textext(), because when I replace textext() by lmt_outline[], the text 
> > >> is drawn.
> > >>
> > >> Adjusted mwe:
> > >>
> > >> \enableregime[utf] % enable unicoded input
> > >>
> > >> \definefontfamily [RomanFont] [rm] [calluna]
> > >>
> > >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> > >>
> > >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> > >>
> > >> \definefontfeature
> > >> [fea]
> > >> [mode=node,language=dflt,script=arab,
> > >> init=yes,
> > >> medi=yes,
> > >> fina=yes,
> > >> isol=yes,
> > >> calt=yes,
> > >> rlig=yes,
> > >> tlig=yes,
> > >> trep=yes,
> > >> curs=yes,
> > >> kern=yes,
> > >> mark=yes
> > >> ]
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \usetypescript[serif][fallback]
> > >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> > >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> > >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> > >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [notonaskharabic]
> > >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] 
> > >> [default]
> > >> \stoptypescript
> > >>
> > >> \usetypescript[notonaskharabic]
> > >>
> > >> \setupbodyfont [RomanFont]
> > >>
> > >> \usecolors[crayola]
> > >>
> > >> \startMPinclusions
> > >>
> > >> picture p[];
> > >> path TheFrame ;
> > >> TheFrame := fullsquare scaled 5in ;
> > >>
> > >> z0 = (0,0);
> > >> z1 = (60,40);
> > >> z2 = (40,90);
> > >> z3 = (10,70);
> > >> z4 = (30,50);
> > >> z5 = (90,70);
> > >> z6 = (-10,70);
> > >>
> > >> path A; A = z0..z1..z2..z3..z4 ;
> > >> pair AStartPoint; AStartPoi

[NTG-context] Re: Problem with the paragraph

2023-12-18 Thread Ursula Hermann
Dear Bruce, 

Thank you for your Mail 
It works  perfect. Thank you .
Uschi Hermann 

-Ursprüngliche Nachricht-
Von: Bruce Horrocks  
Gesendet: Freitag, 15. Dezember 2023 14:00
An: ntg-context mailing list 
Betreff: [NTG-context] Re: Problem with the paragraph



> On 14 Dec 2023, at 09:44, Ursula Hermann  wrote:
> 
> If I change the name of the textbackground with my example, I sent yesterday, 
> there is no color in the paragraph. 
> 

Try the following version of your example which incoporates Hraban's and 
Wolfgang's suggestions.
Also take care over changing style so use \bold{this is bold} or {\bf this is 
bold} but not \bf{this is bold}.

\definepapersize[MyBook][width=19cm,height=24cm]
\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook 
%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper 
\setupbodyfont[Times New Roman, 12.2pt] \definemargindata  
[MyInMargin][inright] 
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\definetextbackground[GrayBackground][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.5\bodyfontsize,
  rightoffset=.5\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off,]
  \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
  \blackrule[color=black, height=0.10ex, width=13.50cm] \starttext \margintext 
{1.1.1} {\bf Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor).} \par 
Sei M die Menge aller Männer und F die Menge aller Frauen. Die Aussage h(m, f) 
sei ”m ist verliebt in f“. Unter diesen Voraussetzungen machen Sie sich die 
Bedeutung der beiden Aussagen klar.
\par
\startitemize[n]
 \item \m{\forall m ∈ M : ∃f ∈ F : h(m, f)}  \item ∃f ∈ F : ∀m ∈ M : h(m, f).
\stopitemize
% I changed the above to use \startitemize but have a look at \placeformula as 
well

\startGrayBackground
Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass ein 
\m{∃\forall} oder ein \m{\forall\m∃} versteckt ist. Dann ist es besonders 
wichtig, die Formulierung sehr lange zu prüfen und eventuell auch formalisiert 
noch einmal aufzuschreiben.”
\blank
Der Wert von \m{y = f(x)} ist unabhängig von der Wahl\par von \m{x\doubleprime} 
ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} \par (Beutelspacher [10, S.54]).
\stopGrayBackground
\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: Problem with the paragraph

2023-12-15 Thread Bruce Horrocks


> On 14 Dec 2023, at 09:44, Ursula Hermann  wrote:
> 
> If I change the name of the textbackground with my example, I sent yesterday, 
> there is no color in the paragraph. 
> 

Try the following version of your example which incoporates Hraban's and 
Wolfgang's suggestions.
Also take care over changing style so use \bold{this is bold} or {\bf this is 
bold} but not \bf{this is bold}.

\definepapersize[MyBook][width=19cm,height=24cm]
\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook
%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
\setupbodyfont[Times New Roman, 12.2pt]
\definemargindata  [MyInMargin][inright]
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\definetextbackground[GrayBackground][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.5\bodyfontsize,
  rightoffset=.5\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  frame=off,]
  \margintext{\blackrule[color=black, height=0.10ex, width=1cm]\\}
  \blackrule[color=black, height=0.10ex, width=13.50cm]
\starttext
\margintext {1.1.1}
{\bf Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor).}
\par Sei M die Menge aller Männer und F die Menge aller Frauen. Die
Aussage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen
machen Sie sich die Bedeutung der beiden Aussagen klar.
\par
\startitemize[n]
 \item \m{\forall m ∈ M : ∃f ∈ F : h(m, f)}
 \item ∃f ∈ F : ∀m ∈ M : h(m, f).
\stopitemize
% I changed the above to use \startitemize but have a look at \placeformula as 
well

\startGrayBackground
Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass
ein \m{∃\forall} oder ein \m{\forall\m∃} versteckt ist. Dann ist es besonders 
wichtig, die
Formulierung sehr lange zu prüfen und eventuell auch formalisiert
noch einmal aufzuschreiben.”
\blank
Der Wert von \m{y = f(x)} ist unabhängig von der Wahl\par
von \m{x\doubleprime} ist gleichbedeutend mit \m{∃y : ∀x : f(x) = y} \par
(Beutelspacher [10, S.54]).
\stopGrayBackground
\stoptext

—
Bruce Horrocks
Hampshire, UK

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

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


[NTG-context] Re: Problem with the paragraph

2023-12-14 Thread Wolfgang Schuster

Ursula Hermann schrieb am 13.12.2023 um 15:22:


Dear list,

I have this example. I need the whole paragraph in color. But there is 
something wrong.


\definepapersize[MyBook][width=19cm,height=24cm]

\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook

%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper



This doesn't work to use Times New Roman as main font, you can use

    \setupbodyfont[termes]

to get a times lookalike.


\setupbodyfont[Times New Roman, 12.2pt]

\definemargindata [MyInMargin][inright]

\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]

\defineenumeration

[theorem]

  [

text=Theorem,

title=yes,

width=fit,

distance=0.2em,

alternative=serried,

  ]

\definetextbackground[paragraph][

location=paragraph,

background=color,

backgroundcolor=lightgray,

leftoffset=.5\bodyfontsize,

rightoffset=.5\bodyfontsize,

topoffset=.5\bodyfontsize,

bottomoffset=.5\bodyfontsize,

before={\switchtobodyfont[global]},

after={},

frame=off,]

\margintext{\blackrule[color=black, height=0.10ex, 
width=1cm]\\}\blackrule[color=black, height=0.10ex, width=13.50cm]


\starttext

\margintext {1.1.1}



What is the purpose of all these starttext/stoptext blocks?


\starttext

\bf{Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor)}.

\stoptext

\starttext

{\it

\par Sei M die Menge aller Männer und F die Menge aller Frauen. Die 
Aus-\par


sage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen

machen Sie sich die Bedeutung der beiden Aussagen klar.

\stoptext

\par

\starttext



1. Use the itemize environment to create numbered blocks.

2. Learn the correct usage of inline math mode, i.e. \m{...}


1. \m\forall m ∈M : ∃f ∈F : h(m, f).\par

2. ∃f ∈F : ∀m ∈M : h(m, f).\par

\stoptext

\blank

\starttext

\startparagraph

\blank

\tf Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass

ein \m ∃\forall∀oder ein \m \forall∀\m∃versteckt ist. Dann ist es 
besonders wichtig, die


Formulierung sehr lange zu prüfen und eventuell auch formalisiert

noch einmal aufzuschreiben.”\blank

Der Wert von y = f(x) ist unabhängig von der Wahl\par

von x“ ist gleichbedeutend mit ∃y : ∀x : f(x) = y \par

(Beutelspacher [10, S.54]).

\blank

\stopparagraph

\stoptext



Wolfgang

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

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


[NTG-context] Re: About framedtext

2023-12-13 Thread Henning Hraban Ramm

Am 13.12.23 um 18:55 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 13.12.2023 um 18:19:

Am 13.12.23 um 19:03 schrieb Fabrice Couvreur:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.
Thanks
Fabrice

   \definecolor[ColorA][0.8(white)]
   \definecolor[MyColorA][.75(MyColorB,white)]


I never saw this syntax in ConTeXt.


This was added a few years ago (AFAIR to provide something similar to 
the TikZ color command).


I thought it looked like TikZ.
And it’s actually documented in 
https://wiki.contextgarden.net/Command/definecolor

I need to transfer this to https://wiki.contextgarden.net/Color and my book…

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: About framedtext

2023-12-13 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 13.12.2023 um 18:19:

Am 13.12.23 um 19:03 schrieb Fabrice Couvreur:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.
Thanks
Fabrice

   \definecolor[ColorA][0.8(white)]
   \definecolor[MyColorA][.75(MyColorB,white)]


I never saw this syntax in ConTeXt.


This was added a few years ago (AFAIR to provide something similar to 
the TikZ color command).


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

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


[NTG-context] Re: About framedtext

2023-12-13 Thread Henning Hraban Ramm

Am 13.12.23 um 18:19 schrieb Wolfgang Schuster:

Fabrice Couvreur schrieb am 13.12.2023 um 19:03:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.


There is a problem with the corner option, you can either hope it gets 
fixed in the next release
(corner=round still works) or create your own background as metapost 
graphic with rounded corners.


Oh, yes, here’s Hans’ fix.

Hraban
if not modules then modules = { } end modules ['lpdf-rul'] = {
version   = 1.001,
comment   = "companion to grph-rul.mkiv",
author= "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license   = "see context related readme files"
}

-- todo: split backend and pdf

local tonumber, tostring, next, type = tonumber, tostring, next, type
local concat, setmetatableindex = table.concat, table.setmetatableindex

local attributes   = attributes
local nodes= nodes

local bpfactor = number.dimenfactors.bp

local nuts = nodes.nuts
local ruleactions  = nuts.rules.ruleactions

local getwhd   = nuts.getwhd

local lefttoright_code = tex.directioncodes.lefttoright

local mpcolor  = attributes.colors.mpcolor

local trace_mp = false  trackers.register("rules.mp", function(v) 
trace_mp = v end)

local report_mp= logs.reporter("rules","mp")

local floor= math.floor
local getrandom= utilities.randomizer.get
local formatters   = string.formatters

local setdimen = tex.setdimen
local isdimen  = tex.isdimen
local setmacro = tokens.setters.macro

local codeinjections   = backends.registered.pdf.codeinjections

local d_rule_width  = isdimen("d_rule_width")
local d_rule_height = isdimen("d_rule_height")
local d_rule_depth  = isdimen("d_rule_depth")
local d_rule_h  = isdimen("d_rule_h")
local d_rule_v  = isdimen("d_rule_v")
local d_rule_line   = isdimen("d_rule_line")
local d_rule_offset = isdimen("d_rule_offset")
local d_rule_factor = isdimen("d_rule_factor")

-- This is very pdf specific. Maybe move some to lpdf-rul.lua some day.

local pdfprint ; pdfprint = function(...) pdfprint = lpdf.print return 
pdfprint(...) end

do

local simplemetapost = metapost.simple
local cachesize  = 0
local maxcachesize   = 256*1024
local cachethreshold = 1024
local caching= false -- otherwise random issues so we need a 
dedicated randomizer first

 -- local maxcachesize   = 8*1024
 -- local cachethreshold = 1024/2

local cache = setmetatableindex(function(t,k)
local v = simplemetapost("rulefun",k) -- w, h, d
cachesize = cachesize + #v
if cachesize > maxcachesize then
 -- print("old",cachesize)
for k, v in next, t do
local n = #v
if n > cachethreshold then
t[k] = nil
cachesize = cachesize - n
end
end
 -- print("new",cachesize)
end
 -- print(cachesize,maxcachesize,cachethreshold,#v)
t[k] = v
return v
end)

local replacer = utilities.templates.replacer

-- todo: RuleColor -> just string ?
-- todo: fetch them instead fo push them

-- local predefined = {
-- ["fake:word"] = replacer [[
-- FakeWord(%width%,%height%,%depth%,%line%,%color%);
-- ]],
-- ["fake:rule"] = replacer[[
-- %initializations%
-- FakeRule(%width%,%height%,%depth%,%line%,%color%);
-- ]],
-- ["fake:rest"] = replacer [[
-- RuleDirection := "%direction%" ;
-- RuleOption := "%option%" ;
-- RuleWidth := %width% ;
-- RuleHeight := %height% ;
-- RuleDepth := %depth% ;
-- RuleH := %h% ;
-- RuleV := %v% ;
-- RuleThickness := %line% ;
-- RuleFactor := %factor% ;
-- RuleOffset := %offset% ;
-- def RuleColor = %color% enddef ;
-- %data%;
-- ]]
-- }

local predefined = {
["fake:word"] = replacer [[
FakeWord(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor);
]],
["fake:rule"] = replacer[[
%initializations%
FakeRule(RuleWidth,RuleHeight,RuleDepth,RuleThickness,RuleColor);
]],
["fake:rest"] = replacer [[
%data%;
]]
}

local initialized = false ;

local function rule_mp(p,h,v,i,n)
local name  = p.name or "fake:rest"
local ht= p.height or 0
local dp= p.depth  or 0
local total = ht + dp
local code  = (predefined[name] or predefined["fake:rest"]) {
data  = p.data or "",
  -- -- width = p.width * bpfactor,
  -- -- height= p.height * bpfactor,
  -- -

[NTG-context] Re: About framedtext

2023-12-13 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 13.12.2023 um 19:03:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.


There is a problem with the corner option, you can either hope it gets 
fixed in the next release
(corner=round still works) or create your own background as metapost 
graphic with rounded corners.


Wolfgang

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

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


[NTG-context] Re: About framedtext

2023-12-13 Thread Henning Hraban Ramm

Am 13.12.23 um 19:03 schrieb Fabrice Couvreur:

Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.
Thanks
Fabrice

   \definecolor[ColorA][0.8(white)]
   \definecolor[MyColorA][.75(MyColorB,white)]


I never saw this syntax in ConTeXt.
That doesn’t mean it’s wrong, but I’d suggest looking into 
https://wiki.contextgarden.net/Spot_Colors#Multitones


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] About framedtext

2023-12-13 Thread Fabrice Couvreur
Hi,
Is this a bug or not ?
The key to coloring the background of the text seems to no longer work.
Thanks
Fabrice

\definecolor[MyColorC][s=0.8784]
  \definecolor[MyColorD][m=0.27,y=1]
  \definecolor[ColorA][0.8(white)]
  \definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]
  \definecolor[MyColorA][.75(MyColorB,white)]

  \defineframed
  [FrameTitle]
  [frame=off,
   foregroundstyle=\bfx\ss,
   foregroundcolor=white,
   background=color,
   backgroundcolor=MyColorD,
   location=depth]

  \defineframedtext
  [FramedText]
  [offset=0.25em,
   style=\ss,
   toffset=\zeropoint,
   background=color,
   backgroundcolor=MyColorA,
   foregroundstyle={\switchtobodyfont[9pt]},
   align={right, broad},
   frame=off,
   corner=00,
   radius=0.5em,
   width=10cm]

  \definedescription
  [Info]
  [before=,
   after=,
   text=Info,
   title=no,
   width=fit,
   distance=0.5em,
   headcommand=\FrameTitle,
   alternative=serried]

\starttext
   \startFramedText[width=5cm]
\startInfo
 \input{ward}
\stopInfo
\stopFramedText
\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] Problem with the paragraph

2023-12-13 Thread Ursula Hermann
Dear list,

I have this example. I need the whole paragraph in color. But there is 
something wrong.
\definepapersize[MyBook][width=19cm,height=24cm]
\setuppapersize[MyBook][MyBook] % Prints on paper the size of MyBook
%\setuppapersize[MyBook][A4] %Would print MyBook-size pages on A4 paper
\setupbodyfont[Times New Roman, 12.2pt]
\definemargindata  [MyInMargin][inright]
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1.90cm]
\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.2em,
alternative=serried,
  ]
\definetextbackground[paragraph][
  location=paragraph,
  background=color,
  backgroundcolor=lightgray,
  leftoffset=.5\bodyfontsize,
  rightoffset=.5\bodyfontsize,
  topoffset=.5\bodyfontsize,
  bottomoffset=.5\bodyfontsize,
  before={\switchtobodyfont[global]},
  after={},
  frame=off,]
  \margintext{\blackrule[color=black, height=0.10ex, 
width=1cm]\\}\blackrule[color=black, height=0.10ex, width=13.50cm]
\starttext
\margintext {1.1.1}
\starttext
\bf{Beispiel 3.2.17 (Vertauschung von All- und Existenzquantor)}.
\stoptext
\starttext
{\it
\par Sei M die Menge aller Männer und F die Menge aller Frauen. Die Aus-\par
sage h(m, f) sei ”m ist verliebt in f“. Unter diesen Voraussetzungen
machen Sie sich die Bedeutung der beiden Aussagen klar.
\stoptext
\par
\starttext
1. \m\forall m ∈ M : ∃f ∈ F : h(m, f).\par
2. ∃f ∈ F : ∀m ∈ M : h(m, f).\par
\stoptext
\blank
\starttext
\startparagraph
\blank
\tf Mitunter ist es aus der Formulierung nur schwer zu erkennen, dass
ein \m ∃\forall∀ oder ein \m \forall∀\m∃ versteckt ist. Dann ist es besonders 
wichtig, die
Formulierung sehr lange zu prüfen und eventuell auch formalisiert
noch einmal aufzuschreiben.”\blank
Der Wert von y = f(x) ist unabhängig von der Wahl\par
von x“ ist gleichbedeutend mit ∃y : ∀x : f(x) = y \par
(Beutelspacher [10, S.54]).
\blank
\stopparagraph
\stoptext

Many thanks
Uschi



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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] framed: rounded corner oddity

2023-12-05 Thread Henning Hraban Ramm

Hi,

in my ConTeXt book, some examples for \framed with rounded corners look 
odd, as if the MetaPost calculation of rounded corners fails.


I can’t find a minimal example that shows the problem, and I can’t 
imagine which of the settings in my extensive environment would cause it.


Find below the code that works on its own, but causes the results as 
shown in the attachments within my book. There’s nowhere a \setupframed, 
and nothing that should influence MetaPost.


Do you have any clue for what I should look?

Hraban

\starttext

\framed[
  rulethickness=1pt,
  offset=0.5em,
  background=color,
  backgroundcolor=yellow,
  framecorner=13,
  backgroundcorner=07,
  backgroundoffset=0.5em,
]{Das Runde muss ins Eckige}

\blank

\framed[
  frame=on,
  corner=round,
  frameoffset=0.5em,
  framecolor=black,
  background=color,
  backgroundcolor=darkgreen,
  backgroundoffset=1em,
  foregroundcolor=white,
  foregroundstyle={\ss\bf},
]{Komm ins Grüne!}

\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: Colored Paragraph

2023-12-05 Thread Ursula Hermann
Dear Hraban, 

It was \startnarrower \stopnarrower, I put it out, now it is perfekt. I also 
send the pdf. 

Many thanks. 
Uschi 

-Ursprüngliche Nachricht-
Von: Henning Hraban Ramm  
Gesendet: Dienstag, 05. Dezember 2023 15:47
An: ntg-context@ntg.nl
Betreff: [NTG-context] Re: Colored Paragraph

Hi Uschi,
unfortunately you also forgot the source code.

I’m not sure if the examples in the wiki are good – the combination with 
\startnarrower might be a problem.

Maybe setting the width helps (e.g. to \makeupwidth).

Hraban

Am 05.12.23 um 15:29 schrieb Ursula Hermann:
> Dear Hraban,
> Sorry, forgot my name
> Uschi
> 
> -Ursprüngliche Nachricht-
> Von: Ursula Hermann
> Gesendet: Dienstag, 05. Dezember 2023 15:27
> An: 'mailing list for ConTeXt users' 
> Betreff: AW: [NTG-context] Re: Colored Paragraph
> 
> Dear Hraban,
> 
> I have tried it now, I have sent you the pdf. This works. But the paragraph 
> should fill the whole blackrule.
> 
> -Ursprüngliche Nachricht-
> Von: Henning Hraban Ramm 
> Gesendet: Dienstag, 05. Dezember 2023 14:58
> An: mailing list for ConTeXt users 
> Betreff: [NTG-context] Re: Colored Paragraph
> 
> Am 05.12.23 um 14:16 schrieb Ursula Hermann:
>> The paragraph should have a color in the background. How can I get an 
>> colored paragraph?
> 
> Did you try \definetextbackground?
> 
> https://wiki.contextgarden.net/TextBackground
> https://wiki.contextgarden.net/Command/definetextbackground
> 
> 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
___


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: Colored Paragraph

2023-12-05 Thread Henning Hraban Ramm

Hi Uschi,
unfortunately you also forgot the source code.

I’m not sure if the examples in the wiki are good – the combination with 
\startnarrower might be a problem.


Maybe setting the width helps (e.g. to \makeupwidth).

Hraban

Am 05.12.23 um 15:29 schrieb Ursula Hermann:

Dear Hraban,
Sorry, forgot my name
Uschi

-Ursprüngliche Nachricht-
Von: Ursula Hermann
Gesendet: Dienstag, 05. Dezember 2023 15:27
An: 'mailing list for ConTeXt users' 
Betreff: AW: [NTG-context] Re: Colored Paragraph

Dear Hraban,

I have tried it now, I have sent you the pdf. This works. But the paragraph 
should fill the whole blackrule.

-Ursprüngliche Nachricht-
Von: Henning Hraban Ramm 
Gesendet: Dienstag, 05. Dezember 2023 14:58
An: mailing list for ConTeXt users 
Betreff: [NTG-context] Re: Colored Paragraph

Am 05.12.23 um 14:16 schrieb Ursula Hermann:

The paragraph should have a color in the background. How can I get an
colored paragraph?


Did you try \definetextbackground?

https://wiki.contextgarden.net/TextBackground
https://wiki.contextgarden.net/Command/definetextbackground

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: Colored Paragraph

2023-12-05 Thread Ursula Hermann
Dear Hraban, 
Sorry, forgot my name 
Uschi 

-Ursprüngliche Nachricht-
Von: Ursula Hermann 
Gesendet: Dienstag, 05. Dezember 2023 15:27
An: 'mailing list for ConTeXt users' 
Betreff: AW: [NTG-context] Re: Colored Paragraph

Dear Hraban, 

I have tried it now, I have sent you the pdf. This works. But the paragraph 
should fill the whole blackrule. 

-Ursprüngliche Nachricht-
Von: Henning Hraban Ramm 
Gesendet: Dienstag, 05. Dezember 2023 14:58
An: mailing list for ConTeXt users 
Betreff: [NTG-context] Re: Colored Paragraph

Am 05.12.23 um 14:16 schrieb Ursula Hermann:
> The paragraph should have a color in the background. How can I get an 
> colored paragraph?

Did you try \definetextbackground?

https://wiki.contextgarden.net/TextBackground
https://wiki.contextgarden.net/Command/definetextbackground

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: Colored Paragraph

2023-12-05 Thread Ursula Hermann
Dear Hraban, 

I have tried it now, I have sent you the pdf. This works. But the paragraph 
should fill the whole blackrule. 

-Ursprüngliche Nachricht-
Von: Henning Hraban Ramm  
Gesendet: Dienstag, 05. Dezember 2023 14:58
An: mailing list for ConTeXt users 
Betreff: [NTG-context] Re: Colored Paragraph

Am 05.12.23 um 14:16 schrieb Ursula Hermann:
> The paragraph should have a color in the background. How can I get an 
> colored paragraph?

Did you try \definetextbackground?

https://wiki.contextgarden.net/TextBackground
https://wiki.contextgarden.net/Command/definetextbackground

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
___


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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: Colored Paragraph

2023-12-05 Thread Henning Hraban Ramm

Am 05.12.23 um 14:16 schrieb Ursula Hermann:
The paragraph should have a color in the background. How can I get an 
colored paragraph?


Did you try \definetextbackground?

https://wiki.contextgarden.net/TextBackground
https://wiki.contextgarden.net/Command/definetextbackground

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] Colored Paragraph

2023-12-05 Thread Ursula Hermann
Dear List,

i have this example:

\setupbodyfont[modern,10pt]
\definemargindata  [MyInMargin][inright]
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1cm]

\defineenumeration
  [theorem]
  [
text=Theorem,
title=yes,
width=fit,
distance=0.5em,
alternative=serried,
  ]
\margintext{\blackrule[color=black, height=0.25ex, 
width=1cm]\\}\blackrule[color=black, height=0.25ex, width=15cm]
\starttext
\margintext {1.1.1}

\startparagraph
It was essential for Hasselt to have a bridge across the Zwarte
Water river. The bishop of Utrecht gave Hasselt his consent in
1486.
\blank
Other cities in the neighbourhood of Hasselt were afraid of the
toll money to be paid when crossing this bridge so they
prevented the construction for many years.
\stopparagraph
\stoptext

The paragraph should have a color in the background. How can I get an colored 
paragraph?

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: externalfigure crashed

2023-12-04 Thread Hans Hagen via ntg-context

On 12/4/2023 5:38 PM, Pablo Rodriguez via ntg-context wrote:

On 11/24/23 18:16, Hans Hagen via ntg-context wrote:

[…]
will do for now ... i can't upload a new installer .. pending the built;
the advantage is that i can do some experiments that would otherwise
break the current version (making compact font mode very close to
normal, pdf signing […]


Sorry, Hans, if I am missing the point.

Does the above mean that ConTeXt will be able to sign PDF documents with
digital certificates?
Well, that's what singing is, right? The problem is actually less in the 
signing than in the certificates themselves.


Basically one can sign (with some certificate) and then validate.


% sign-001.tex

\setupinteraction[state=start]

\definefield[signature][signed]

\defineoverlay[signature][my signature]

\starttext
\startTEXpage[offset=1ts,frame=on,framecolor=darkblue]
sign: \inframed
  [background=signature,framecolor=darkred]
  {\fieldbody[signature][width=3cm,option=hidden]}
\stopTEXpage
\stoptext

after neing processed:

mtxrun --script pdf --sign --certificate=sign-001.pem --password=test 
sign-001 (--library)


and:

mtxrun --script pdf --validate --certificate=sign-001.pem 
--password=test sign-001 (--library)


etc. works here.

Hans

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

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: multipage metapost output from ConTeXt

2023-12-04 Thread Fabrice L
nonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \usetypescript[serif][fallback]
> >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [notonaskharabic]
> >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> >> \stoptypescript
> >>
> >> \usetypescript[notonaskharabic]
> >>
> >> \setupbodyfont [RomanFont]
> >>
> >> \usecolors[crayola]
> >>
> >> \startMPinclusions
> >>
> >> picture p[];
> >> path TheFrame ;
> >> TheFrame := fullsquare scaled 5in ;
> >>
> >> z0 = (0,0);
> >> z1 = (60,40);
> >> z2 = (40,90);
> >> z3 = (10,70);
> >> z4 = (30,50);
> >> z5 = (90,70);
> >> z6 = (-10,70);
> >>
> >> path A; A = z0..z1..z2..z3..z4 ;
> >> pair AStartPoint; AStartPoint = point 0 of A;
> >> pair AEndPoint; AEndPoint = point 4 of A;
> >> path B; B = z5..z6;
> >> pair BStartPoint; BStartPoint = point 0 of B;
> >> pair BEndPoint; BEndPoint = point 1 of B;
> >> path C; C = AStartPoint..AEndPoint;
> >>
> >> p1:=image(
> >> draw A withcolor red;
> >> );
> >>
> >> p2:=image(draw A; label(lmt_outline [
> >> text = "\JapaneseFont 日本語"
> >> ], AEndPoint););
> >>
> >> p3:=image(
> >> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, 
> >> BStartPoint);
> >> );
> >>
> >> p4:=image(draw A; label(lmt_outline [
> >> text = "\KoreanFont 한국어"
> >> ], AStartPoint););
> >>
> >> p5:=image(
> >> label(textext("bāng"), BEndPoint);
> >> draw C withcolor green;
> >> );
> >>
> >> p6:=image(
> >> draw B withcolor blue;
> >> );
> >> \stopMPinclusions
> >>
> >> \starttext
> >>
> >> \dorecurse{6}{ % Frame
> >> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> >> \startMPpage[pagestate=start]
> >> currentime := #1 ;
> >> % Just for learning :
> >> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> >> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ;
> >> for k=1 upto currentime: draw p[k]; endfor
> >> setbounds currentpicture to TheFrame ;
> >>
> >> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> >> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >>
> >> \stopMPpage
> >> }
> >>
> >> \stoptext
> >> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> >>
> >> On Mon, 27 Nov 2023, Fabrice L wrote:
> >>
> >> > Hi,
> >> >
> >> > It is fun fact very easy to do. You just use \startMPpage (…) 
> >> > \stopMPpage multiple times. Here is an example which build an animation 
> >> > of a particle moving according to a Brownian motion.
> >>
> >> A very similar option is to pass a variable to a metapost drawing. This is 
> >> what I use:
> >>
> >> https://adityam.github.io/context-blog/post/metapost-animation/
> >>
> >> It only works when viewed in acrobat, you can just comment out the 
> >> animation part and wrap it in \startTEXpage .. \stopTEXpage to get 
> >> multi-page animation.
> >>
> >> Aditya___
> >> If your question is of interest to others as well, please add an entry to 
> >> the Wiki!
> >>
> _

I do not understand why your original code does not work, and I know Mickael 
has offered you a solution, but there is, just for curiosity,  another one to 
achieve your goal using \MPinclusions  :

% 8 < ———

\starttext

\startMPinclusions

 path TheFrame ;
 TheFrame := fullsquare scaled 5in ;

 pair Coord[] ;
 string TheText[] ; 

 TheText[1] := "Word 1" ; Coord[1] := (60,40) ;
 TheText[2] := "Word 2" ; Coord[2] := (40,90) ;
 TheText[3] := "Word 3" ; Coord[3] := (10,70) ;

\stopMPinclusions

\dorecurse{3}{ % Frame
\startMPpage%[pagestate=start]  
 currentime := #1 ;

 % Just for learning :
 draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
 draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;

 for k=1 upto currentime: 
  draw textext(TheText[k]) shifted Coord[k] ;
  endfor ;
 
\stopMPpage
}

\stoptext
% 8 < ———

Fabrice. 

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
efore the for k=1 endfor loop. This overwriting happens only for the 
> > >> first textext() which occurs inside the for k=1 endfor loop. All other 
> > >> textext() inside the for k=1 endfor loop are not drawn at all. If the 
> > >> line « draw textext("T="(currentime)) scaled 2 shifted(0,2in) 
> > >> withcolor magenta ; » is commented out, the first textext() inside the 
> > >> for k=1 endfor loop is not drawn neither. It must be an issue with 
> > >> textext(), because when I replace textext() by lmt_outline[], the text 
> > >> is drawn.
> > >>
> > >> Adjusted mwe:
> > >>
> > >> \enableregime[utf] % enable unicoded input
> > >>
> > >> \definefontfamily [RomanFont] [rm] [calluna]
> > >>
> > >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> > >>
> > >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> > >>
> > >> \definefontfeature
> > >> [fea]
> > >> [mode=node,language=dflt,script=arab,
> > >> init=yes,
> > >> medi=yes,
> > >> fina=yes,
> > >> isol=yes,
> > >> calt=yes,
> > >> rlig=yes,
> > >> tlig=yes,
> > >> trep=yes,
> > >> curs=yes,
> > >> kern=yes,
> > >> mark=yes
> > >> ]
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [serif] [notonaskharabic]
> > >> \usetypescript[serif][fallback]
> > >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> > >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> > >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> > >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> > >> [features=fea]
> > >> \stoptypescript
> > >>
> > >> \starttypescript [notonaskharabic]
> > >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] 
> > >> [default]
> > >> \stoptypescript
> > >>
> > >> \usetypescript[notonaskharabic]
> > >>
> > >> \setupbodyfont [RomanFont]
> > >>
> > >> \usecolors[crayola]
> > >>
> > >> \startMPinclusions
> > >>
> > >> picture p[];
> > >> path TheFrame ;
> > >> TheFrame := fullsquare scaled 5in ;
> > >>
> > >> z0 = (0,0);
> > >> z1 = (60,40);
> > >> z2 = (40,90);
> > >> z3 = (10,70);
> > >> z4 = (30,50);
> > >> z5 = (90,70);
> > >> z6 = (-10,70);
> > >>
> > >> path A; A = z0..z1..z2..z3..z4 ;
> > >> pair AStartPoint; AStartPoint = point 0 of A;
> > >> pair AEndPoint; AEndPoint = point 4 of A;
> > >> path B; B = z5..z6;
> > >> pair BStartPoint; BStartPoint = point 0 of B;
> > >> pair BEndPoint; BEndPoint = point 1 of B;
> > >> path C; C = AStartPoint..AEndPoint;
> > >>
> > >> p1:=image(
> > >> draw A withcolor red;
> > >> );
> > >>
> > >> p2:=image(draw A; label(lmt_outline [
> > >> text = "\JapaneseFont 日本語"
> > >> ], AEndPoint););
> > >>
> > >> p3:=image(
> > >> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, 
> > >> BStartPoint);
> > >> );
> > >>
> > >> p4:=image(draw A; label(lmt_outline [
> > >> text = "\KoreanFont 한국어"
> > >> ], AStartPoint););
> > >>
> > >> p5:=image(
> > >> label(textext("bāng"), BEndPoint);
> > >> draw C withcolor green;
> > >> );
> > >>
> > >> p6:=image(
> > >> draw B withcolor blue;
> > >> );
> > >> \stopMPinclusions
> > >>
> > >> \starttext
> > >>
> 

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Mikael Sundqvist
; >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> >>
> >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> >>
> >> \definefontfeature
> >> [fea]
> >> [mode=node,language=dflt,script=arab,
> >> init=yes,
> >> medi=yes,
> >> fina=yes,
> >> isol=yes,
> >> calt=yes,
> >> rlig=yes,
> >> tlig=yes,
> >> trep=yes,
> >> curs=yes,
> >> kern=yes,
> >> mark=yes
> >> ]
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \usetypescript[serif][fallback]
> >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [notonaskharabic]
> >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> >> \stoptypescript
> >>
> >> \usetypescript[notonaskharabic]
> >>
> >> \setupbodyfont [RomanFont]
> >>
> >> \usecolors[crayola]
> >>
> >> \startMPinclusions
> >>
> >> picture p[];
> >> path TheFrame ;
> >> TheFrame := fullsquare scaled 5in ;
> >>
> >> z0 = (0,0);
> >> z1 = (60,40);
> >> z2 = (40,90);
> >> z3 = (10,70);
> >> z4 = (30,50);
> >> z5 = (90,70);
> >> z6 = (-10,70);
> >>
> >> path A; A = z0..z1..z2..z3..z4 ;
> >> pair AStartPoint; AStartPoint = point 0 of A;
> >> pair AEndPoint; AEndPoint = point 4 of A;
> >> path B; B = z5..z6;
> >> pair BStartPoint; BStartPoint = point 0 of B;
> >> pair BEndPoint; BEndPoint = point 1 of B;
> >> path C; C = AStartPoint..AEndPoint;
> >>
> >> p1:=image(
> >> draw A withcolor red;
> >> );
> >>
> >> p2:=image(draw A; label(lmt_outline [
> >> text = "\JapaneseFont 日本語"
> >> ], AEndPoint););
> >>
> >> p3:=image(
> >> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, 
> >> BStartPoint);
> >> );
> >>
> >> p4:=image(draw A; label(lmt_outline [
> >> text = "\KoreanFont 한국어"
> >> ], AStartPoint););
> >>
> >> p5:=image(
> >> label(textext("bāng"), BEndPoint);
> >> draw C withcolor green;
> >> );
> >>
> >> p6:=image(
> >> draw B withcolor blue;
> >> );
> >> \stopMPinclusions
> >>
> >> \starttext
> >>
> >> \dorecurse{6}{ % Frame
> >> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> >> \startMPpage[pagestate=start]
> >> currentime := #1 ;
> >> % Just for learning :
> >> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> >> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ;
> >> for k=1 upto currentime: draw p[k]; endfor
> >> setbounds currentpicture to TheFrame ;
> >>
> >> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> >> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >>
> >> \stopMPpage
> >> }
> >>
> >> \stoptext
> >> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> >>
> >> On Mon, 27 Nov 2023, Fabrice L wrote:
> >>
> >> > Hi,
> >> >
> >> > It is fun fact very easy to do. You just use \startMPpage (…) 
> >> > \stopMPpage multiple times. Here is an example which build an animation 
> >> > of a particle moving according to a Brownian motion.
> >>
> >> A very similar option is to pass a

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
t; >> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> >> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [notonaskharabic]
> >> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> >> \stoptypescript
> >>
> >> \usetypescript[notonaskharabic]
> >>
> >> \setupbodyfont [RomanFont]
> >>
> >> \usecolors[crayola]
> >>
> >> \startMPinclusions
> >>
> >> picture p[];
> >> path TheFrame ;
> >> TheFrame := fullsquare scaled 5in ;
> >>
> >> z0 = (0,0);
> >> z1 = (60,40);
> >> z2 = (40,90);
> >> z3 = (10,70);
> >> z4 = (30,50);
> >> z5 = (90,70);
> >> z6 = (-10,70);
> >>
> >> path A; A = z0..z1..z2..z3..z4 ;
> >> pair AStartPoint; AStartPoint = point 0 of A;
> >> pair AEndPoint; AEndPoint = point 4 of A;
> >> path B; B = z5..z6;
> >> pair BStartPoint; BStartPoint = point 0 of B;
> >> pair BEndPoint; BEndPoint = point 1 of B;
> >> path C; C = AStartPoint..AEndPoint;
> >>
> >> p1:=image(
> >> draw A withcolor red;
> >> );
> >>
> >> p2:=image(draw A; label(lmt_outline [
> >> text = "\JapaneseFont 日本語"
> >> ], AEndPoint););
> >>
> >> p3:=image(
> >> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, 
> >> BStartPoint);
> >> );
> >>
> >> p4:=image(draw A; label(lmt_outline [
> >> text = "\KoreanFont 한국어"
> >> ], AStartPoint););
> >>
> >> p5:=image(
> >> label(textext("bāng"), BEndPoint);
> >> draw C withcolor green;
> >> );
> >>
> >> p6:=image(
> >> draw B withcolor blue;
> >> );
> >> \stopMPinclusions
> >>
> >> \starttext
> >>
> >> \dorecurse{6}{ % Frame
> >> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> >> \startMPpage[pagestate=start]
> >> currentime := #1 ;
> >> % Just for learning :
> >> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> >> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ;
> >> for k=1 upto currentime: draw p[k]; endfor
> >> setbounds currentpicture to TheFrame ;
> >>
> >> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> >> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >>
> >> \stopMPpage
> >> }
> >>
> >> \stoptext
> >> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> >>
> >> On Mon, 27 Nov 2023, Fabrice L wrote:
> >>
> >> > Hi,
> >> >
> >> > It is fun fact very easy to do. You just use \startMPpage (…) 
> >> > \stopMPpage multiple times. Here is an example which build an animation 
> >> > of a particle moving according to a Brownian motion.
> >>
> >> A very similar option is to pass a variable to a metapost drawing. This is 
> >> what I use:
> >>
> >> https://adityam.github.io/context-blog/post/metapost-animation/
> >>
> >> It only works when viewed in acrobat, you can just comment out the 
> >> animation part and wrap it in \startTEXpage .. \stopTEXpage to get 
> >> multi-page animation.
> >>
> >> Aditya___
> >> If your question is of interest to others as well, please add an entry to 
> >> the Wiki!
> >>
> >> maillist : ntg-context@ntg.nl / 
> >> https://mailman.ntg.nl/mailman3/lists/ntg-context.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 (mir

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Mikael Sundqvist
Hi Emanuel,

I am not sure I understand your question, and since you use fonts that
i do not have, I cannot test your example as is. But, maybe, if you
want to redraw a picture, you can do

addto currentpicture also p1;

where you want it.

/Mikael

PS For the text thing, I did not get it. Could one have a _very
simple_ example showing only that problem and no other problem?

On Sat, Dec 2, 2023 at 12:58 PM fv leung  wrote:
>
> You didn't specify the color of path A in p2 and p4. So it's drawn in black.
> The other issue, I can't help.
>
> Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
>>
>> So is there a way to circumvent these issues? Or an explanation for this 
>> behavior, so that I can try to find a solution by myself?
>>
>> Thanks
>> Emanuel
>>
>> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
>>  wrote:
>>
>> Dear Aditya and Fabrice,
>> thanks for your responses.
>>
>> I included some of Fabrice's code into mine for testing purpose, and indeed 
>> the multipage works now.
>> What is bizarre is that issues appear now that didn't appear before:
>>
>> Path A is drawn with color red on page 1, and in color black on all 
>> following pages, while it should stay red.
>> textext(, ) is overwriting  with "T="(currentime) 
>> which has been used previously  in textext() before the for k=1 endfor loop. 
>> This overwriting happens only for the first textext() which occurs inside 
>> the for k=1 endfor loop. All other textext() inside the for k=1 endfor loop 
>> are not drawn at all. If the line  « draw textext("T="(currentime)) 
>> scaled 2 shifted(0,2in) withcolor magenta ; » is commented out, the first 
>> textext() inside the for k=1 endfor loop is not drawn neither. It must be an 
>> issue with textext(), because when I replace textext() by lmt_outline[], the 
>> text is drawn.
>>
>> Adjusted mwe:
>>
>> \enableregime[utf] % enable unicoded input
>>
>> \definefontfamily [RomanFont] [rm] [calluna]
>>
>> \definefontfamily [KoreanFont] [rm] [applemyungjo]
>>
>> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
>>
>> \definefontfeature
>>  [fea]
>>  [mode=node,language=dflt,script=arab,
>>   init=yes,
>>   medi=yes,
>>   fina=yes,
>>   isol=yes,
>>   calt=yes,
>>   rlig=yes,
>>   tlig=yes,
>>   trep=yes,
>>   curs=yes,
>>   kern=yes,
>>   mark=yes
>> ]
>>
>> \starttypescript [serif] [notonaskharabic]
>>  \definefontsynonym [notonaskharabic-Light]   [name:notonaskharabic] 
>>[features=fea]
>>  \definefontsynonym [notonaskharabic-Bold][name:notonaskharabic] 
>>[features=fea]
>>  \definefontsynonym [notonaskharabic-Italic]  [name:notonaskharabic] 
>>[features=fea]
>>  \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
>>[features=fea]
>> \stoptypescript
>>
>> \starttypescript [serif] [notonaskharabic]
>>  \usetypescript[serif][fallback]
>>  \definefontsynonym [Serif]   [notonaskharabic-Light]
>>[features=fea]
>>  \definefontsynonym [SerifItalic] [notonaskharabic-Italic]   
>>[features=fea]
>>  \definefontsynonym [SerifBold]   [notonaskharabic-Bold] 
>>[features=fea]
>>  \definefontsynonym [SerifBoldItalic] 
>> [notonaskharabic-Bold-Italic] [features=fea]
>> \stoptypescript
>>
>> \starttypescript [notonaskharabic]
>>   \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
>> \stoptypescript
>>
>> \usetypescript[notonaskharabic]
>>
>> \setupbodyfont [RomanFont]
>>
>> \usecolors[crayola]
>>
>> \startMPinclusions
>>
>> picture p[];
>>  path TheFrame ;
>>  TheFrame := fullsquare scaled 5in ;
>>
>>  z0 = (0,0);
>>  z1 = (60,40);
>>  z2 = (40,90);
>>  z3 = (10,70);
>>  z4 = (30,50);
>>  z5 = (90,70);
>>  z6 = (-10,70);
>>
>> path A; A = z0..z1..z2..z3..z4 ;
>> pair AStartPoint; AStartPoint = point 0 of A;
>> pair AEndPoint; AEndPoint = point 4 of A;
>> path B; B =  z5..z6;
>> pair BStartPoint; BStartPoint = point 0 of B;
>> pair BEndPoint; BEndPoint = point 1 of B;
>> path C; C = AStartPoint..AEndPoint;
>>
>> p1:=image(
>> draw A withcolor red;
>> );
>>
>> p2:=image(draw A; label(lmt_outline [
>> text = "\JapaneseFont 日本語"
>> ], AEndPoint););
>>
>> p3:=image(
>>

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread fv leung
You didn't specify the color of path A in p2 and p4. So it's drawn in black.
The other issue, I can't help.

Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:

> So is there a way to circumvent these issues? Or an explanation for this
> behavior, so that I can try to find a solution by myself?
>
> Thanks
> Emanuel
>
> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context <
> ntg-context@ntg.nl> wrote:
>
> Dear Aditya and Fabrice,
> thanks for your responses.
>
> I included some of Fabrice's code into mine for testing purpose, and
> indeed the multipage works now.
> What is bizarre is that issues appear now that didn't appear before:
>
>- Path A is drawn with color red on page 1, and in color black on all
>following pages, while it should stay red.
>- textext(, ) is overwriting  with
>"T="(currentime) which has been used previously  in textext()
>before the for k=1 endfor loop. This overwriting happens only for the first
>textext() which occurs inside the for k=1 endfor loop. All other textext()
>inside the for k=1 endfor loop are not drawn at all. If the line  « draw
>textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor magenta
>; » is commented out, the first textext() inside the for k=1 endfor loop is
>not drawn neither. It must be an issue with textext(), because when I
>replace textext() by lmt_outline[], the text is drawn.
>
> Adjusted mwe:
>
> \enableregime[utf] % enable unicoded input
>
> \definefontfamily [RomanFont] [rm] [calluna]
>
> \definefontfamily [KoreanFont] [rm] [applemyungjo]
>
> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
>
> \definefontfeature
>  [fea]
>  [mode=node,language=dflt,script=arab,
>   init=yes,
>   medi=yes,
>   fina=yes,
>   isol=yes,
>   calt=yes,
>   rlig=yes,
>   tlig=yes,
>   trep=yes,
>   curs=yes,
>   kern=yes,
>   mark=yes
> ]
>
> \starttypescript [serif] [notonaskharabic]
>  \definefontsynonym [notonaskharabic-Light]
> [name:notonaskharabic][features=fea]
>  \definefontsynonym [notonaskharabic-Bold]
> [name:notonaskharabic][features=fea]
>  \definefontsynonym [notonaskharabic-Italic]
> [name:notonaskharabic][features=fea]
>  \definefontsynonym [notonaskharabic-Bold-Italic]
> [name:notonaskharabic][features=fea]
> \stoptypescript
>
> \starttypescript [serif] [notonaskharabic]
>  \usetypescript[serif][fallback]
>  \definefontsynonym [Serif]
> [notonaskharabic-Light]   [features=fea]
>  \definefontsynonym [SerifItalic]
> [notonaskharabic-Italic]  [features=fea]
>  \definefontsynonym [SerifBold]
> [notonaskharabic-Bold][features=fea]
>  \definefontsynonym [SerifBoldItalic]
> [notonaskharabic-Bold-Italic] [features=fea]
> \stoptypescript
>
> \starttypescript [notonaskharabic]
>   \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic]
> [default]
> \stoptypescript
>
> \usetypescript[notonaskharabic]
>
> \setupbodyfont [RomanFont]
>
> \usecolors[crayola]
>
> \startMPinclusions
>
> picture p[];
>  path TheFrame ;
>  TheFrame := fullsquare scaled 5in ;
>
>  z0 = (0,0);
>  z1 = (60,40);
>  z2 = (40,90);
>  z3 = (10,70);
>  z4 = (30,50);
>  z5 = (90,70);
>  z6 = (-10,70);
>
> path A; A = z0..z1..z2..z3..z4 ;
> pair AStartPoint; AStartPoint = point 0 of A;
> pair AEndPoint; AEndPoint = point 4 of A;
> path B; B =  z5..z6;
> pair BStartPoint; BStartPoint = point 0 of B;
> pair BEndPoint; BEndPoint = point 1 of B;
> path C; C = AStartPoint..AEndPoint;
>
> p1:=image(
> draw A withcolor red;
> );
>
> p2:=image(draw A; label(lmt_outline [
> text = "\JapaneseFont 日本語"
> ], AEndPoint););
>
> p3:=image(
> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2,
> BStartPoint);
> );
>
> p4:=image(draw A; label(lmt_outline [
> text = "\KoreanFont 한국어"
> ], AStartPoint););
>
> p5:=image(
> label(textext("bāng"), BEndPoint);
> draw C withcolor green;
> );
>
> p6:=image(
> draw B withcolor blue;
> );
> \stopMPinclusions
>
> \starttext
>
> \dorecurse{6}{ % Frame
>  \setupMPpage[background=color, backgroundcolor=SpringGreen]
> \startMPpage[pagestate=start]
>  currentime := #1 ;
>  % Just for learning :
>  draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
>  draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor
> magenta ;
>  for k=1 upto currentime: draw p[k]; endfor
>  setbounds currentpicture to TheFrame ;
>
>  desiredformat := 1080;% In pixels (will be converted by default 

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
So is there a way to circumvent these issues? Or an explanation for this 
behavior, so that I can try to find a solution by myself?

Thanks
Emanuel

On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context  
wrote:
> Dear Aditya and Fabrice,
> thanks for your responses.
>
> I included some of Fabrice's code into mine for testing purpose, and indeed 
> the multipage works now.
> What is bizarre is that issues appear now that didn't appear before:
> Path A is drawn with color red on page 1, and in color black on all following 
> pages, while it should stay red.
>
> textext(, ) is overwriting  with "T="(currentime) 
> which has been used previously in textext() before the for k=1 endfor loop. 
> This overwriting happens only for the first textext() which occurs inside the 
> for k=1 endfor loop. All other textext() inside the for k=1 endfor loop are 
> not drawn at all. If the line « draw textext("T="(currentime)) scaled 
> 2 shifted(0,2in) withcolor magenta ; » is commented out, the first textext() 
> inside the for k=1 endfor loop is not drawn neither. It must be an issue with 
> textext(), because when I replace textext() by lmt_outline[], the text is 
> drawn.
>
>
> Adjusted mwe:
>
> \enableregime[utf] % enable unicoded input
> \definefontfamily [RomanFont] [rm] [calluna]
> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> \definefontfeature
> [fea]
> [mode=node,language=dflt,script=arab,
> init=yes,
> medi=yes,
> fina=yes,
> isol=yes,
> calt=yes,
> rlig=yes,
> tlig=yes,
> trep=yes,
> curs=yes,
> kern=yes,
> mark=yes
> ]
>
> \starttypescript [serif] [notonaskharabic]
> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> [features=fea]
> \stoptypescript
>
> \starttypescript [serif] [notonaskharabic]
> \usetypescript[serif][fallback]
> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> [features=fea]
> \stoptypescript
>
> \starttypescript [notonaskharabic]
> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> \stoptypescript
>
> \usetypescript[notonaskharabic]
> \setupbodyfont [RomanFont]
>
> \usecolors[crayola]
>
> \startMPinclusions
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
>
> z0 = (0,0);
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
> z4 = (30,50);
> z5 = (90,70);
> z6 = (-10,70);
>
> path A; A = z0..z1..z2..z3..z4 ;
> pair AStartPoint; AStartPoint = point 0 of A;
> pair AEndPoint; AEndPoint = point 4 of A;
> path B; B = z5..z6;
> pair BStartPoint; BStartPoint = point 0 of B;
> pair BEndPoint; BEndPoint = point 1 of B;
> path C; C = AStartPoint..AEndPoint;
>
> p1:=image(
> draw A withcolor red;
> );
>
> p2:=image(draw A; label(lmt_outline [
> text = "\JapaneseFont 日本語"
> ], AEndPoint););
>
> p3:=image(
> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, BStartPoint);
> );
>
> p4:=image(draw A; label(lmt_outline [
> text = "\KoreanFont 한국어"
> ], AStartPoint););
>
> p5:=image(
> label(textext("bāng"), BEndPoint);
> draw C withcolor green;
> );
>
> p6:=image(
> draw B withcolor blue;
> );
> \stopMPinclusions
>
> \starttext
> \dorecurse{6}{ % Frame
> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> \startMPpage[pagestate=start]
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> magenta ;
> for k=1 upto currentime: draw p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
>
> \stopMPpage
> }
>
> \stoptext
> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> > On Mon, 27 Nov 2023, Fabrice L wrote:
> >
> > > Hi,
> > >
> > > It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
> > > multiple times. Here is an example which build an anima

[NTG-context] Re: multipage metapost output from ConTeXt

2023-11-29 Thread Emanuel Han via ntg-context
Dear Aditya and Fabrice,
thanks for your responses.

I included some of Fabrice's code into mine for testing purpose, and indeed the 
multipage works now.
What is bizarre is that issues appear now that didn't appear before:
Path A is drawn with color red on page 1, and in color black on all following 
pages, while it should stay red.

textext(, ) is overwriting  with "T="(currentime) 
which has been used previously in textext() before the for k=1 endfor loop. 
This overwriting happens only for the first textext() which occurs inside the 
for k=1 endfor loop. All other textext() inside the for k=1 endfor loop are not 
drawn at all. If the line « draw textext("T="(currentime)) scaled 2 
shifted(0,2in) withcolor magenta ; » is commented out, the first textext() 
inside the for k=1 endfor loop is not drawn neither. It must be an issue with 
textext(), because when I replace textext() by lmt_outline[], the text is drawn.

Adjusted mwe:

\enableregime[utf] % enable unicoded input
\definefontfamily [RomanFont] [rm] [calluna]
\definefontfamily [KoreanFont] [rm] [applemyungjo]
\definefontfamily [JapaneseFont] [rm] [hannotatesc]
\definefontfeature
[fea]
[mode=node,language=dflt,script=arab,
init=yes,
medi=yes,
fina=yes,
isol=yes,
calt=yes,
rlig=yes,
tlig=yes,
trep=yes,
curs=yes,
kern=yes,
mark=yes
]

\starttypescript [serif] [notonaskharabic]
\definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
[features=fea]
\definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
[features=fea]
\stoptypescript

\starttypescript [serif] [notonaskharabic]
\usetypescript[serif][fallback]
\definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
\definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
\definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
\definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
[features=fea]
\stoptypescript

\starttypescript [notonaskharabic]
\definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
\stoptypescript

\usetypescript[notonaskharabic]
\setupbodyfont [RomanFont]

\usecolors[crayola]

\startMPinclusions
picture p[];
path TheFrame ;
TheFrame := fullsquare scaled 5in ;

z0 = (0,0);
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);
z4 = (30,50);
z5 = (90,70);
z6 = (-10,70);

path A; A = z0..z1..z2..z3..z4 ;
pair AStartPoint; AStartPoint = point 0 of A;
pair AEndPoint; AEndPoint = point 4 of A;
path B; B = z5..z6;
pair BStartPoint; BStartPoint = point 0 of B;
pair BEndPoint; BEndPoint = point 1 of B;
path C; C = AStartPoint..AEndPoint;

p1:=image(
draw A withcolor red;
);

p2:=image(draw A; label(lmt_outline [
text = "\JapaneseFont 日本語"
], AEndPoint););

p3:=image(
label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, BStartPoint);
);

p4:=image(draw A; label(lmt_outline [
text = "\KoreanFont 한국어"
], AStartPoint););

p5:=image(
label(textext("bāng"), BEndPoint);
draw C withcolor green;
);

p6:=image(
draw B withcolor blue;
);
\stopMPinclusions

\starttext
\dorecurse{6}{ % Frame
\setupMPpage[background=color, backgroundcolor=SpringGreen]
\startMPpage[pagestate=start]
currentime := #1 ;
% Just for learning :
draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;
for k=1 upto currentime: draw p[k]; endfor
setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );

\stopMPpage
}

\stoptext
On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> On Mon, 27 Nov 2023, Fabrice L wrote:
>
> > Hi,
> >
> > It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
> > multiple times. Here is an example which build an animation of a particle 
> > moving according to a Brownian motion.
>
> A very similar option is to pass a variable to a metapost drawing. This is 
> what I use:
> https://adityam.github.io/context-blog/post/metapost-animation/
> It only works when viewed in acrobat, you can just comment out the animation 
> part and wrap it in \startTEXpage .. \stopTEXpage to get multi-page animation.
> Aditya___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.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: multipage metapost output from ConTeXt

2023-11-27 Thread Fabrice L
Hi,

It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
multiple times. Here is an example which build an animation of a particle 
moving according to a Brownian motion. 

Fabrice.

% 8< ---

\usecolors[crayola]
\setupMPinstance

\starttext

% We can put in the inclusions the material we will use at each page, to 
declare things only one time.
\startMPinclusions
 % the frame of the video ;
 path TheFrame ;
 TheFrame := fullsquare scaled 5in ;

 randomseed := 53 ;
 path TheBrownianMotion ;
 pair Coordinate[];
 Coordinate[0] := (0,0);
 TheBrownianMotion := Coordinate[0] ;
 variance := 10 ;
\stopMPinclusions

\dorecurse{600}{ % Frame

\setupMPpage[background=color, backgroundcolor=SpringGreen]
\startMPpage[pagestate=start]

 currentime := #1 ;
 % Just for learning :
 draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
 draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;

Coordinate[currentime] := Coordinate[currentime-1] + 
%(normaldeviate*variance,normaldeviate*variance) ;
  ((uniformdeviate(1)-0.5)*variance,(uniformdeviate(1)-0.5)*variance) ;
TheBrownianMotion := for p=0 upto (currentime-1) :
  Coordinate[p] .. endfor Coordinate[currentime] ;

draw TheBrownianMotion withpen pencircle scaled .01in withcolor blue ;
draw Coordinate[currentime] withpen pencircle scaled .10in withcolor red ;

setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );

\stopMPpage

} 

\stoptext
% 8< ---



> Le 27 nov. 2023 à 13:49, Emanuel Han via ntg-context  a 
> écrit :
> 
> How can I achieve multipage metapost output from ConTeXt? The result should 
> be a multipage pdf. It contains just a metapost graphic per page. The graphic 
> has always the same bounding box and evolves from page to page: Some elements 
> to be drawn are added, and some others would ideally also be removed, while 
> keeping elements which has already been drawn on previous pages. I can manage 
> when it is not possible to remove elements (in that case I'll just cover them 
> with a covering element).
> 
> I saw that it is possible to achieve my goal with standalone metapost, as 
> described here: 
> https://tex.stackexchange.com/questions/471662/mptopdf-is-multipage-output-pdf-possible
> But I'll need to achieve this with Metapost inside ConTeXt because I use 
> labels in Metapost which print text in Japanese, Korean , Arabic and Roman 
> script: Thanks to ConTeXt, I can define appropriate fonts for each script. 
> All this works already in my working example.
> 
> The only unsolved problem is to ship out multiple pages.
> 
> For the minimal working example, I didn't remove the font defining part, 
> because having 4 different fonts is a condition of my use case. The graphic 
> on the other hand is some simple dummy nonsense graphic not from my project. 
> The graphic is in the provided example drawn as a summing up of layered 
> drawing steps (6 steps, to be precise), so no removing is implemented here 
> (because I don't know how that would be done). If each of the figures 1 to 6 
> of my mwe can be put alone on a page, I'd be already very happy. Now, they're 
> put on top of each other all on the same single page, also on top of figure 0.
> 
> The desired multipage pdf will be used in presentation mode of a pdf viewer 
> and skipped forward and backward from page to page (that is from drawing step 
> to drawing step).
> 
> mwe:
> 
> \enableregime[utf] % enable unicoded input
> 
> \definefontfamily [RomanFont] [rm] [calluna]
> 
> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> 
> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> 
> \definefontfeature
>  [fea]
>  [mode=node,language=dflt,script=arab,
>   init=yes,
>   medi=yes,
>   fina=yes,
>   isol=yes,
>   calt=yes,
>   rlig=yes,
>   tlig=yes,
>   trep=yes,
>   curs=yes,
>   kern=yes,
>   mark=yes
> ]
> 
> \starttypescript [serif] [notonaskharabic]
>  \definefontsynonym [notonaskharabic-Light]   [name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Bold][name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Italic]  [name:notonaskharabic]  
>   [features=fea]
>  \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic]  
>   [features=fea]
> \stoptypescript
> 
> \starttypescript [serif] [notonaskharabic]
>  \usetypescript[serif][fallback]
>  \definefontsynonym [Serif]   [notonaskharabic-Light] 
>   [features=fea]
>  \definefontsynonym [SerifItalic]

[NTG-context] Markdown to HTML cross-references

2023-11-21 Thread Thangalin
Hi list,

I'm looking to implement a consistent syntax for cross-references in
KeenWrite <https://keenwrite.com/> and am wondering what you think would
make the most sense for translating into ConTeXt commands.

First, some background (the first two give an overview, the others are
cross-reference references for various syntaxes):

   - https://talk.commonmark.org/t/cross-references-and-citations/4013/7
   - https://thesynack.com/posts/markdown-captions
   - https://quarto.org/docs/authoring/cross-references.html
   - https://mystmd.org/guide/cross-references
   - https://lierdakil.github.io/pandoc-crossref
   - https://github.com/tomduck/pandoc-eqnos

I'm leaning towards the following syntax:

Markdown Item (table, blockquote, TeX block, figure, code, R chunk, etc.)

: caption text {#type:label}

See [@type:label] for details.

There's a unit test that shows what's currently being generated with a
number of examples for images, tables, blockquotes, internationalization,
and so on:

https://gitlab.com/DaveJarvis/KeenWrite/-/blob/main/src/test/java/com/keenwrite/processors/markdown/extensions/references/CrossReferencesExtensionTest.java#L51

The code is a work-in-progress; so the tests may have changed depending on
if/when you view the Java source code. Presently, the captions produce
anchor references, mostly. The following seems easier to typeset using
ConTeXt:

Meschiya Lake - Lucky Devil 

This diverges from the HTML specification for tables (table/caption) and
figures (figure/figcaption). It would also mean having to write ConTeXt
macros that flip the spans and anchors to produce a caption such as:

*Lyrics 1.1.* Meschiya Lake - Lucky Devil

While there are plenty of ways of presenting captions (e.g., multi-column
images with sub-figure numbers) the majority of cross-references are to a
single "thing" with a single "caption".

What are your thoughts on this proposal? (Keeping in mind I'm the only
person working on KeenWrite and while I'm trying to keep the syntax
compatible with pandoc, implementing the full pandoc-crossref syntax is out
of scope for me.

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] textbackground spacing offset

2023-11-16 Thread Marco Patzer
Hi!

I'm having problems getting the textbackground spacing offset to work.
Example:

\setupframedtext
  [offset=overlay,
   width=max,
   depthcorrection=off]

\setuptextbackground
  [location=paragraph,
   %% offset=overlay,   %% does nothing
   %% backgroundoffset=overlay, %% does nothing
   %% depthcorrection=off,  %% does nothing
   %% topoffset=3mm,%% works, but only for positive values
   background=,
   frame=on]

\starttext
  \startframedtext
\framed{Foo}
  \stopframedtext
  \starttextbackground
\framed{Foo}
  \stoptextbackground
\stoptext

How do it get the same spacing as in the framedtext case? The
textbackground has a small gap between the inner and outer frame at
the top and a larger gab at the bottom. I'm not concerned with
horizontal spacing here.

Marco

LMTX 2023.09.04 19:15
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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 encircle text?

2023-11-05 Thread Pablo Rodriguez via ntg-context
On 11/5/23 12:59, anton.chig...@mail.com wrote:
> Wow!
> This certainly is not the noobie version!
> All I wanted was to put a circle around a letter
> for emphasis.

Anton,

it works as you intend:

  \starttext
  \startusableMPgraphic{MetaCirc}
   draw fullcircle
   xyscaled
  (OverlayWidth-OverlayLineWidth,OverlayHeight-OverlayLineWidth)
   withpen pencircle scaled OverlayLineWidth
   withcolor OverlayColor ;
  \stopusableMPgraphic

  \defineoverlay[MetaCirc][\useMPgraphic{MetaCirc}]

  a\dontleavehmode\framed
 [background=MetaCirc,
  backgroundcolor=red,
  frame=off,
  location=bottom,
  rulethickness=1pt]
 {b}c
  \stoptext

Just in case it helps,

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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 encircle text?

2023-11-05 Thread Hans Hagen via ntg-context

On 11/5/2023 7:23 AM, anton.chig...@mail.com wrote:

I want to use \bigcirc to encircle text.
Is there a way to do it.

if you're wiling to compensate for its depth:

\defineoverlay
  [BigCirc]
  [{\scale
  [width=\overlaywidth]
  {\setbox0\hpack{\bigcirc}\raise\dp0\box0}}]

\framed
  [background=BigCirc,
 % frame=off,
   width=3cm,
   height=3cm]
  {test}

but bigcirc isn't meant for that

\startusableMPgraphic{MetaCirc}
draw fullcircle
xyscaled 
(OverlayWidth-OverlayLineWidth,OverlayHeight-OverlayLineWidth)

withpen pencircle scaled OverlayLineWidth
withcolor OverlayColor ;
\stopusableMPgraphic

\defineoverlay[MetaCirc][\useMPgraphic{MetaCirc}]

\framed
  [background=MetaCirc,
   backgroundcolor=red,
   frame=off,
   rulethickness=1pt]
  {test}

\framed
  [background=MetaCirc,
   backgroundcolor=blue,
   rulethickness=.5pt]
  {test}

is more flexibel in the end

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: Modernizing Parametric type design A case study of Nupuram Malayalam typeface

2023-11-04 Thread BPJ
I have created fonts for my "fictional scripts"[1] using MF[2] and
"converted" them to TTF by importing the bitmap font into the background
layer in Fontforge and tracing it with potrace. It was a long time ago, I
used little metaness beyond setting weight through pen/path width and/or a
general slant trough `currenttransform := identity slanted ...`[3] and/or
modifying heights, and the conversion method may be less sophisticated
(though it avoided needing to remove overlaps!) but still! I have often
thought about doing a more ambitious project using more metaness and maybe
MP. I have experimented a bit playing with `superellipse`, `superhalf` and
my own `super_iii_q` (super-three-quarters), directions[4] and defining
different serifs or lack of them through macros but it never got anywhere.

IIRC Johan Winge used MF for his Tengwar Annatar font for Tolkien's Elvish
script, but AFAIK he has never revealed which conversion method he used.

[1]: As in "scripts used for conlangs used in fiction". The languages do
exist in a more or less rudimentary form and the scripts definitely exist.
I have used some of them to write English or Swedish on occasion.

[2]: I have cerebral palsy so I definitely am not god with GUIs.
Unfortunately I also have mild dyscalculia which makes math hard, but not
as hard as GUIs!

[3]: This seems not to work in MP. I wonder why.

[4]: I defined N, NNW, NW, WNW, W, WSW, SW, SSW, S, SSE ... as synonyms of
up, down etc. and intermediate points between each other, so not very
sophisticated! Also top_lft, top_rt, bot_lft, bot_rt, set to different
values to get/not get Fraktur-like counters.

Den lör 4 nov. 2023 10:38Hans Hagen  skrev:

> On 11/4/2023 9:33 AM, luigi scarso wrote:
> >
> > https://typoday.in/spk_papers/Santhosh_Thottingal_Typoday2023.pdf
> > <https://typoday.in/spk_papers/Santhosh_Thottingal_Typoday2023.pdf>
> > and
> > https://twitter.com/santhoshtr/status/1577596445917470722
> > <https://twitter.com/santhoshtr/status/1577596445917470722>
> >
> > Long live to metapost &  metafont
> > (& mflua :-) :-) :-) )
> when the font was released we (MS & HH) played a bit with it and
> wondered about making a math companion ...
>
> 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: Double sided pages leave a thin white line on the right side

2023-10-28 Thread Mia Bikey
Hi Pablo,
I am on Windows 10 and using Firefox 119 with default PDF.js.
I made a completely new profile to check and the issue exists there too.
Though after testing a bit I realized that the white lines appear on
specific zoom levels and disappear on others.
White lines appear on sumatra too but on a specific zoom level.
There are now some bottom white lines too on some zoom levels.
Okay the issue seems to be happening on all pdf files regardless of whether
it was made from context or not. The black background just allows me to
notice it.
Thank you for checking.

On Sat, Oct 28, 2023 at 9:34 PM Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

> On 10/28/23 16:26, Mia Bikey wrote:
> > Well I was using firefox to open my pdf and did not check it on anything
> > else.
> > I opened the pdf in sumatra, adobe, microsoft edge and yeah there is no
> > white line.
> > Seems like it is a firefox issue then.
>
> Hi Mia,
>
> opening your attachment with Firefox 119 (and the version of PDF.js that
> comes with it) on Linux, I was not able to find any white line in your
> attachment or in the output from the you source (with zoom set to 400%).
>
> Just in case it might help,
>
> Pablo
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.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: Double sided pages leave a thin white line on the right side

2023-10-28 Thread Mikael Sundqvist
Hi,

I cannot reproduce it, and I do not see a white line in your file.
Maybe I look at the wrong place.

/Mikael

On Sat, Oct 28, 2023 at 4:11 PM Mia Bikey  wrote:
>
> Hi,
> I was using \setuppagenumbering[alternative=doublesided] to get double sided 
> pages.
> After doing that I noticed a thin white line on the right side.
>
> Here is a Minimal Working Example:
>
> ConTeXt  ver: 2023.09.26 18:19 LMTX
>
> \setupbackgrounds[page][background=color,backgroundcolor=black]
> \setuppagenumbering[alternative=doublesided]
>
> \starttext
> a
> \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
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.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] Double sided pages leave a thin white line on the right side

2023-10-28 Thread Mia Bikey
Hi,
I was using \setuppagenumbering[alternative=doublesided] to get double
sided pages.
After doing that I noticed a thin white line on the right side.

Here is a Minimal Working Example:

ConTeXt  ver: 2023.09.26 18:19 LMTX

\setupbackgrounds[page][background=color,backgroundcolor=black]
\setuppagenumbering[alternative=doublesided]

\starttext
a
\stoptext


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

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


[NTG-context] Re: Framed Text with Chapter Numbers as Counter

2023-09-17 Thread Jeroen
That works fine except that the following line does only issue the
sequential number and not the chapter number.

Refer to \in{code fragment}[tit1] bla

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth;
  h := OverlayHeight;
  o := BodyFontSize;
  p := p shifted (2o,h-ypart center p);
  draw p;
  path b;
  b := boundingbox p enlarged (o/10);
  path a;
  a := (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
  drawoptions (withpen pencircle scaled 1pt withcolor black);
  draw a;
  draw b;
  setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%  style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt}]

\defineenumeration
  [Code]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText,
   left={\somenamedheadnumber{chapter}{current}.}]

\starttext

\startchapter
  [title=first]

\startCode
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCode

\startCode
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCode

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCode
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCode

\stopchapter

\stoptext

Op zo 17 sep 2023 om 17:31 schreef Bruce Horrocks :

>
>
> > On 16 Sep 2023, at 21:28, Jeroen  wrote:
> >
> > This MWE has a framed text for some verbatim text (code) with as title
> ref. a counter 1, 2, etc.. Is there a way to change this frame text title
> as following with the chapter number and a sequential number and the title.
>
> Amemd the \defineenumeration as follows:
>
> \defineenumeration
>   [Counter]
>   [title=yes,
>alternative=empty,
>before=\startCountFramedText,
>after=\stopCountFramedText,
>left={\somenamedheadnumber{chapter}{current}:}]
>
> —
> 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://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Framed Text with Chapter Numbers as Counter

2023-09-16 Thread Jeroen
This MWE has a framed text for some verbatim text (code) with as title ref.
a counter 1, 2, etc.. Is there a way to change this frame text title as
following with the chapter number and a sequential number and the title.

Code Fragment 1.1 (The First Title)
Code Fragment 1.2 (The Second Title)
Code Fragment 2.1 (The Third Title)

MWE:

\startuseMPgraphic{CountFrame}
  picture p; numeric w, h, o;
  p := textext.rt("\wrappedcurrentconstruction");
  w := OverlayWidth; h := OverlayHeight; o := BodyFontSize;
p := p shifted (2o,h-ypart center p);
draw p;
path b;
b := boundingbox p enlarged (o/10);
drawoptions (withpen pencircle scaled 1pt withcolor black);
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h);
draw b;
setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay
  [CountFrame]
  [\useMPgraphic{CountFrame}]

\defineframedtext
  [CountFramedText]
  [frame=off,
   background=CountFrame,
   offset=\bodyfontsize,
   width=\textwidth,
%   style={\switchtobodyfont[11pt,tt]}]
   bodyfont=11pt,
   style={\tt},
   ]

\def\FrameTitle#1%
  {\setMPtext{CountFrame}
  {\hbox spread 1em{\hss\strut#1\hss}}}\setMPtext{CountFrame}
  {}

\defineenumeration
  [Counter]
  [title=yes,
   alternative=empty,
   before=\startCountFramedText,
   after=\stopCountFramedText]

\starttext

\startchapter
  [title=first]

\startCounter
  [title={The First Title},
   reference={tit1}]
   Some verbatim text
\stopCounter

\startCounter
  [title={The Second Title},
   reference={tit2}]
   Some verbatim text
\stopCounter

Refer to \in{code fragment}[tit1] bla

\stopchapter

\startchapter
  [title=second]

\startCounter
  [title={The Third Title},
   reference={tit3}]
   Some verbatim text
\stopCounter

\stopchapter

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

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

[NTG-context] Verbatim Textbox with Reference NUmbering

2023-09-09 Thread Jeroen
This is a longshot, but would be great to have. Below I have at MWE1 the
verbatim codefragment textbox I am using. I found in the forum MWE2 which
is a textbox with an automatic reference number. Is there a way to get the
same for MWE1 with automatic reference numbering like 1.1, 1.2 etc for
chapter 1, codefragment 1, 2 etc. with the possibility that in the text I
can refer to the codefragment like \in{codefragment\space}[code:ccpsample]
similar as to tables and figures? Thanks Jeroen


%%
% MWE1
%%

\startuseMPgraphic{mpos:par:myexample}
path p;
for i = 1 upto nofmultipars :
  p := multipars[1] topenlarged 4pt bottomenlarged 4pt cornered 2mm ;
  fill p withcolor 0.95white ;
  draw p withcolor black
  withpen pencircle scaled \MPvar{linewidth};
  endfor;
\stopuseMPgraphic

\definetextbackground
  [listingbackground]
  [state=start,
   mp=mpos:par:myexample,
   location=paragraph,
   topoffset=0.4em,
   leftoffset=0em,
   rulethickness=0.7pt]

\definetyping[Listing]
  [option=commands]

\setuptyping
  [Listing]
  [bodyfont=10pt,
   margin=1em,
   before=%
 {\blank[3*medium]
  \setupinterlinespace[line=2.4ex]
  \starttextbackground[listingbackground]},
   after=%
 {\stoptextbackground
  \blank[4*medium]},
   align={flushleft,verytolerant}]

\starttext

\startListing
this is a code example
\stopListing

\stoptext


%%
% MWE2
%%

\startuseMPgraphic{FunnyFrame}
  picture p ; numeric w, h, o ;
  p := textext.rt(\MPstring{FunnyFrame}) ;
  w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
  p := p shifted (2o,h-ypart center p) ; draw p ;
  drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
  draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
  draw boundingbox p ;
  setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{}

% Add the enumeration
\defineenumeration
  [Counter]
  [text=,
   alternative=empty,
   before={\FrameTitle{Counter \getnumber[Counter]}
   \startFunnyText},
   after={\stopFunnyText}]

\starttext

\startCounter
First example
\stopCounter

\startCounter
Second example
\stopCounter

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

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

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

2023-09-08 Thread Henning Hraban Ramm

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


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


So far:

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

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

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

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


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

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


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


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


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


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

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

Hraban


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

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

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

2023-09-08 Thread Henning Hraban Ramm

Am 08.09.23 um 16:21 schrieb Wolfgang Schuster:

Henning Hraban Ramm schrieb am 08.09.2023 um 13:09:

Am 08.09.23 um 12:35 schrieb Wolfgang Schuster:

For images (and other content) which are placed on a separate page at 
the start of a chapter
you can use the pageinjection mechanism which was added for this 
purpose.


Thank you!
You’re right, that might be enough.

(Documented only in https://wiki.contextgarden.net/Command/setuphead 
so far. Even the source browser can’t find anything.)

https://source.contextgarden.net/tex/context/base/mkxl/page-inj.mklx


Seems like I didn’t search right (just “pageinjections“?)

But my “image” consists of a background color (with bleed), a 
transparent overlay image (with bleed), a tilted image with a shadow 
on top and a caption (so far) – and pageinjection looks fixed to one 
image. How can I hook my own placement code in there?
We can discuss the details next week and you put the resulting template 
on the wiki.


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


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

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

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

2023-09-08 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 08.09.2023 um 13:09:

Am 08.09.23 um 12:35 schrieb Wolfgang Schuster:

For images (and other content) which are placed on a separate page at 
the start of a chapter
you can use the pageinjection mechanism which was added for this 
purpose.


Thank you!
You’re right, that might be enough.

(Documented only in https://wiki.contextgarden.net/Command/setuphead 
so far. Even the source browser can’t find anything.)

https://source.contextgarden.net/tex/context/base/mkxl/page-inj.mklx
But my “image” consists of a background color (with bleed), a 
transparent overlay image (with bleed), a tilted image with a shadow 
on top and a caption (so far) – and pageinjection looks fixed to one 
image. How can I hook my own placement code in there?
We can discuss the details next week and you put the resulting template 
on the wiki.


Wolfgang

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

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

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

2023-09-08 Thread Henning Hraban Ramm

Am 08.09.23 um 12:35 schrieb Wolfgang Schuster:

For images (and other content) which are placed on a separate page at 
the start of a chapter

you can use the pageinjection mechanism which was added for this purpose.


Thank you!
You’re right, that might be enough.

(Documented only in https://wiki.contextgarden.net/Command/setuphead so 
far. Even the source browser can’t find anything.)


But my “image” consists of a background color (with bleed), a 
transparent overlay image (with bleed), a tilted image with a shadow on 
top and a caption (so far) – and pageinjection looks fixed to one image. 
How can I hook my own placement code in there?


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

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

[NTG-context] Re: Question about building an array of values with Lua

2023-08-24 Thread Fabrice Couvreur
Hi Otared and Wolgang,
Thanks for the answers. In fact, being familiar with Python and not at all
with Lua, I didn't have the reflex to think of using a mathematical
function which gives the remainder in the Euclidean division by 10, it's
strange !!
Fabrice

Le jeu. 24 août 2023 à 04:06, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

> Otared Kavian schrieb am 24.08.2023 um 01:04:
>
> Hi Fabrice,
>
> As Wolfgang points out, it is indeed possible to fill-in your table with
> Lua: maybe you were wondering how to fill the columns 2, 3 and 4. In this
> case you need to use the Lua function math.mod as in the following, which
> is a completed version of what Wolfgang sent:
>
>
> I guess I completely missed the units digit part :)
>
> %% begin filling-with-lua.tex
> \starttext
>
> \startluacode
> context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor =
> "black" }
> context.startxrow{ background = "color", backgroundcolor = "lightgray"
> }
> context.startxcell{ nx = 4 }
> context("Units digit of")
> context.stopxcell()
> context.stopxrow()
> context.startxrow()
> context.startxcell{ width = "1cm" }
> context.im("a")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("a^2")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("b")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("2b^2")
> context.stopxcell()
> context.stopxrow()
> for i = 0,9 do
> context.startxrow()
> for j = 1,4 do
> context.startxcell()
> if j == 1 then
> context(i)
> elseif j == 2 then
> context(math.mod(i*i,10))
>  elseif j == 3 then
>   context(i)
>  else
>   context(math.mod(2*i*i,10))
> end
> context.stopxcell()
> end
> context.stopxrow()
> end
>
>
> I would drop the column check in this case.
>
> for i = 0,9 do
> context.startxrow()
> context.startxcell()
> context(i)
> context.stopxcell()
> context.startxcell()
> context(math.mod(i*i,10))
> context.stopxcell()
> context.startxcell()
> context(i)
> context.stopxcell()
> context.startxcell()
> context(math.mod(2*i*i,10))
> context.stopxcell()
> context.stopxrow()
> end
>
> Wolfgang
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster

Otared Kavian schrieb am 24.08.2023 um 01:04:

Hi Fabrice,

As Wolfgang points out, it is indeed possible to fill-in your table 
with Lua: maybe you were wondering how to fill the columns 2, 3 and 4. 
In this case you need to use the Lua function math.mod as in the 
following, which is a completed version of what Wolfgang sent:


I guess I completely missed the units digit part :)


%% begin filling-with-lua.tex
\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", 
framecolor = "black" }
    context.startxrow{ background = "color", backgroundcolor = 
"lightgray" }

        context.startxcell{ nx = 4 }
            context("Units digit of")
  context.stopxcell()
    context.stopxrow()
    context.startxrow()
context.startxcell{ width = "1cm" }
context.im("a")
        context.stopxcell()
        context.startxcell{ width = "1cm" }
          context.im("a^2")
context.stopxcell()
        context.startxcell{ width = "1cm" }
            context.im("b")
        context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("2b^2")
        context.stopxcell()
    context.stopxrow()
    for i = 0,9 do
        context.startxrow()
            for j = 1,4 do
                context.startxcell()
                    if j == 1 then
              context(i)
                    elseif j == 2 then
context(math.mod(i*i,10))
 elseif j == 3 then
context(i)
 else
context(math.mod(2*i*i,10))
                    end
context.stopxcell()
            end
        context.stopxrow()
    end


I would drop the column check in this case.

    for i = 0,9 do
    context.startxrow()
    context.startxcell()
    context(i)
    context.stopxcell()
    context.startxcell()
    context(math.mod(i*i,10))
    context.stopxcell()
    context.startxcell()
    context(i)
    context.stopxcell()
    context.startxcell()
    context(math.mod(2*i*i,10))
    context.stopxcell()
    context.stopxrow()
    end

Wolfgang

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

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

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Otared Kavian
Hi Fabrice,

As Wolfgang points out, it is indeed possible to fill-in your table with Lua: 
maybe you were wondering how to fill the columns 2, 3 and 4. In this case you 
need to use the Lua function math.mod as in the following, which is a completed 
version of what Wolfgang sent:

%% begin filling-with-lua.tex
\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor = 
"black" }
    context.startxrow{ background = "color", backgroundcolor = "lightgray" }
context.startxcell{ nx = 4 }
context("Units digit of")
context.stopxcell()
context.stopxrow()
context.startxrow()
context.startxcell{ width = "1cm" }
context.im("a")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("a^2")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("b")
context.stopxcell()
context.startxcell{ width = "1cm" }
context.im("2b^2")
context.stopxcell()
context.stopxrow()
for i = 0,9 do
context.startxrow()
for j = 1,4 do
context.startxcell()
if j == 1 then
context(i)
elseif j == 2 then
context(math.mod(i*i,10))
  elseif j == 3 then
context(i)
  else
context(math.mod(2*i*i,10))
end
context.stopxcell()
end
context.stopxrow()
end
context.stopxtable()
\stopluacode

\stoptext
%% end filling-with-lua.tex

Best regards: Otared

> On 23 Aug 2023, at 17:48, Wolfgang Schuster 
>  wrote:
> 
> Fabrice Couvreur schrieb am 23.08.2023 um 19:28:
>> Hi,
>> I'm trying to fill an array using lua. So far it works but then I don't know 
>> if it's possible.
> 
> Where do you have problems (look into cld-mkiv.pdf for hins)?
> 
> \starttext
> 
> \startluacode
> context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor = 
> "black" }
> context.startxrow{ background = "color", backgroundcolor = "lightgray" }
> context.startxcell{ nx = 4 }
> context("Units digit of")
> context.stopxcell()
> context.stopxrow()
> context.startxrow()
> context.startxcell{ width = "1cm" }
> context.im("a")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("a^2")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("b")
> context.stopxcell()
> context.startxcell{ width = "1cm" }
> context.im("2b^2")
> context.stopxcell()
> context.stopxrow()
> for i = 0,9 do
> context.startxrow()
> for j = 1,4 do
> context.startxcell()
> if j == 1 then
> context(i)
> end
> context.stopxcell()
> end
> context.stopxrow()
> end
> context.stopxtable()
> \stopluacode
> 
> \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://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

Otared Kavian
e-mail: ota...@gmail.com
Phone: +33 6 88 26 70 95




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

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

[NTG-context] Re: Question about building an array of values with Lua

2023-08-23 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 23.08.2023 um 19:28:

Hi,
I'm trying to fill an array using lua. So far it works but then I 
don't know if it's possible.


Where do you have problems (look into cld-mkiv.pdf for hins)?

\starttext

\startluacode
context.startxtable{ align = "middle,lohi", bodyfont = "9pt", framecolor 
= "black" }
    context.startxrow{ background = "color", backgroundcolor = 
"lightgray" }

    context.startxcell{ nx = 4 }
    context("Units digit of")
    context.stopxcell()
    context.stopxrow()
    context.startxrow()
    context.startxcell{ width = "1cm" }
    context.im("a")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("a^2")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("b")
    context.stopxcell()
    context.startxcell{ width = "1cm" }
    context.im("2b^2")
    context.stopxcell()
    context.stopxrow()
    for i = 0,9 do
    context.startxrow()
    for j = 1,4 do
    context.startxcell()
    if j == 1 then
    context(i)
    end
    context.stopxcell()
    end
    context.stopxrow()
    end
context.stopxtable()
\stopluacode

\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://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Question about building an array of values with Lua

2023-08-23 Thread Fabrice Couvreur
Hi,
I'm trying to fill an array using lua. So far it works but then I don't
know if it's possible.
Thanks
Fabrice

 \startluacode

context.startxtable({"align={middle,lohi},bodyfont=9pt,framecolor=black"})
  context.startxrow({"background=color,
backgroundcolor=lightgray"})
  context.startxcell({"nx=4"})
  context("Units digit of")
  context.stopxcell()
  context.stopxrow()
  context.startxrow()
  context.startxcell({"width=1cm"})
  context("\\im{a}")
  context.stopxcell()
  context.startxcell({"width=1cm"})
  context("\\im{a²}")
  context.stopxcell()
  context.startxcell({"width=1cm"})
  context("\\im{b}")
  context.stopxcell()
  context.startxcell({"width=1cm"})
  context("\\im{2b²}")
  context.stopxcell()
  context.stopxrow()
  for i = 0, 9 do
  context.startxrow()
  context.startxcell()
  context(i)
  context.stopxcell()
  context.stopxrow()
  end
  context.stopxtable()
 \stopluacode
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

[NTG-context] Re: Equivalent of the \cancel command with conTeXt

2023-08-22 Thread Fabrice Couvreur
Hi Alexander,
Thank you for this suggestion which will do the trick.
Fabrice

Le mar. 22 août 2023 à 10:26, Alexandre Christe  a
écrit :

> Hi Fabrice,
>
> I have this from former exchanges
>
> % Cancel command for use in equations.
> \startuniqueMPgraphic{cross out}
>  picture cross;
>  cross := image(draw (0,0)--(1,1); draw (0,1)--(1,0););
>  draw cross xscaled \overlaywidth yscaled \overlayheight withpen pencircle
> scaled .8pt ;
> \stopuniqueMPgraphic
>
> \defineoverlay[canceloverlay][\uniqueMPgraphic{cross out}]
>
> \define[1]\cancel{%
>  \ifmmode
>  \mframed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
>  \else%
>  \framed[background=canceloverlay, frame=off, offset=overlay]{{#1}}%
>  \fi%
> }
>
> Maybe something else is available nowadays.
>
> A. Christe
> Le 22 août 2023 à 12:22 +0200, Fabrice Couvreur <
> fabrice1.couvr...@gmail.com>, a écrit :
>
> Hi,
> In an algebraic expression, it is sometimes interesting to cross out
> terms. With LaTeX, there is the \cancel command from the package cancel. Is
> there an equivalent with conTeXt ?
> Thanks
> Fabrice
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

  1   2   3   4   5   6   7   8   9   10   >