Re: [NTG-context] running gnuplot failure

2020-03-29 Thread Jan-Erik Hägglöf
That was working just fine, thank you so much!

Janne

> 30 mars 2020 kl. 01:48 skrev Hans Hagen :
> 
> On 3/29/2020 8:32 PM, Jan-Erik Hägglöf wrote:
>> Hi!
>> I have tried to run the following codeexample with no success
>> \usemodule
>> [gnuplot]
> in lmtx gnuplot can be done like this (here i just write the file but it can 
> be external or a saved buffer or ... ):
> 
> \usemodule[gnuplot]
> 
> \startluacode
> io.savedata("m-gnuplot-demo.gp", [[
> set format xy "$%g$"
> 
> set title  'This is a plot of $y=\\sin(x)$'
> set xlabel 'This is the $x$ axis'
> set ylabel 'This is the $y$ axis'
> 
> plot [0:6.28] [0:1] sin(x)
> ]])
> \stopluacode
> 
> \starttext
> 
>\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=4cm]
> 
>\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=8cm]
> 
> \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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] running gnuplot failure

2020-03-29 Thread Hans Hagen

On 3/29/2020 8:32 PM, Jan-Erik Hägglöf wrote:

Hi!

I have tried to run the following codeexample with no success

\usemodule
[gnuplot]
in lmtx gnuplot can be done like this (here i just write the file but it 
can be external or a saved buffer or ... ):


\usemodule[gnuplot]

\startluacode
io.savedata("m-gnuplot-demo.gp", [[
set format xy "$%g$"

set title  'This is a plot of $y=\\sin(x)$'
set xlabel 'This is the $x$ axis'
set ylabel 'This is the $y$ axis'

plot [0:6.28] [0:1] sin(x)
]])
\stopluacode

\starttext

\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=4cm]

\externalfigure[m-gnuplot-demo.gp][conversion=svg,width=8cm]

\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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Different behaviour of textcommand (setupcaption+startplacefigure)

2020-03-29 Thread Tomas Hala
Sun, Mar 29, 2020 ve 08:24:53PM +0200 Wolfgang Schuster napsal(a):
# Tomas Hala schrieb am 29.03.2020 um 19:55:
# >Hi all,
# >
# >I noticed the difference in behaviour of textcommand which depends
# >on the location: for top, bottom and page the \crlf (see MWE) is applied
# >while for the left and right not even if other values (\red, any-text)
# >are used as expecterd.
# >
# >How could I activate the textcommand=\crlf for location=right?
# >(The line break appears only the width of the figure becomes too small.)
# >
# >Tested with TL2019 and with version from Mar 6, 2020.
#
# 1. The cow figure is a PDF file.

Typo during cleaning the MWE, sorry.

# 2. Use the "spaceinbetween" key to add a break after the label + counter.

Unfortunately, spaceinbetween does not work with "right", too, I tried it 
before.

# 3. Captions use "width=fit" as default setting which produces a
# horizontal box for your side float which ignores the \crlf command,
# when you change the setting to "width=max" in combination with
# "align=middle" the title start on a new line.

Thank you for the explanation, now it is clear.
And for the piece of code, too.

Best wishes,

Tomáš

#
# \setupexternalfigures
#   [location=default]
#
# \setupcaption
#   [figure]
#   [spaceinbetween=none,
# width=max,
# align=middle]
#
# \starttext
#
# \startplacefigure[location=top,title=Cow]
#   \externalfigure[cow][height=4cm]
# \stopplacefigure
# \samplefile{knuth}
#
# \startplacefigure[location=right,title=Cow]
#   \externalfigure[cow][height=4cm]
# \stopplacefigure
# \samplefile{knuth}
#
# \stoptext
#
# Wolfgang

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

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


Re: [NTG-context] Nodes module for commutative diagrams etc

2020-03-29 Thread Wolfgang Schuster

Weber, Matthias schrieb am 29.03.2020 um 21:02:

Dear list,

I need to typeset a handful of simple commutative diagrams like the one below, 
and I found the nodes manual by Alan that has exactly what I want.

But what is the incantation to load the module, or am I missing something else?

Thanks,

Matthias

