[NTG-context] Re: Metapost label text surrounded by white border

2023-11-20 Thread Emanuel Han via ntg-context
Thanks Hraban. This indeed helped. 

It‘s my first reply in this mailing list. Hope I do it right by „replying to 
all“.

> Am 19.11.2023 um 19:37 schrieb Henning Hraban Ramm :
> 
> Am 19.11.23 um 16:41 schrieb Emanuel Han via ntg-context:
>> I'd like to surround black text with a white 1mm thick border in a Metapost 
>> label. Here is my code, which doesn't draw the border at all and which draws 
>> the text in white instead of black (I'm using mkiv and mkxl version 
>> 2023.09.26 18:19 on osx-arm6):
>> |
>> |beginfig(1);
>> % Define the text and colors
>> string label_text;
>> label_text = "Your Text";
>> color text_color, border_color;
>> text_color = black;
>> border_color = white;
>> % Draw the label with the specified colors
>> label(textext(label_text) scaled 1.0, origin) withcolor text_color 
>> withpen pencircle scaled 1mm withcolor border_color;
>> endfig;|
> 
> Have a look into luametafun.pdf (p.10) if lmt_outline does what you want.
> 
> 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] Drawing calligraphy practice grid in metafun

2023-11-20 Thread Andres Conrado Montoya
Hello list
I've been working on a little project of mine. I give calligraphy workshops
and I have been using a nice tool created by Josselin Cuette, available at
http://ductus.josselincuette.com/ to generate practice templates for
interested people.

However, I would prefer to have an offline solution. This adventure started
with the usual insidious idea: "I could do this in ConTeXt! And this is a
great opportunity to learn metafun!"

A couple weeks later, I have an almost ready product! It compiles fine, but
I have the following issue: The template creates a Line, composed of
Sections. And uses variables to assign a measurement for the nib-width, and
an amount of ascender, x-height and descender Sections (nib-widths), to
compose a Line.

But also, I would like to, if needed, display nib-width marks on the left
side. My code so far generates marks, but only for the first Line. I think
they are generated but maybe they are placed on top of each other, maybe?
I'm not sure why my logic is not working.

Also, if I change the amount for ascenders, descenders of x-height, the
marks are not drawn correctly.

My current path for a mark is a custom path emulating two unit squares,
nib-width size, on top of each other, with the top one shifted a nib-width
to the right. A little bit like a chess board, or a scale ruler on a map.
But this would only work in Lines that have an even amount of Sections. I'm
not sure how to proceed with that... I tried using unit squares, but that
made things very complex, and after fumbling around I managed to get this
far.

If you can take a look, or have some advice, it would be greatly
appreciated. I hope it is understandable.

My code:

%%
\setuppapersize[letter,landscape][letter,landscape]
\setuplayout[backspace=15mm,width=250mm,header=0mm,footer=0mm]

\startreusableMPgraphic{pauta}
  % Global variables:

  % Show nib-width marks
  boolean marks ; marks := true ;

  % Path for nib-width
  path mark ; mark := (0,0) -- (1,0) -- (1,2) -- (2,2) -- (2,1) -- (0,1) --
cycle ;

  % Line width
  numeric line ; line := \the\textwidth ;

  % Type box
  numeric box ; box := \the\textheight ;

  % Nib width (distance between lines)
  numeric nib ; nib := 3mm ;

  % Ascenders for writing line
  numeric asc ; asc := 3 ;

  % x-height for writing line
  numeric med ; med := 4 ;

  % Descenders for writing line
  numeric dsc ; dsc := 3 ;

  % Total height of a writing line in mm (including asc, med, and dsc)
  numeric lineHeight ;
  lineHeight = (asc + med + dsc) * nib ;

  % Available lines on a page
  numeric availableLines ;
  availableLines = round(box / lineHeight) - 1 ;

  % Starting position
  numeric start ; start := 0 ;

  % Macros

  % Draw a section of a line (ascender, x-height or descender)
  vardef Section(expr lines, initial) =
draw (0, initial) -- (line, initial) withpen pencircle scaled 0.2mm ;
for i=0 step 1 until lines :
  save final ; final = i*nib ;
  pair a; a = (0, final + initial) ;
  pair b; b = (line, final + initial) ;
  draw a -- b withpen pencircle scaled 0.1mm ;
  % If marks=true show nib-width marks
  if marks = true:
fill mark scaled nib yshifted (final*2) ;
  fi ;
