[NTG-context] Re: how to include an an svg file?

2024-03-12 Thread seyal zavira
Thanks. I appreciate your work

You are correct. when i convert this svg to pdf via inkscape it works like
a charm.

But what is standard way of including an svg file with context if we want
to inkscape render the images?

On Tue, 12 Mar 2024, 21:51 Hans Hagen,  wrote:

> On 3/12/2024 2:53 PM, seyal zavira wrote:
> > thanks for your reply
> >
> > yes but i don't have problem with regular svgs but when svgs has
> > gradient color it does not produce any color in output.
> >
> > you can see my svg in attachment.
> svg gets worse and worse (esp the inheritance model) ... anyway, i can
> sort of get the gradient but no stepwise gradient opacity (in pdf and
> i'm not going to emulate something) (it's not the most interesting stuff
> to work on unpaid)
>
> but ... i don't know if fixing this breaks something else
>
> 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: how to include an an svg file?

2024-03-12 Thread Hans Hagen

On 3/12/2024 2:53 PM, seyal zavira wrote:

thanks for your reply

yes but i don't have problem with regular svgs but when svgs has 
gradient color it does not produce any color in output.


you can see my svg in attachment.
svg gets worse and worse (esp the inheritance model) ... anyway, i can 
sort of get the gradient but no stepwise gradient opacity (in pdf and 
i'm not going to emulate something) (it's not the most interesting stuff 
to work on unpaid)


but ... i don't know if fixing this breaks something else

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: how to include an an svg file?

2024-03-12 Thread Jean-Pierre Delange
Yes, the code given by Seyal gives only the circle vith eyes and mouth 
without colors (on my computer). But, It seems that one have to deal 
with a more complex lines of code. If I'm not mistaken, MetaPost alone 
natively supports only the 3 colours red, green and blue. To support 
CMYK colour gradients, MetaPost needs to work with Metafun (see here : 
https://wiki.contextgarden.net/Color_in_MetaPost).


Perhaps an image in *.png format is required. But I can't give any 
advice, as I'm not an experienced MetaPost/Metafun user.


see this code below and the result as attached file :

\starttext

\input tufte


\externalfigure[smile.svg][conversion=mp]

\stoptext


Best//JP


Le 12/03/2024 à 15:01, Henning Hraban Ramm a écrit :

Am 12.03.24 um 14:53 schrieb seyal zavira:

 > when i want to put some SVGs in my document the svg does not
    render properly here is the code:
 >
 > \starttext
 > \startMPcode
 > draw lmt_svg [
 > filename = "smile.svg"]
 > \stopMPcode
 > \stoptext


I can confirm the problem also with the regular image call

\externalfigure[smile.svg][conversion=mp]

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
___ 


ctx-test-metapost-svg.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: \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Hans Hagen

On 3/12/2024 8:57 AM, Max Chernoff wrote:

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.

the next upload will support the attached ... so no ugly hacky code needed

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
-


inter-001.pdf
Description: Adobe PDF document
\definebar[mybar][inlined][offset=.25ex,color=red]

\starttext

\startformula
a  \alignhere= b + c \breakhere
\mybar {d + e} \alignhere= f \breakhere
g  \alignhere= h + i
\stopformula

\page

\samplefile{knuth}
\startformula
\text{something} + \text{really} + \text{really} + \text{long} 
\alignhere= \sqrt{x} \numberhere
\texthere[inbetween]{\input{knuth}}
d \alignhere= e + f \numberhere \breakhere
g \alignhere= h + i \breakhere
j \alignhere= k + l
\stopformula
\samplefile{knuth}

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

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


[NTG-context] Re: how to include an an svg file?

2024-03-12 Thread Henning Hraban Ramm

Am 12.03.24 um 14:53 schrieb seyal zavira:

 > when i want to put some SVGs in my document the svg does not
render properly here is the code:
 >
 > \starttext
 > \startMPcode
 > draw lmt_svg [
 > filename = "smile.svg"]
 > \stopMPcode
 > \stoptext


I can confirm the problem also with the regular image call

\externalfigure[smile.svg][conversion=mp]

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

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


[NTG-context] Re: how to include an an svg file?

2024-03-12 Thread seyal zavira
thanks for your reply

yes but i don't have problem with regular svgs but when svgs has gradient
color it does not produce any color in output.

you can see my svg in attachment.

On Tue, Mar 12, 2024 at 9:43 AM Jean-Pierre Delange 
wrote:

> Hi !
>
> Did you have a look at this :
>
> https://wiki.contextgarden.net/SVG
>
> Le 12/03/2024 à 14:36, seyal.zav...@gmail.com a écrit :
> > hi all.
> >
> > when i want to put some SVGs in my document the svg does not render
> properly here is the code:
> >
> > \starttext
> > \startMPcode
> > draw lmt_svg [
> > filename = "smile.svg"]
> > \stopMPcode
> > \stoptext
> >
> > also when i look at evenmore manual at page15, for font Abelone-FREE the
> gradients has rendered properly is there difference between rendering such
> fonts and rendering SVGs?
> >
> > if its a font feature how i can use this font features for my svg?
> >
> ___
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.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: how to include an an svg file?

2024-03-12 Thread Jean-Pierre Delange

Hi !

Did you have a look at this :

https://wiki.contextgarden.net/SVG

Le 12/03/2024 à 14:36, seyal.zav...@gmail.com a écrit :

hi all.

when i want to put some SVGs in my document the svg does not render properly 
here is the code:

\starttext
\startMPcode
draw lmt_svg [
filename = "smile.svg"]
\stopMPcode
\stoptext

also when i look at evenmore manual at page15, for font Abelone-FREE the 
gradients has rendered properly is there difference between rendering such 
fonts and rendering SVGs?

if its a font feature how i can use this font features for my svg?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

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

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


[NTG-context] how to include an an svg file?

2024-03-12 Thread seyal . zavira
hi all.

when i want to put some SVGs in my document the svg does not render properly 
here is the code:

\starttext
\startMPcode
draw lmt_svg [
filename = "smile.svg"] 
\stopMPcode
\stoptext

also when i look at evenmore manual at page15, for font Abelone-FREE the 
gradients has rendered properly is there difference between rendering such 
fonts and rendering SVGs?

if its a font feature how i can use this font features for my svg?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Re: \intertext and highlighting with \alignhere/\breakhere

2024-03-12 Thread Hans Hagen

On 3/12/2024 8:57 AM, Max Chernoff wrote:

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.

maybe

\starttexdefinition protected newintertext #1
\leftparbox [global] {
\vadjust pre \bgroup
\forgetall
\vskip.5\strutdp % needs to be more clever in the end
\dontleavehmode\vtop\bgroup
#1
\egroup
\egroup
}
\breakhere
\stoptexdefinition

but i need to discuss it with Mikael as we might integrate something 
better and then it needs to be documented (in the upcoming manual) as well


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: Creating a module for calligraphy practice templates

2024-03-12 Thread Henning Hraban Ramm

Am 12.03.24 um 08:57 schrieb Andres Conrado Montoya:

Hello, list!

I've been working on a module to typeset calligraphy practice templates 
using ConTeXt and MetaPost. You are welcome to check it out on github: 
https://github.com/conradolandia/pauta 



Hi Andrés,

this looks interesting (even if I don’t do calligraphy any more).

Sorry, I can’t help you with your questions.

The structure of the module looks good and should work well with the 
module system.


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] Creating a module for calligraphy practice templates