\starttext
\startMPcode
path p ;
p := fullsquare scaled 3cm ;
nodepath = p ;
draw node(0,"\node{$G(X)$}") ;
draw node(1,"\node{$G(Y)$}") ;
draw node(2,"\node{$F(Y)$}") ;
draw node(3,"\node{$F(X)$}") ;
drawarrow fromto.bot(0,0,1, "\nodeSmall{$G(f)$}") ; drawarrow fromto.top(0,3,2, 
"\nodeSmall{$F(f)$}") ; drawarrow fromto.rt (0,2,1, "\nodeSmall{$η_Y$}") ; drawarrow 
fromto.lft(0,3,0, "\nodeSmall{$η_X$}") ;
\stopMPcode
\stoptext


The code is loaded by default but you have to change the \nodeSmall 
command to \smallnode, I guess the command name has changed after the 
manual was written.


@Alan: Even after this fix there is something wrong with the module 
because I get no output from the MetaPost graphic while the TeX example 
in the manual works.


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

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


Re: [NTG-context] Primes far too high in Lucida Type1

2020-03-29 Thread Wolfgang Schuster

Tim Steenvoorden schrieb am 22.03.2020 um 12:10:

Hi all,

I’m trying to typeset a document using Lucida Type1 fonts. Primes are 
put way too high. Also, kerning with punctuation characters placed after 
a prime are too wide. This can be seen in attached rendering of below 
example.


 $e,\sigma \rightarrow e',\sigma’$

Is there a quick way to fix this? I don’t have access tot the OTF 
unfortunately. Running ConTeXt TeXlive 2019 on macOS 10.15.3.


I'm sorry for the bad news but without a patch for the font (which can 
probably applied with a goodies file) there is nothing which can be 
done. As the Type 1 version of the Lucida fonts had a few problems in 
the last few years with ConTeXt MkIV I don't think Hans has much 
interest to fix them again (especially when you can expect new problems 
in the future).


The best way here is to use another font or spend the money for the 
OpenType version.


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

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


[NTG-context] Nodes module for commutative diagrams etc

2020-03-29 Thread Weber, Matthias
Dear list,

I need to typeset a handful of simple commutative diagrams like the one below, 
and I found the nodes manual by Alan that has exactly what I want.

But what is the incantation to load the module, or am I missing something else?

Thanks,

Matthias

\starttext 
\startMPcode
path p ; 
p := fullsquare scaled 3cm ;
nodepath = p ;
draw node(0,"\node{$G(X)$}") ;
draw node(1,"\node{$G(Y)$}") ;
draw node(2,"\node{$F(Y)$}") ;
draw node(3,"\node{$F(X)$}") ;
drawarrow fromto.bot(0,0,1, "\nodeSmall{$G(f)$}") ; drawarrow fromto.top(0,3,2, 
"\nodeSmall{$F(f)$}") ; drawarrow fromto.rt (0,2,1, "\nodeSmall{$η_Y$}") ; 
drawarrow fromto.lft(0,3,0, "\nodeSmall{$η_X$}") ;
\stopMPcode
\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] running gnuplot failure

2020-03-29 Thread Jan-Erik Hägglöf
Hi!I have tried to run the following codeexample with no success\usemodule[gnuplot] \setupGNUPLOTterminal[context][width=5in,height=2.5in,fontscale=0.9] \setupGNUPLOTterminal[tikz][width=5in,height=2.5in,fontscale=0.9] \starttext\startGNUPLOTinclusionsset samples 400set key left Left reverse\stopGNUPLOTinclusion\startGNUPLOTscript[myfunction]set zeroaxisset format y "%.1f"plot [-4:2][0:2] 1 t '' lt 0, exp(x) t '$e^x$' lt 1 lw 3plot cos(atan(x))*sin(x) t '$\cos(\arctan(x))\sin(x)$' lw 3 lc 3 \stopGNUPLOTscript\placefigure{none}{\useGNUPLOTgraphic[myfunction][2]} \setupGNUPLOT[terminal=tikz] \placefigure{none}{\useGNUPLOTgraphic[myfunction][1]} \stoptextTitle: ConTeXt Error Information










ConTeXt Error Information






edit