endfor ;
  draw (0, final + initial) -- (line, final + initial)
withpen pencircle scaled 0.2mm ;
final + initial
  enddef ;

  % Draw a line with the three secions (asc, med, dsc)
  vardef Line(expr descender, ascender, xheight, initial) =
numeric dd, oo, aa ;
% Líneas
dd = Section(descender, initial) ;
oo = Section(xheight, dd) ;
aa = Section(ascender, oo) ;
% Devolver posicion final con espacio para siguiente renglon
aa + nib*2
  enddef ;

  % Llenar la página con renglones
  for i=1 upto availableLines :
start := Line(dsc, asc, med, start) ;
  endfor ;
\stopreusableMPgraphic

\startdocument
  \startstandardmakeup
\reuseMPgraphic{pauta}
  \stopstandardmakeup
\stopdocument
%%

-- 
Andrés Conrado Montoya
Andi Kú
andresconr...@gmail.com
http://sesentaycuatro.com
http://messier87.com
http://chiquitico.org

Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.


“You develop an instant global consciousness, a people orientation, an
intense dissatisfaction with the state of the world, and a compulsion to do
something about it. From out there on the moon, international politics look
so petty. You want to grab a politician by the scruff of the neck and drag
him a quarter of a million miles out and say, ‘Look at that, you son of a
bitch.’” — Apollo 14 astronaut Edgar Mitchell
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 

[NTG-context] Re: Strange behavior with anglestriped()

2023-11-20 Thread Fabrice L
Hi,

Fabrice, you have a problem with the definition of the path b: this path 
include q and b. To see this, replace your lines with :

   draw q anglestriped (1,45,2) withcolor cyan;
   draw b anglestriped (1,45,2) withcolor red;

And you will see that the path b is drawn twice : once in red, once in cyan. So 
if you change your instructions to :

   draw q anglestriped (1,45,2) withcolor cyan;
   draw r anglestriped (1,45,2) withcolor cyan;

This will correct the problem, because each path is now drawn only once. 

Fabrice. 

> Le 20 nov. 2023 à 14:47, Fabrice Couvreur  a 
> écrit :
> 
> Hi Otared,
> It's true that the color seems identical.
> Thanks.
> Fabrice
> 
> Le dim. 19 nov. 2023 à 21:55, Otared Kavian  > a écrit :
>> Hi Fabrice,
>> 
>> It seems to me the colors are the same, although they may appear different 
>> at first sight because the « with » of the lines are different (the width is 
>> larger in the lower rectangle).
>> 
>> I attach the PDF created with your code.
>> 
>> Best regards: Otared
>> 
>> 
>> 
>>> On 19 Nov 2023, at 18:56, Fabrice Couvreur >> > wrote:
>>> 
>>> Hi,
>>> I don't understand why the hatching of the two rectangles is not the same 
>>> color. 
>>> Thanks for your help.
>>> Fabrice
>>> 
>>> \starttext
>>> \setupbodyfont[8pt]
>>> \startMPcode
>>>path p, q, r, b ;
>>>  
>>>z[0] = (2cm,0cm) ;
>>>z[1] = (2cm,2cm) ;
>>>z[2] = (0cm,2cm) ;
>>> 
>>>p := unitsquare xyscaled (9cm, 5cm) ;
>>>q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>>>r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>>>b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>>>z[0]--llcorner p--cycle ;
>>>
>>>   
>>>draw b anglestriped (1,45,2) withcolor cyan;
>>>draw q anglestriped (1,45,2) withcolor cyan;
>>>
>>>draw p ;
>>>
>>>label.llft("A", p) ;
>>>label.lrt("D", p) ;
>>>label.ulft("B", p) ;
>>>label.urt("C", p) ;
>>>label.lft("M", z[2]) ;
>>>label.ulft("N", z[1]) ;
>>>label.bot("P", z[0]) ;
>>>label.top("J", ulcorner r) ;
>>>label.rt("I", lrcorner r) ;
>>>label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>>>label.lft(btex $x$ etex,(llcorner p+z[2])/2);
>>> \stopMPcode
>>> 
>>> \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 
>>> ___
>> 
>> 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://mailman.ntg.nl/mailman3/lists/ntg-context.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 : 

[NTG-context] Re: Strange behavior with anglestriped()

2023-11-20 Thread Fabrice Couvreur
Hi Otared,
It's true that the color seems identical.
Thanks.
Fabrice