2024-03-12 Thread Andres Conrado Montoya
Hello, list!

I've been working on a module to typeset calligraphy practice templates
using ConTeXt and MetaPost. You are welcome to check it out on github:
https://github.com/conradolandia/pauta
I'm not including a MWE because the repository has all the current code. I
hope this is fine. I did not want to clutter the list with too much text.
The module is only a single file (t-pauta.mkxl) and some examples of use
and documentation that are still somewhat unfinished, but I've tried to
document the source code as much as I could. If you need clarification
about anything, please let me know.

(At the root of the repository, there is a file build.lua, that is not
really part of the project, just a custom tool I use to process the files,
a sort of minimal build system. You can ignore it.)

I welcome any kind of suggestions and dire warnings. I've tried to read the
wiki and the manuals carefully and made as many tests as possible, and in
general it works fine, but I have ADHD and things frequently get over
my head. There are still some things that don't work as they should, and
things that need improvement:

1. I use top/bottom areas to display some info. These areas are not being
handled properly so far. For example, if I place a chapter before the Pauta
macro invocation, there will be data on the top and bottom areas in the
last page of the chapter. I've tried using \page and clearing the areas,
which feels like cheating, but still does not work well. Any ideas on how
to better handle this are more than welcome.

2. I'm using what I found at
https://wiki.contextgarden.net/System_Macros/Handling_Arguments and
\getparameters to handle the arguments for my Pauta macro, but today I
found out about \processaction at
https://wiki.contextgarden.net/Module_Parameters and I'm not really sure if
I should change my module to work with this instead of \getparameters. In
general, after checking the source code of several modules, I'm not really
sure how much I have to follow the guidelines at
https://wiki.contextgarden.net/Module_Parameters or if those are the most
current recommendations.

3. I'm including in my module the code of the file hatching.mp that can be
found at
https://ctan.org/tex-archive/graphics/metapost/contrib/macros/hatching. I
did this for portability reasons, since it's less than 70 lines and has not
been updated in 20 years. But if it's better to have this in a separate
file, please let me know. Also, if a better method to create pattern filled
paths is available, please let me know, I confess I didn't look too much
into it yet. This has solved my requirement so far.

4. I want to be as close as possible to the new LMTX syntax and way of
doing things. so If you think I'm doing something in anachronistic ways,
please let me know.

In general, if someone wants to check it out and provide feedback so I can
improve it, with the objective of eventually being shared on
modules.contextgarden.net, will be much appreciated.

Thank you for your time, and have a great week!

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

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


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

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