Error   ! Undefined control sequence
File    ./test3.tex
Line    4



 1 \usemodule
 2 [gnuplot] 
 3 
 4 >>  \setupGNUPLOTterminal
 5 [context]
 6 [width=5in,height=2.5in,fontscale=0.9] 
 7 
 8 \setupGNUPLOTterminal
 9 [tikz][width=5in,height=2.5in,fontscale=0.9] 
10 
11 \starttext
12 \startGNUPLOTinclusions
13 set samples 400
14 set key left Left reverse


Job Name: test3    
ConTeXt Version: 2020.03.10 14:52    
Real Page: 1    
Page: 1    



I’ve done the following in my LMTX installationmtxrun —generatecontext —make —allI am running gnuplot 5.2 installed via brewand I also checked that the terminal tikz is supported viaset termSo the module seems to be thereIs there something more I need to do?Regards Janne___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Different behaviour of textcommand (setupcaption+startplacefigure)

2020-03-29 Thread Wolfgang Schuster

Tomas Hala schrieb am 29.03.2020 um 19:55:

Hi all,

I noticed the difference in behaviour of textcommand which depends
on the location: for top, bottom and page the \crlf (see MWE) is applied
while for the left and right not even if other values (\red, any-text)
are used as expecterd.

How could I activate the textcommand=\crlf for location=right?
(The line break appears only the width of the figure becomes too small.)

Tested with TL2019 and with version from Mar 6, 2020.


1. The cow figure is a PDF file.

2. Use the "spaceinbetween" key to add a break after the label + counter.

3. Captions use "width=fit" as default setting which produces a 
horizontal box for your side float which ignores the \crlf command, when 
you change the setting to "width=max" in combination with "align=middle" 
the title start on a new line.


\setupexternalfigures
  [location=default]

\setupcaption
  [figure]
  [spaceinbetween=none,
width=max,
align=middle]

\starttext

\startplacefigure[location=top,title=Cow]
  \externalfigure[cow][height=4cm]
\stopplacefigure
\samplefile{knuth}

\startplacefigure[location=right,title=Cow]
  \externalfigure[cow][height=4cm]
\stopplacefigure
\samplefile{knuth}

\stoptext

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

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


[NTG-context] Different behaviour of textcommand (setupcaption+startplacefigure)

2020-03-29 Thread Tomas Hala
Hi all, 

I noticed the difference in behaviour of textcommand which depends
on the location: for top, bottom and page the \crlf (see MWE) is applied
while for the left and right not even if other values (\red, any-text)
are used as expecterd.

How could I activate the textcommand=\crlf for location=right?
(The line break appears only the width of the figure becomes too small.)

Tested with TL2019 and with version from Mar 6, 2020.

Best wishes,

Tomáš


%% MWE:

\starttext

\setupcaption[figure][textcommand=\crlf]
\startplacefigure[location=top,title=Cow]
  \externalfigure[cow.jpg][height=4cm]
\stopplacefigure
\input knuth

\setupcaption[figure][textcommand=\crlf]
\startplacefigure[location=right,title=Cow]
  \externalfigure[cow.jpg][height=4cm]
\stopplacefigure
\input knuth

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

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


Re: [NTG-context] Space around comma in math mode

2020-03-29 Thread Wolfgang Schuster

w n schrieb am 29.03.2020 um 16:10:

That works, great
Just curious, is this setup described on the Context Wiki, or on the mailing
list ?


https://wiki.contextgarden.net/Command/setupmathematics#Syntax

PS. The wiki has a search function.

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Gerben Wierda
We should move this to the thread