Le dim. 19 nov. 2023 à 21:55, Otared Kavian  a écrit :

> Hi Fabrice,
>
> It seems to me the colors are the same, although they may appear different
> at first sight because the « with » of the lines are different (the width
> is larger in the lower rectangle).
>
> I attach the PDF created with your code.
>
> Best regards: Otared
>
>
>
> On 19 Nov 2023, at 18:56, Fabrice Couvreur 
> wrote:
>
> Hi,
> I don't understand why the hatching of the two rectangles is not the same
> color.
> Thanks for your help.
> Fabrice
>
> \starttext
> \setupbodyfont[8pt]
> \startMPcode
>path p, q, r, b ;
>
>z[0] = (2cm,0cm) ;
>z[1] = (2cm,2cm) ;
>z[2] = (0cm,2cm) ;
>
>p := unitsquare xyscaled (9cm, 5cm) ;
>q := llcorner p--z[0]--z[1]--z[2]--cycle ;
>r := unitsquare xyscaled (7cm,3cm) shifted(2cm,2cm) ;
>b := z[2]--z[1]--ulcorner r--urcorner p--lrcorner r--z[1]--
>z[0]--llcorner p--cycle ;
>
>
>draw b anglestriped (1,45,2) withcolor cyan;
>draw q anglestriped (1,45,2) withcolor cyan;
>
>draw p ;
>
>label.llft("A", p) ;
>label.lrt("D", p) ;
>label.ulft("B", p) ;
>label.urt("C", p) ;
>label.lft("M", z[2]) ;
>label.ulft("N", z[1]) ;
>label.bot("P", z[0]) ;
>label.top("J", ulcorner r) ;
>label.rt("I", lrcorner r) ;
>label.bot(btex $x$ etex,(llcorner p+z[0])/2);
>label.lft(btex $x$ etex,(llcorner p+z[2])/2);
> \stopMPcode
>
> \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
>
> ___
>
>
> 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://mailman.ntg.nl/mailman3/lists/ntg-context.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] (again) wrong destination types?

2023-11-20 Thread Pablo Rodriguez via ntg-context
Dear list,

sorry for insisting, but this is important for my documents.

I have the following sample:

 \setupinteraction[state=start, page=name, focus=standard]
  \starttext
  a\footnote{b}
  \stoptext

If page is set to anything different than no in \setupinteractionscreen,
focus=standard will not work (it will be used as focus=fit).

Could anyone confirm the issue or explain me what I’m doing wrong?

Many thanks for your help

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

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


[NTG-context] Re: unwanted blank page

2023-11-20 Thread Pablo Rodriguez via ntg-context
On 11/19/23 23:34, madiazm.eo...@gmail.com wrote:
> sorry if i dont get your problem right understood, but i'm completely
> new to context.

Hi Miguel,

I’m afraid it isn’t entirely clear whether you intend to ask something
or not.

> I use a hack not to get the number not printed in the title page
> (though I define sectionblocks for keeping different numbering systems
> for the table of contents and the document)

Section blocks are intended for that.

Just a comment, if your cover (or title) page involves a one and only
single page, you may use makeups, such as in:

  \starttext
  \startmakeup[standard][pagestate=start]
  \dorecurse{25}{\input knuth}
  \stopmakeup
  \stoptext

My sample explicitly displays that makeups are intended for a single page.

Since actual content for that makeup would fit in six pages without the
makeup, it looks weird inside it.

> I use \setuppagenumbering[location=] for not getting the number
> printed and then I reset the page numbering for the next sections. I
> copy my code so that you know what I do.
> Sorry if it doesnt help

If you are showing your code to list members, fine.

Sorry, but if there is a question here, I’m afraid you need to be more
explicit asking your question.

Just some comments:

> %%
> %%% LOS BLOQUES %
> %%%

In a minimal sample, comments as the previous one don’t provide any clue
to understand your code or the issue you might be dealing with.

It is wiser to keep the sample to its minimal form.

>   \startsectionblock[portada]
>   \setuppagenumbering[location=]
>   \input{03_portadaEval.tex}%this is my title page

It is better to provide actual content than a file name.

BTW, if its contents cannot be in more than a single page, the approach
suggested above might be easier.


> \startfrontmatter[]

Empty brackets are not required here.

