MetaPost uses a language based on that of Metafont to produce precise technical illustrations. Its output is scalable PostScript or SVG, rather than the bitmaps Metafont creates. This tag is compatible with {diagrams}.

learn more… | top users | synonyms

5
votes
2answers
74 views

How to distinguish between Metafont and MetaPost?

Background I'm trying to make a nice SVG out of Knuth's Dangerous Bend symbol based on his own code, for which the obvious tool to use is MetaPost. However, I'd prefer to still be able to process the ...
10
votes
4answers
260 views

Plot the cusp catastrophe surface

I'm trying to draw (plot) the Cusp catastrophe surface into latex using any software logic. I am completely stuck because I'm definitely not a mathematician. The surface has the potential: V(x) = ...
3
votes
1answer
60 views

Drawing with a macro

I have just began using MetaPost and I would liked to be able to put a grid on my images, so I could easily read coordinates from it. I would liked to write a macro, that I could import while creating ...
6
votes
0answers
75 views

How to define a sort of reference in METAPOST?

Assume we are defining a canvas abstract data type in METAPOST, where some tasks are gathered. I would like to define a kind of reference to the last added task, but I do not know METAPOST good enough ...
7
votes
2answers
155 views

How to create a wavy lines with MetaPost?

I am looking for a macro or whatever code that can draw a wavy curves with MetaPost. In other words, I need a wavy/spring version of what follows: beginfig(1); z1 = (0,0); z2 = (3,2); z3 = (6,0); ...
2
votes
1answer
44 views

Hatching Package with Metapost

I am new in metapost and I am unsure as to re-define the withcolor command to revert back to the metapost default. I am trying to draw the cross section of a cylinder, where the inner circle is ...
36
votes
12answers
3k views

Drawing a Reuleaux Triangle

A Reuleaux triangle is a shape of constant width sort of like a rounded equilateral triangle. (Reuleaux triangle - Wikipedia, the free encyclopedia) It can be formed by the intersection of three ...
3
votes
1answer
52 views

adjust uniformdeviate values

I need to insert in the rectangle all my 10 molecules in random way (angle and x,y position). I don't know what is wrong with my code. \startMPinclusions vardef spring (expr a, b, w, h, n) = pair ...
4
votes
1answer
65 views

lost linear_shade output

What is wrong with my code? The second call of SoundEnergy lost the black/white gradient. \startMPinclusions def SoundEnergy = path pr ; pr := unitsquare xscaled .3cm yscaled 2cm ; ...
7
votes
3answers
200 views

How to automatically draw the images of a point placed between 2 inclined mirrors?

Consider a point X placed between two inclined mirrors as follows. \documentclass[pstricks,border=20pt,12pt]{standalone} \usepackage{pst-eucl} \def\Angle{37}% extreme case in which 360/\Angle-1 is ...
4
votes
2answers
106 views

Why two intersected paths can't buildcycle in MetaPost?

