On Wed, 24 Apr 2019, Wolfgang Schuster wrote:

Gour schrieb am 24.04.2019 um 18:57:
That I spotted and corrected, but I'm getting another error, I suppose:
$ cat  mp.tex
\starttext
Lorem Ipsum…

\startMPcode
draw ( (0,0)--(1,0)--(0,1)) with color red ;
Change "with color" to "withcolor" (no space).

Here is a more detailed example that mimics the tikz code that you sent in the other email.

\definecolor[myblue][r=0.3,g=0.3,b=1]
\definecolor[myred][r=0.6,g=0.2,b=0]

\starttext
\startMPpage
  newpair A, B, C;

  A := (-7.7, 2.75)*1cm;
  B := (0.88, 2.57)*1cm;
  C := (-3.04, -3.37)*1cm;

  newpath triangle;
  triangle := A -- B -- C -- cycle;
  fill triangle withcolor "myred" withtransparency("normal", 0.1);
  draw triangle withpen pencircle scaled 2pt
                withcolor "myred";

  dotlabeldiam := 5pt;
  dotlabel.lft("A", A) withcolor "myblue";
  dotlabel.rt ("B", B) withcolor "myblue";
  dotlabel.bot("C", C) withcolor "myblue";

\stopMPpage
\stoptext

In ConTeXt, if you put quotes around the name of a color, it looks at the colors defined in tex rather than colors defined in metapost. This allows you to easily share the same colors in text and figures.

As an elegent example of this see this excellent imitation of Byrne's Euclid: https://github.com/jemmybutton/byrne-euclid/releases/download/0.6%2B0.3/byrne_context.pdf

(Source at https://github.com/jemmybutton/byrne-euclid)

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to