> \start
>   \setuplayout[re
>   \setupinterlinespace[.8ex]

I would say that this is extremely small even for an "x" to fit in.

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


[NTG-context] Re: learning about the grid

2023-11-20 Thread Wolfgang Schuster

madiazm.eo...@gmail.com schrieb am 19.11.2023 um 23:17:

Thanks, Pablo and Henning

I suppose I am making a mistake with my setupinterlinearspace. My school asks 
for Times New Roman (I use termes) 12pt and onehalfspacing. In latex I used 
linespread{1.3} and so I supposed setting ConTeXt with 
setupinterlinearspace[1.3ex] was the right way (I read somewhere that vertical 
spaces should be measured in ex and horizontal spaces in em; maybe it's not 
widely accepted).
I tried setting my interlinearspace to 3ex and it looked much better, but I 
must compare it with a onehalfspacing of wordprocessors to be sure it is not 
such different.


The unit ex uses the x-height value of the font as dimension, the 
x-height is the height of the lowercase x (actually it's a value in the 
font which is most cases equal to the height of the lowercase x) as can 
be seen in the output of the following example.


\starttext

\heightofstring{x}

\the\exheight

\stoptext

To get one and a half line of interlinespace with ConTeXt you can set a 
fixed value with the \setupinterlinespace command.


\setupinterlinespace[line=18pt]

\showgrid

\starttext
\samplefile{lorem}
\stoptext

Wolfgang

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

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


[NTG-context] Re: learning about the grid

2023-11-20 Thread Pablo Rodriguez via ntg-context
On 11/19/23 23:17, madiazm.eo...@gmail.com wrote:
> Thanks, Pablo and Henning
>
> I suppose I am making a mistake with my setupinterlinearspace. My
> school asks for Times New Roman (I use termes) 12pt and
> onehalfspacing. In latex I used linespread{1.3} and so I supposed
> setting ConTeXt with setupinterlinearspace[1.3ex] was the right way.

Hi Miguel,

sorry, but I don’t have any idea what \linespread might mean for LaTeX
in plain English.

Some ConTeXt users may also use LaTeX too, but don’t rely on that.

> (I read somewhere that vertical spaces should be measured in ex and
> horizontal spaces in em; maybe it's not widely accepted).

As far as I know, em is defined by the width of the capital 'M' and ex
is defined by the height of the lowercase 'x'.

With your requirements, I think it is easier to set line spacing to one
and a half line with 1.5em, such as in:

  \setupbodyfont[termes]
  \starttext
  \the\exheight\\
  \the\dimexpr3\exheight\\
  \the\emwidth
  \the\dimexpr1.5\emwidth\\
  \stoptext

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
___


[NTG-context] Re: It works after a few changes but ..

2023-11-20 Thread Ursula Hermann
Dear Bruce, 

Yes, I need also margintext. 

Many thanks 
Uschi 

-Ursprüngliche Nachricht-
Von: Bruce Horrocks  
Gesendet: Samstag, 18. November 2023 15:48
An: ntg-context mailing list 
Betreff: [NTG-context] Re: It works after a few changes but ..


> On 17 Nov 2023, at 14:06, Ursula Hermann  wrote:
> 
> \margintext{2.1.1}{\starttheorem {The square on the hypotenuse is 
> equal to the sum of the squares on the other two sides. Ach is das 
> schön, dass du da bist} \stoptheorem

The spurious parentheses seem to be a side-effect of having unmatched curly 
brackets in the bit that I have quoted.

The following eliminates them:

\definemargindata  [MyInMargin][inright] 
\definemarginframed[MyInMargin][topframe=on,bottomframe=on,rulethickness=1pt,width=1cm]
\margintext{\blackrule[color=black, height=0.25ex, 
width=1cm]\\}\blackrule[color=black, height=0.25ex, width=7cm] 
\setupenumerations  [ before={\blank[big]},
   after={\blank[big]},
   location=serried,
   width=broad,
   distance=0.5em,
   headstyle=bold,
   titlestyle=normal,
   way=bytext,
   conversion=numbers]
\defineenumeration
 [theorem]
 [text=Theorem,
 title=yes,
 style=italic,
  list=all,
  listtext={Theorem }]
\starttext
\margintext{2.1.1}{\starttheorem The square on the hypotenuse is equal to the 
sum of the squares on the other two sides. Ach is das schön, dass du da bist 
\stoptheorem } \stoptext

I see also in this thread that you have sad "yes" to Aditya's suggestion. But 
that doesn't have the margintext. Do you still want/need margintext?

—
Bruce Horrocks
Hampshire, UK



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