Questions tagged [metapost]

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

MetaPost is a programming language much like Knuth’s METAFONT except that it outputs either vector graphics in the PostScript or SVG formats or bitmap graphics in the PNG format. Borrowed from METAFONT are the basic tools for creating and manipulating pictures. These include numbers, coordinate pairs, cubic splines, affine transformations, text strings, and boolean quantities. Additional features facilitate integrating text and graphics and accessing special features of PostScript such as clipping, shading, and dashed lines. Another feature borrowed from METAFONT is the ability to solve linear equations that are given implicitly, thus allowing many programs to be written in a largely declarative style. By building complex operations from simpler ones, MetaPost achieves both power and flexibility.

MetaPost is particularly well-suited to generating figures for technical documents where some aspects of a picture may be controlled by mathematical or geometrical constraints that are best expressed symbolically. In other words, MetaPost is not meant to take the place of a freehand drawing tool or even an interactive graphics editor. It is really a programming language for generating graphics, especially figures for TEX3 and troff documents.

504 questions
20
votes
4 answers

A good METAPOST alternative for plotting 3d surfaces

I find METAPOST to be a wonderful software to create 2d charts and figures. Can you name me a few good alternatives to METAPOST for drawing 3d surfaces? The crucial feature I'm looking for is the ability to have all the fonts (the axis labels and…
meh
  • 599
15
votes
1 answer

Get all intersection points in MetaPost

On MetaPost, I can use p intersectionpoint q to get a intersection point. But It will only return one point. How can I get all intersection points?
15
votes
2 answers

Is Metapost still relevant in the age of Lua etc.?

Disclaimer: I am not sure if I am "allowed" to ask such a question, but I was also not sure if it belongs to Meta instead. Often when somebody asks a tikz-focussed question, some users consistently offer Metapost alternatives just for comparison --…
10
votes
2 answers

Defining a point on a path by direction of another path

Is it possible to define a point when I have two paths such as: beginfig(1); u := 1cm; path p[]; p0 := (1u,3u)--(2u,2u); p1 := (2u,0)--(3u,2u); for i=p0,p1: draw i; endfor; endfig; end so that if continuing p0 to the p1, the wanted point…
morbusg
  • 25,490
  • 4
  • 81
  • 162
9
votes
1 answer

Should I have changed MetaObj or is there a better way?

I want to use MetaObj to arrange some diagrams. I have some nice, color MetaPost drawings of components for my diagrams. I create the picture objects like this: input metaobj; def picphone = begingroup; save pic; picture pic; pic :=…
8
votes
3 answers

how to use metapost newinternal variable

I am trying to convert the statement drawarrow (0,0)--(100,100) dashed evenly withcolor green; to newinternal string varA ; varA := "dashed evenly withcolor green" ; drawarrow (0,0)--(100,100) varA ; but it fails in the line of drawarrow. Any…
8
votes
4 answers

Error in PS generated by MetaUML

If I use following example (or any other): input metauml; beginfig(1); Class.A("Point") ("+x: int", "+y: int") (); Class.B("Circle") ("radius: int") ("+getRadius(): int", "+setRadius(r:…
8
votes
1 answer

mptopdf: Is multipage output (PDF) possible?

I have this MetaPost input file: %@ Maxime Chupin %@ 4 février 2017 %@ animCercle.mp prologues := 3; outputtemplate := "svg/%j-%c.svg"; outputformat := "svg"; % unité u:=1cm; %rayon cercle r:=5u; % nombre de quartier numeric n; n := 16; %…
AlexG
  • 54,894
8
votes
3 answers

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, 36i))+(uniformdeviate w, uniformdeviate w) endfor ..…
user19832
  • 1,585
7
votes
1 answer

MetaPost label positioning based on the text baseline

We are all familiar with MetaPost labels: label.top(btex $a_t$ etex, z0); The problem with the above is that the positioning is based on the entire label, including the subscript. How do I calculate the positioning based on the baseline of the…
7
votes
1 answer

How do I create a pen that only draws on the right side of the path?

Let's say I have a path that represents the inside dimensions of a room. I would like to draw a thin line representing that inside space. But I would also like to draw the thickness of the walls. The naive way would be to do this where I manually…
guidoism
  • 279
7
votes
1 answer

METAPOST equivalent to TikZ polar coordinates?

When drawing with TikZ, I find sometime convenient to use polar coordinates (angle:distance), as in this MWE \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [pole/.style={circle,draw=gray,fill=gray,thick,text…
sztruks
  • 3,074
7
votes
1 answer

How to access north, south, east and west anchors for boxes in Metapost

I am attempting to draw the figure shown in the picture below in Metapost, where it is important that the edge between the boxes starts at the middle of the bottom line of the "perfect" box, and ends at the middle of the top line of the "chordal"…
tor
  • 173
  • 5
7
votes
1 answer

How to draw dots equally spaced along a path?

Is it possible to draw dots with Metapost so that each dot is separated from its first neighbour by the same distance along an arbitrary path? I do not want their real distance to be regular! Rather, I want their distance measured along the path to…
7
votes
1 answer

How to handle dependencies in METAPOST

I am working on the Blueprint package, a graphical toolkit for project managers and system designers, and time has come to tidy up the library design. There is several modules in the library and I would like to let each module ensure that its…
1
2 3
8 9