What alternative for scantokens( "btex " & texcommands & " etex”)?

I’ve put my vardef there. The calls to this vardef are created by lua code.

I need to fix two things: use a string variable to build a btex-etex construct 
and be able to use (almost) any character in that variable. 

I can adapt the strings, if I know what I have to replace things with. I can 
manipulate the strings while still in lua. But if I change it and then via MP 
hand it to a \type{} statement in ConTeXt the replacement will be typeset 
literally. So, it will be pretty complex. If I drop the use of \type{} inside 
the btex-etex I have to ‘escape' everything that TeX doesn’t see as normal text 
catcode. That, again might play havoc with breaking words across lines later.

G

> On 29 Mar 2020, at 15:09, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 29.03.2020 um 15:06:
>>> On 29 Mar 2020, at 14:35, Wolfgang Schuster 
>>> >> > wrote:
>>> 
>>> Gerben Wierda schrieb am 29.03.2020 um 14:30:
> On 29 Mar 2020, at 12:58, Wolfgang Schuster 
>  > wrote:
> 
> Gerben Wierda schrieb am 29.03.2020 um 12:52:
>> I am using MetaFun (Lua code) to create METAPOST commands from an XML 
>> file. One of the issues I am running into that in METAPOST I have to 
>> handle strings with " characters in them and METAPOST doesn’t like 
>> those. The argument using the string
>> Foo "Bar” Foo
> 
> ^^^
> 
> Use correct left quotation marks or \quotation{…}.
 I’m not hard coding the string, I’m reading it from an XML. So, whatever I 
 do, I need to do it by manipulating the string.
 E.g. if the string I read contains
 Foo "Bar” Foo
 your suggestion means  I have to programmatically change that to
 Foo \quotation{Bar} Foo
 which is too complicated, given that I don’t have regular expression 
 replace at my disposal.
 I might be able to change al “ instances into something else by walking 
 through the string and building a new one.
>>> 
>>> Your example uses " before Bar and not “ which is the problem.
>> Yes, I am aware that that is my problem. It is just that I do not have the 
>> luxury to decide myself what will be put in the string. It must work for any 
>> string. So, I will have to be putting that string to \type and make sure 
>> that is used as the label.
> 
> Does btex .. etex help or can't you change the strings and replace the 
> quotation marks before you pass them to MetaPost?
> 
> \starttext
> 
> \startMPcode
> draw textext.urt("One");
> draw btex "Two" etex shifted (0,15);
> label.urt("Three",(0,30));
> label.urt(btex "Four" etex,(0,45));
> \stopMPcode
> 
> \stoptext
> 
> Wolfgang

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

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


Re: [NTG-context] Space around comma in math mode

2020-03-29 Thread w n
That works, great
Just curious, is this setup described on the Context Wiki, or on the mailing
list ?

Thanks for the help

On Sun, Mar 29, 2020 at 3:28 PM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> w n schrieb am 29.03.2020 um 15:20:
> > Hi,
> >
> > I am using
> > $ context --version
> > mtx-context | ConTeXt Process Management 1.03
> > mtx-context |
> > mtx-context | main context file:
> > /opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
> > mtx-context | current version: 2020.01.30 14:13
> > mtx-context | main context file:
> > /opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkxl
> > mtx-context | current version: 2020.01.30 14:13
> >
> > I am seeing some space in the PDF output when using comma's in math mode.
> > The space is between the "," and the "2". How can I eliminate this
> > extra space ?
> > \starttext
> > Some text $1,23$
> > \stoptext
>
> \setupmathematics[autopunctuation=yes] % autopunctuation=comma
>
> Wolfgang
>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Space around comma in math mode

2020-03-29 Thread Wolfgang Schuster

w n schrieb am 29.03.2020 um 15:20:

Hi,

I am using
$ context --version
mtx-context     | ConTeXt Process Management 1.03
mtx-context     |
mtx-context     | main context file: 
/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv

mtx-context     | current version: 2020.01.30 14:13
mtx-context     | main context file: 
/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkxl

mtx-context     | current version: 2020.01.30 14:13

I am seeing some space in the PDF output when using comma's in math mode.
The space is between the "," and the "2". How can I eliminate this 
extra space ?

\starttext
Some text $1,23$
\stoptext


\setupmathematics[autopunctuation=yes] % autopunctuation=comma

Wolfgang

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

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


[NTG-context] Space around comma in math mode

2020-03-29 Thread w n
Hi,

I am using
$ context --version
mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file:
/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.01.30 14:13
mtx-context | main context file:
/opt/context/tex/texmf-context/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.01.30 14:13

I am seeing some space in the PDF output when using comma's in math mode.
The space is between the "," and the "2". How can I eliminate this extra
space ?
\starttext
Some text $1,23$
\stoptext

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

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


[NTG-context] What alternative for scantokens( "btex " & texcommands & " etex")?

2020-03-29 Thread Gerben Wierda
I’m trying in METAPOST to build a command to pass on to ConTeXt using btex/etex.

picture p; p := scantokens( "btex " & texcommands & " etex”);

with texcommands a variable that holds a string of TeX commands doesn’t work. 
The METAPOST parser complains about not finding etex.

I’m using MetaFun actually.

An example string in texcommands would in the end be something like

string texcommands;
texcommands := "\type-{Hello}, [World]!-";

Minimum example of my vardef that fails (the outcommented alternative to the 
scantokens line works and typesets “{Hello}, [World]!”):

vardef makeTeXLabel( expr w, h, name) =
  show "NAME:", name;
  save p; picture p ;
  save s; string s;
  s := "btex " & name & " etex";
  show "SCAN:", s;
  p := scantokens s;
  %p := btex   p := btex \type-{Hello}, [World]!- etex;
  p
enddef;

Log:

metapost log> >> "NAME:"
metapost log> >> "My Application (Component)"
metapost log> >> "SCAN:"
metapost log> >> "btex My Application (Component) etex"
metapost log> ! No matching 'etex' for 'btex'..
metapost log>  
metapost log>;
metapost log> makeTeXLabel->...x";show"SCAN:",s;p:=scantokens.s;
metapost log>   
save.b;path.b;b:=boundingb...
metapost log>  ...(53),("My Application (Component)"))

Thanks in advance,

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Wolfgang Schuster

Gerben Wierda schrieb am 29.03.2020 um 15:06:



On 29 Mar 2020, at 14:35, Wolfgang Schuster 
> wrote:


Gerben Wierda schrieb am 29.03.2020 um 14:30:
On 29 Mar 2020, at 12:58, Wolfgang Schuster 
> wrote:


Gerben Wierda schrieb am 29.03.2020 um 12:52:
I am using MetaFun (Lua code) to create METAPOST commands from an 
XML file. One of the issues I am running into that in METAPOST I 
have to handle strings with " characters in them and METAPOST 
doesn’t like those. The argument using the string

Foo "Bar” Foo


^^^

Use correct left quotation marks or \quotation{…}.
I’m not hard coding the string, I’m reading it from an XML. So, 
whatever I do, I need to do it by manipulating the string.

E.g. if the string I read contains
Foo "Bar” Foo
your suggestion means  I have to programmatically change that to
Foo \quotation{Bar} Foo
which is too complicated, given that I don’t have regular expression 
replace at my disposal.
I might be able to change al “ instances into something else by 
walking through the string and building a new one.


Your example uses " before Bar and not “ which is the problem.


Yes, I am aware that that is my problem. It is just that I do not have 
the luxury to decide myself what will be put in the string. It must work 
for any string. So, I will have to be putting that string to \type and 
make sure that is used as the label.


Does btex .. etex help or can't you change the strings and replace the 
quotation marks before you pass them to MetaPost?


\starttext

\startMPcode
draw textext.urt("One");
draw btex "Two" etex shifted (0,15);
label.urt("Three",(0,30));
label.urt(btex "Four" etex,(0,45));
\stopMPcode

\stoptext

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Gerben Wierda


> On 29 Mar 2020, at 14:35, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 29.03.2020 um 14:30:
>>> On 29 Mar 2020, at 12:58, Wolfgang Schuster 
>>>  wrote:
>>> 
>>> Gerben Wierda schrieb am 29.03.2020 um 12:52:
 I am using MetaFun (Lua code) to create METAPOST commands from an XML 
 file. One of the issues I am running into that in METAPOST I have to 
 handle strings with " characters in them and METAPOST doesn’t like those. 
 The argument using the string
 Foo "Bar” Foo
>>> 
>>> ^^^
>>> 
>>> Use correct left quotation marks or \quotation{…}.
>> I’m not hard coding the string, I’m reading it from an XML. So, whatever I 
>> do, I need to do it by manipulating the string.
>> E.g. if the string I read contains
>> Foo "Bar” Foo
>> your suggestion means  I have to programmatically change that to
>> Foo \quotation{Bar} Foo
>> which is too complicated, given that I don’t have regular expression replace 
>> at my disposal.
>> I might be able to change al “ instances into something else by walking 
>> through the string and building a new one.
> 
> Your example uses " before Bar and not “ which is the problem.

Yes, I am aware that that is my problem. It is just that I do not have the 
luxury to decide myself what will be put in the string. It must work for any 
string. So, I will have to be putting that string to \type and make sure that 
is used as the label.

G

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Gerben Wierda


> On 29 Mar 2020, at 12:58, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 29.03.2020 um 12:52:
>> I am using MetaFun (Lua code) to create METAPOST commands from an XML file. 
>> One of the issues I am running into that in METAPOST I have to handle 
>> strings with " characters in them and METAPOST doesn’t like those. The 
>> argument using the string
>> Foo "Bar” Foo
> 
> ^^^
> 
> Use correct left quotation marks or \quotation{…}.

I’m not hard coding the string, I’m reading it from an XML. So, whatever I do, 
I need to do it by manipulating the string.

E.g. if the string I read contains

Foo "Bar” Foo

your suggestion means  I have to programmatically change that to

Foo \quotation{Bar} Foo

which is too complicated, given that I don’t have regular expression replace at 
my disposal.

I might be able to change al “ instances into something else by walking through 
the string and building a new one.

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Wolfgang Schuster

Gerben Wierda schrieb am 29.03.2020 um 14:30:




On 29 Mar 2020, at 12:58, Wolfgang Schuster  
wrote:

Gerben Wierda schrieb am 29.03.2020 um 12:52:

I am using MetaFun (Lua code) to create METAPOST commands from an XML file. One of 
the issues I am running into that in METAPOST I have to handle strings with " 
characters in them and METAPOST doesn’t like those. The argument using the string
Foo "Bar” Foo


 ^^^

Use correct left quotation marks or \quotation{…}.


I’m not hard coding the string, I’m reading it from an XML. So, whatever I do, 
I need to do it by manipulating the string.

E.g. if the string I read contains

Foo "Bar” Foo

your suggestion means  I have to programmatically change that to

Foo \quotation{Bar} Foo

which is too complicated, given that I don’t have regular expression replace at 
my disposal.

I might be able to change al “ instances into something else by walking through 
the string and building a new one.


Your example uses " before Bar and not “ which is the problem.

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

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


Re: [NTG-context] conditional for undefined references

2020-03-29 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 29.03.2020 um 13:53:

Dear list,

consider the following sample:

 \setuppapersize[A8]
 \starttext
 \ConTeXt:

 \in[seac]

 Is it defined?:
 \doifelse{\in[seac]}{??}{undefined}{defined}

 \Lua:

 \ctxlua{context([[{\in[seac]}]])}

 Is it defined?:
 \startlua
 if [[{\in[seac]}]] == "??" then
 context("undefined")
   else
 context("defined")
 end
 \stoplua
 \stoptext


Is there a way to deal with undefined references?

I mean, I need a conditional to handle undefined references.

Why do I have undefined references in my documents? Well, I have almost
90 (Markdown) documents that I need to compile as single documents and
also as one document. When compiling as single documents, there are a
few references to other documents. This is the reason why they are
undefined.

Any chance to be able to catch a "??" output (or \dummyreference) from
"\in[reference]"?

Many thanks for your help,


ConTeXt gives you a message about missing references in the log-file but 
there is no simple way to show the in the PDF which is a step backwards 
because in MkII it was able to get a small message in the margins about 
unknown references.


What you can do is to use the \doifelsereferencefound command to check 
if the requested reference exists before you get the page number etc.


\starttext

Take a look at
\doifelsereferencefound{unknown:1}
  {\at{page}[unknown:1]}
  {\dummyreference\inright[style=\ttxx]{Missing reference}}.

This line ha a reference.\pagereference[unknown:2]

Take a look at
\doifelsereferencefound{unknown:2}
  {\at{page}[unknown:2]}
  {\dummyreference\inright[style=\ttxx]{Missing reference}}.

\stoptext

Wolfgang

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

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


Re: [NTG-context] I could use some ideas for a strategy to get these kind of labels in a METAPOST picture

2020-03-29 Thread Wolfgang Schuster

Gerben Wierda schrieb am 29.03.2020 um 10:47:




On 28 Mar 2020, at 19:04, Wolfgang Schuster  
wrote:

Gerben Wierda schrieb am 28.03.2020 um 18:58:

Actually, I would already be helped with a way to convert this string:
My “Büsiness"  sérvice
into something that can be typeset by ConTeXt. Using embedded lua is fine.


Does enabling entities help?

\setupxml
  [entities=yes]


This is not in the manual. Is it documented somewhere?


I added it to the syntax of the \setupxml command.

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

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


[NTG-context] conditional for undefined references

2020-03-29 Thread Pablo Rodriguez
Dear list,

consider the following sample:

\setuppapersize[A8]
\starttext
\ConTeXt:

\in[seac]

Is it defined?:
\doifelse{\in[seac]}{??}{undefined}{defined}

\Lua:

\ctxlua{context([[{\in[seac]}]])}

Is it defined?:
\startlua
if [[{\in[seac]}]] == "??" then
context("undefined")
  else
context("defined")
end
\stoplua
\stoptext


Is there a way to deal with undefined references?

I mean, I need a conditional to handle undefined references.

Why do I have undefined references in my documents? Well, I have almost
90 (Markdown) documents that I need to compile as single documents and
also as one document. When compiling as single documents, there are a
few references to other documents. This is the reason why they are
undefined.

Any chance to be able to catch a "??" output (or \dummyreference) from
"\in[reference]"?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Gerben Wierda
I am using MetaFun (Lua code) to create METAPOST commands from an XML file. One 
of the issues I am running into that in METAPOST I have to handle strings with 
" characters in them and METAPOST doesn’t like those. The argument using the 
string

Foo "Bar” Foo

turns into

someCall( "Foo “Bar” Foo”)

I guess I have to change the string into something with explicit character 
codes for the " characters, maybe?

In a later stage, these strings will be typeset by the ConTeXt side of things 
so they fit into a certain area within the METAPOST picture.

What is my best approach?

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

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


Re: [NTG-context] I could use some ideas for a strategy to get these kind of labels in a METAPOST picture

2020-03-29 Thread Gerben Wierda
I tried this and it worked. 

Next issue: if the string has a “ character in it, METAPOST cannot handle it. 
New question for the list...

G

> On 29 Mar 2020, at 10:47, Gerben Wierda  wrote:
> 
> 
> 
>> On 28 Mar 2020, at 19:04, Wolfgang Schuster 
>>  wrote:
>> 
>> Gerben Wierda schrieb am 28.03.2020 um 18:58:
>>> Actually, I would already be helped with a way to convert this string:
>>> My “Büsiness"  sérvice
>>> into something that can be typeset by ConTeXt. Using embedded lua is fine.
>> 
>> Does enabling entities help?
>> 
>> \setupxml
>> [entities=yes]
> 
> This is not in the manual. Is it documented somewhere?
> 
> G
> 
>> 
>> Wolfgang
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

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


Re: [NTG-context] How do I handle strings with " characters in it in METAPOST?

2020-03-29 Thread Wolfgang Schuster

Gerben Wierda schrieb am 29.03.2020 um 12:52:

I am using MetaFun (Lua code) to create METAPOST commands from an XML file. One of 
the issues I am running into that in METAPOST I have to handle strings with " 
characters in them and METAPOST doesn’t like those. The argument using the string

Foo "Bar” Foo


 ^^^

Use correct left quotation marks or \quotation{...}.

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

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


Re: [NTG-context] I could use some ideas for a strategy to get these kind of labels in a METAPOST picture

2020-03-29 Thread Gerben Wierda


> On 28 Mar 2020, at 19:04, Wolfgang Schuster 
>  wrote:
> 
> Gerben Wierda schrieb am 28.03.2020 um 18:58:
>> Actually, I would already be helped with a way to convert this string:
>>  My “Büsiness"  sérvice
>> into something that can be typeset by ConTeXt. Using embedded lua is fine.
> 
> Does enabling entities help?
> 
> \setupxml
>  [entities=yes]

This is not in the manual. Is it documented somewhere?

G

> 
> Wolfgang

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

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