Suppose that I have two path: beginfig(0) u:=10pt; vardef randomcirc(expr O, r, w) = save p,i; pair p; numeric i; p=O+right*r; p for i=1 upto 9: .. (p rotatedaround(O, ...
6
votes
1answer
84 views

The array in metapost

Suppose I have defined an array of points pair p[]; Then are p.0, p0, p[0] different? Can I use p.01, p01, p[01]?
7
votes
3answers
172 views

MetaPost: How to fill cycle path with slanted lines?

Suppose I have build a cycle path with bulidcycle: path pa[]; pa.0:=(-6u,0){dir 90} .. (0,8u){dir 0}; pa.01:=pa.0 reflectedabout(origin, (0,1)); pa.1:=(-6u,0){dir -90} .. (0,-3u){dir 0}; pa.11:=pa.1 ...
6
votes
1answer
154 views

Feynmp / metapost - labels not working

I am trying to draw a simple Feynman diagram with FeynMP. I use the following code to generate by .mp file - note I use the fmfgraphs environment. \documentclass{article} \usepackage{feynmp} ...
38
votes
9answers
2k views

The Spiral of Roots in TikZ

How can one create a spiral of roots as shown in the diagram below: where one can use a command to draw more parts to the spiral. For example, a command like \sqrtspiral{1}, \sqrtspiral{2}, ...
3
votes
2answers
97 views

metapost, metaobj and labels

I found this trick posted by Aditya some time ago that allowed to use metaobj in context. Currently this code no longer works. Currently, are there any way to use metaobj in context? The main problem ...
4
votes
1answer
163 views

Electron distribution box diagram

Just for sharing. Improvements are welcome. \starttext Electron distribution box diagram \startMPcode picture finalpicture ; finalpicture := nullpicture ; numeric n ; n := 0 ; bboxmargin := 0pt ; ...
5
votes
0answers
140 views

Scheme for Chemical Potential Energy representation [closed]

I wrote this code to schematically represent the concept of chemical potential energy. This image will be part of a representative diagram of energy transformations in a voltaic cell: chemical ...
5
votes
0answers
61 views

Is this a bug in the pfb file or a bug in metapost's “glyph”?

I've only recently started playing with metapost's "glyph". I've discovered (MWE below) an anomaly with the paths in serifs for the cm font set from these experiments. Starting point: it seems that ...
3
votes
2answers
86 views

add labels and build the path through a list iteration

I had to build a graph with metapost for my physics classes (see below). What I would like to ask you is if there are a way to add the curve and their labels in the some way that i do with tikz: ...
3
votes
2answers
92 views

How can I fill a complex path with Metapost/Metafun?

Is there any way to produce exactly following PS and SVG code with Metapost/Metafun? Unfortunately, unfill won't work for me, as there is a background in the resulting page. And this example is ...
3
votes
1answer
57 views

Increase image resolution using MetaUML and metapost

I'm using MetaUML to create text-driven UML diagrams. When I generate a figure, with: $ mpost example.mp $ convert ps:example.1 png:example.png a very low-resolution image is generated. If I scale ...
6
votes
1answer
189 views

How to create MetaPost image for LaTeX

Im trying to figure out how to create this image in MetaPost
26
votes
2answers
596 views

Chaotic billiard with TikZ

I'm looking for a TikZ library that could help me to represent different shapes of chaotic billiards. Any idea?
2
votes
0answers
63 views

Omitting visibility marker in MetaUML

Is there a way to omit the visibility (lock symbol) marker in MetaUML Class objects? If I just refrain to use one I get a protected marker as a default. A short example (note: the LaTeX builder has ...
12
votes
2answers
221 views

Is there another better way to have a region with gradient opacity?

My objective is to get a region with gradient opacity. In the following MWE, the region is a quarter of a disk on the top a bird. I made the gradient opacity by partitioning the sector into 45 ...
6
votes
2answers
139 views

Using negative coordinates in EPS file with XeLaTeX

I've run into inconsistent behavior with XeLaTeX and EPS files with negative coordinates. The wrapping block for the figure is calculated correctly; however, the content of the figure is misplaced ...
2
votes
0answers
43 views

Context mptopdf problem [closed]

I've a problem with the following file input graph u=0.5cm; beginfig(0); draw dashpattern(on 5bp); picture pa; pa=currentpicture; currentpicture:=nullpicture; draw dashpattern(on 5bp off ...
8
votes
2answers
161 views

LuaLaTeX and MetaPost

Is there a LuaLaTeX equivalent of \startMPinclusions input mpfile; \stopMPincusions in ConTeXt? That is, if I have \documentclass{article} \usepackage{luamplib} \begin{document} ...
3
votes
1answer
97 views

Using Metapost inline in LaTeX (no ConTeXt)

When I was more active in LaTeX and Metapost (~10 years ago) I could not find a way to directly use Metapost in LaTeX. There were few tutorials on how to use it within ConTeXt, but for using it with ...
0
votes
0answers
71 views

click button and next picture will be shown

I would like to create presentation and export to GIF, for example. I have three files: obr1.mp, obr2.mp, and obr3.mp (which is my pictures drawn). I want have .tex file, where I could press space ...
42
votes
13answers
2k views

What is the simplest way to draw this triangle exactly?

I want to see how we can exactly construct the following diagram as simple as possible. It means that the manual calculation should be avoided. Note that the angle marks attached to angles ...
5
votes
2answers
202 views

graph of function with metapost

I have to create graph of function 3x^4 − 11x^3 + 12x^2 − 4x + 1 ; interval <0,1;1> . I have just func.mp input gjktc.mp; u:=1mm; path p[]; beginfig(1); draw (0,0)--(10u,10u); draw ...
6
votes
1answer
182 views

Full colored Triangle and Circle in Metapost

The question may be trivial, but I need your help, to draw a full colored triangle and circle (where the triangle will be inside the circle). Here is my file pic_1.mp: input gjktc.mp; u:=1mm; ...
3
votes
1answer
96 views

Metapost and ConTeX

I am completely new to ConTeXt and have just started to experiment with writing metapost directly within ConTeXt. My problem is that some of my existing metapost files call other metapost files which ...
7
votes
1answer
132 views

ConTeXt+MetaPost: Non-conflicting random background and foreground colours

Overview Looking to create a page that has a random (and non-consecutively repeating) background colour with titles that are also random. Problem The code has two problems. First, generating a ...
5
votes
1answer
165 views

MetaPost: Randomly variably thick curves

Overview Looking to emulate the following sinusoidal wave having random variations in both its filled and outline thickness: The wave has two parts: a variably thick filling and a variably thick ...
6
votes
1answer
163 views

MetaPost: Non-uniform periodic tessellations

Overview Looking to create backgrounds that have regular polygons aligned to a grid. Problem The space between the polygons varies, even though the radius for the polygons has been calculated in ...
8
votes
1answer
147 views

MetaPost: Adjust colour value (brightness/luminosity)

Background In MetaPost, colours can be lightened or darkened by calling the transparency function. However, this allows other colours to show through, which isn't necessarily desirable all the time. ...
5
votes
1answer
90 views

ConTeXt: Randomly lighten or darken a colour within a threshold

Overview Looking to randomize the colours of squares of a checkerboard so that some are slightly lighter and some are slightly darker, relative to another colour. Problem The following sets a base ...
0
votes
0answers
96 views

My graph will compile in metapost but the x and y axis scaled is off

beginfig(1); numeric u; path xaxis,yaxis; u=0.5in; yaxis= (0,-4.1u) -- (0,4.2u); xaxis= (-4.1u,0 )-- (4.2u,0); pickup pencircle scaled 1pt; drawarrow xaxis; drawarrow yaxis; pickup pencircle scaled ...
5
votes
1answer
111 views

Faster Metapost SVG Output with TeX?

I am generating some diagrams with METAPOST. I need the output in SVG format. My labels are generated by calls to LaTeX via Tex.mp and its TEX METAPOST definition (also called a macro). My ...
0
votes
0answers
102 views

Im trying to set up a graph but keep gettin error “isolated expression”

beginfig(1); numeric u; path xaxis,yaxis; Scale: 1=u u=0.5in; yaxis= (0,-4.1u)--(0,4.2u); xaxis= (-4.1u,0)--(4.2u,0); pickup pencircle scaled 1pt; drawarrow xaxis; drawarrow yaxis; pickup pencircle ...
47
votes
6answers
2k views

How to automatically draw tree diagram of prime factorization with LaTeX?

I want to have a simple interface to automatically draw tree diagrams of prime factorization. For example, by invoking the following code, \PrimeTree{36} \PrimeTree{90} \PrimeTree{112} ...
12
votes
2answers
340 views

How to draw spherical triangles?

Does anyone know how to draw spherical arcs and spherical triangles using LaTeX?
9
votes
1answer
237 views

What programmable drawing tool(s) can solve how to fill a region with a path

I've recently become interested in computer numerical control (CNC), and have been considering using METAPOST in a CNC work-flow (using pstoedit to convert .pdf (or .mp) files to G-Code). The extant ...
6
votes
0answers
208 views

Wrong TFM generated by mf2pt1 in TeXLive 2013

I need to generate a font from METAFONT file. I used mf2pt1 and generated PFB file and TFM file, but TFM file was incorrect. I tried to generate TMF file of cmr10.mf by mf2pt1, then looked at ...
10
votes
6answers
718 views

How to preview images generated by MetaPost?

I use the old MetaPost program to create graphics. My problem is that, to see the result of my MetaPost figures, I have to compile first the .mp file and then the .tex file where I've inserted them. ...
7
votes
2answers
238 views

Putting circle into a right triangle

I need help with MetaPost in putting circle into the bottom left corner of a right triangle. Here is my work: beginfig(1) pair A,B,C,D,E,F,O,G,H,I,J,AA, BB, CC, HB, HF, DD, EE,FF,h; ...
3
votes
1answer
152 views

Help with the geometry figure

Can someone help me with creating such a figure in metapost?