Skip to main content

Questions tagged [metafun]

MetaFun is Hans Hagen’s extension to (or module for) the MetaPost language.

Filter by
Sorted by
Tagged with
1 vote
0 answers
71 views

What does begingroup/endgroup actually do?

I've started to notice that all my MetaPost/MetaFun figures are surrounded by begingroup ; endgroup ; Probably because I put that here when I wrote my snippet... But the fact is, I never actually ...
q6tDCWto's user avatar
2 votes
1 answer
94 views

How to properly input mp files in MetaFun?

In my ConTeXt project I have a long .mp file that I want to divide into several sub-files and make it library-like. For that purpose I load the initial file with \startMPinclusions input path/to/...
q6tDCWto's user avatar
3 votes
1 answer
78 views

Are boolean operations on shapes possible in MetaPost/MetaFun?

I am currently facing a, probably, simple problem. Problem which I couldn't find any satisfying solution. For this example, let's say that I have a simple square and that I what to "remove" ...
q6tDCWto's user avatar
1 vote
1 answer
97 views

Best ways to draw geometric shapes given "partial" information

I am trying to draw geometric shapes given only "partial" information. Let me show you some examples with triangles: Construct a triangle ABC such that ∡CAB=75°, d(A,B)=40 and d(C,A)=60. ...
user avatar
1 vote
1 answer
102 views

Is it possible to convert color to array?

I am trying to figure out if it is possible to convert colors to arrays with {red|green|blue}part and this macro vardef arrayFromColors(suffix $)(text c) = save i_ ; i_ = 0 ; numeric $[][] ; for ...
user avatar
0 votes
0 answers
199 views

How do you draw a basic line with ConTeXt and METAFUN?

I was able to draw a basic line, however I am still have this feeling of having hit another pebcak… 🤔 This is my line: \startMPcode path line ; line := (0mm,0cm)--(5cm,0cm) ; draw line ...
freezr's user avatar
  • 103
3 votes
1 answer
72 views

Is it possible to use shades with draw macros?

Is it possible to achieve shades (linear, circular, etc.) with the draw macros (draw, drawarrow, etc.)? I tried with the following code but it fails by returning a blank page. \startMPpage path p ; ...
user avatar
2 votes
2 answers
105 views

How to draw/fill any path around labels?

Is there any way to draw and/or fill any path around labels in MetaPost/MetaFun? According to the manual (page 27) we can use fill/unfill with bbox and thelabel, however there is nothing about, let's ...
user avatar
3 votes
2 answers
93 views

fill a circularpath around point 0

I am trying to fill a portion near point 0 of a circularpath. path circle ; circle = circularpath(10) scaled 200 ; pair a, b ; a = point 35 of circle ; b := point 5 of circle ; fill buildcycle((...
user avatar
2 votes
3 answers
291 views

MetaFun: Align "bounding box" of strings of different length

I'm currently getting into ConTeXt, mainly to experiment with MetaFun. I want to get a feeling for how usable it would be to generate some sophisticated diagrams I have in mind. I have a hard time to ...
Achim's user avatar
  • 185
1 vote
1 answer
122 views

Spread graphics on multiple pages with MetaFun in ConTeXt

I am currently refactoring my document and notice many MetaPost graphics that I would like to draw bigger, typically on two pages without any layout borders. Is there an easy way to do that in ConTeXt?...
user avatar
7 votes
2 answers
318 views

Strange mod operator behavior in metapost

I am currently facing a strange behavior of the metapost mod operator. Here is a simple piece of code: \startMPcode for x = 0 step .5 until 10: if (x mod 1) = 0.5: label.top(x, (x*cm, 0cm)) ;...
user avatar
2 votes
2 answers
240 views

An oval surrounded a *long text* inside in TikZ [equivalent cover background of METAFUN]

I need to put long text in an oval like this: I try to put a simply text inside an oval, but it does not work (the text overflows the oval). So I guess I need an oval around a text. I have this code ...
somenxavier's user avatar
1 vote
1 answer
148 views

Fit all given points in the patatoid

I am trying to adapt this metapost patatoid generator to fit a list of pairs given to a macro. To that purpose I loop through the list of pairs and determine the greatest x and y distances between all ...
user avatar
4 votes
2 answers
349 views

Set precise label position in metapost

Is there any option(s) in METAPOST (and/or METAFUN) to label things like TikZ allows it for nodes? Of course I know about label.{top|bot|lft|rt|...} but is there something more precise?
user avatar
8 votes
3 answers
479 views

Adding Column Rules in ConTeXt's columnsets / pagecolumns

This is my first time playing with ConText and, while I'd like to think I have some decent programming experience, TeX code is something I've never worked with before (and am sufficiently intimidated ...
Brooks's user avatar
  • 81
4 votes
1 answer
288 views

ConTeXt: How to change parts and chapters pages background color with MetaFun?

I am trying to reproduce something like this for parts and chapters with MetaFun: Placing the content on the page is simple so I am trying to get the colored background. However I do not know how to ...
user avatar
2 votes
1 answer
140 views

Dynamically defining metafun positional variables with \structurelistuservariable in ConTeXt

Following on from this question, I am now trying to achieve the same effect (drawing with metafun in the TOC, from the section number to the edge of the page) using positional overlays instead. ...
Maciek's user avatar
  • 65
4 votes
1 answer
224 views

Drawing from a framed overlay to the page edge in ConTeXt and Metafun

Using ConTeXt for typesetting and metafun to draw, I would like to create a custom colored overlay for my table of contents. I want to fill a colored rectangle for certain TOC entries that stretches ...
Maciek's user avatar
  • 65
3 votes
2 answers
236 views

Using sans as a default font in ConTeXt Metapost

When using metapost in ConTeXt, I would like to have all my labels in sans by default. Which option can configure it and which environment should I use to pass it (MPinclusions?) I am aware of this ...
sztruks's user avatar
  • 3,154
3 votes
2 answers
499 views

Convert numeric into a Roman Numeral inside a metafun loop

How can I automatically convert a number inside a metafun loop? I tried using MPvar but this doesn't work. \starttext \startMPpage for i=1 upto 10: label (i,(10i,0)); label ("\convertnumber{...
sztruks's user avatar
  • 3,154
1 vote
1 answer
241 views

Fill all elements of a METAPOST array

I would like to fill paths of arrays of arbitral length using a loop. Is there a way to iterate the fill operator on each array element, something equivalent to this shell loop set -A Test foo bar for ...
sztruks's user avatar
  • 3,154
2 votes
2 answers
316 views

ConTeXt: Fontawesome symbols with MetaFun

I am trying unsuccessfully to pass fontawesome symbols as variable to MetaFun. I tried things like, passing the symbol directly through the variable \usesymbols [fontawesome] \startuniqueMPgraphic{...
user avatar
3 votes
2 answers
333 views

ConTeXt: How to force text to fit in a MetaFun box?

How to make text fit in a MetaFun box with specific width ? For now I have \startuseMPgraphic{MPBoxFrame} % Useful values numeric w, h, o, b ; w := 4.5cm ; h := OverlayHeight ; o := ...
user avatar
5 votes
1 answer
658 views

Questions about fancyboxes in ConTeXt with MetaFun

I'm trying to reproduce something like that with MetaFun: For now with these links, I managed to get that: \definecolor[darkblue][r=20,g=30,b=50] \startuseMPgraphic{MPTheoremFrame} % Useful ...
user avatar
2 votes
1 answer
312 views

Why does this example from the MetaFun manual not work?

[Question also asked on the ConTeXt mailing list but no answer yet so it's probably complicated enough to get an answer, hence repeated here] I would like to use the result of transparent() straight ...
gctwnl's user avatar
  • 173
2 votes
2 answers
204 views

Trouble getting curly braces printed from METAPOST code generated by ConTeXt Lua (with minimal example)

[Question also asked on the ConTeXt mailing list, I'll post a solution from either in the other] The following minimal example illustrates my problem. I need to typeset a generic string (which is read ...
gctwnl's user avatar
  • 173
3 votes
1 answer
94 views

Why does this syntax outputs an error under METAFUN/METAPOST?

Given this MWE (compiled under ConTeXt) \starttext \startMPpage %variables u:=1mm ; numeric l[]; l[1]:=30 ; l[2]:=70 ; draw (0,0) -- (0,100u) ; %this does not work %fill unitsquare xscaled (l[2]-l[...
sztruks's user avatar
  • 3,154
2 votes
1 answer
165 views

How to align text on baseline in MetaFun without using setMPtext?

I want to draw several pieces of text that should be aligned so I need to be able to place these texts according to their baseline. Looking at the MetaFun manual, pages 143-144, it is explained that ...
Silverspur's user avatar
3 votes
1 answer
323 views

ConTeXt: Heading text surrounded by lines

I'd like to replicate this heading style in ConTeXt: The closest I've come is surrounding a centered text with \thinrules but those are at the baseline of the text instead of horizontally centered ...
DP.'s user avatar
  • 377
4 votes
1 answer
492 views

Cover page coloring in ConTeXt

How would I go about coloring the top and bottom of a page in ConTeXt/Metafun? Currently I am using this code \definecolor [Top] [h=00ff00] \definecolor [Bottom] [h=ff0000] \definecolor [TitleColor]...
StillSubjectToChange's user avatar
2 votes
3 answers
157 views

metapost " missing `,' has been inserted." compilation error

I'm quite new to this language and can't figure out the error in following code. Any help would be appreciated ! verbatimtex \documentclass{article} \usepackage[T1]{fontenc} \usepackage{mathptmx} \...
flowian's user avatar
  • 163
1 vote
1 answer
239 views

Help with MetaPost and Metaobj with latex

Kind help with two examples to do metapost and metaobj in latex running from Texicenter. what packages to include and program two examples I read through book not able to understand. First input ...
sriram's user avatar
  • 65
7 votes
2 answers
541 views

ConTeXt and Metafun: Framed enumeration with counter as part of overlay

How do you make an enumeration where the enumeration counter appears within a frame decorated with Metafun? The idea is to have something similar to an example on pg. 144 of the Metafun manual: ...
ssokolen's user avatar
  • 1,748
5 votes
1 answer
314 views

ConTeXt and Metafun: Using environment variables inside overlay

I would like to draw a custom frame for the framed environment using Metafun. I am currently hard-coding the frame color within the Metafun definition. However, I would like the Metafun frame to ...
ssokolen's user avatar
  • 1,748
5 votes
1 answer
221 views

ConTeXt: Multiple colour stops for linear_shade

Background Looking to parameterize a horizontal rule (for headers and footers) that has three colour stops (A to B to C) and a variable thickness. For example: Single Stop Code The following code ...
Dave Jarvis's user avatar
  • 12.1k
12 votes
0 answers
505 views

metafun: Why is the arrow tip not filled? [closed]

Trying out another example I saw that with the metafun format (luatex version) the arrow tips are no longer filled. The following document (to be compile with lualatex) shows the problem: \...
Ulrike Fischer's user avatar
6 votes
1 answer
205 views

Metapost graphics not aligned in ConTeXt TABLE

I am using TABLE to design map legend. Symbols should be middle-aligned. As said in the title, the metapost graphics used as symbols are not aligned in my TABLE environment (column 1 and 3), whereas ...
sztruks's user avatar
  • 3,154
1 vote
1 answer
339 views

expand string array in loop with label

I would like to expand one string array in a short metafun loop. Each box should be labelled with the appropriate string ("classicism", "Lumières", "romanticism"). How can I make the label function, ...
sztruks's user avatar
  • 3,154
4 votes
1 answer
540 views

Metafun: relative positioning of points and paths

I've read through most of the Metafun manual, but I can't seem to find any mention of a relative positioning system. I have two use cases in mind. First, I would like to position points along a path ...
ssokolen's user avatar
  • 1,748
3 votes
1 answer
376 views

Using Metapost for titles in Context

I'd like to use Metapost to format my titles like this (not exactly like this, so no need to complain about design issues :)): The problem is that when I try to use the following macro I get an error:...
kosinivalas's user avatar
2 votes
1 answer
341 views

Integrating lua-generated Metapost graphics in Context

Normally we can integrate Metapost graphics in Context with the use of \startuseMPgraphic{id} and \useMPgraphic{id}. The idea is to define the graphics somewhere and use them somewhere else. However, ...
kosinivalas's user avatar
2 votes
1 answer
490 views

Compile metafun book with ConText (getting a cover-like)

Anyone knowns how to create (please sample code) a cover page like this?: http://context.aanhet.net/general/manuals/metafun-p.pdf The sources are available from: http://context.aanhet.net/svn/...
Steve's user avatar
  • 21
4 votes
3 answers
527 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 ...
Aleksei Naidenov's user avatar
3 votes
2 answers
2k views

How to insert (if possible) an image inside a Metapost figure? (in plain LaTeX environment)

I'd like to insert an image into a Metapost figure (I'm using MikTeX/LaTeX, no Metafun). I hopefully tried (also thanks to Aditya's suggestion) the following Metapost code (compiled with -tex=pdftex ...
10 votes
1 answer
819 views

How to fix this fancy heading in ConTeXT

I don't know if this is a duplicate or not but we can close it if it is. I have been trying to learn ConTeXt. I specially love the heading and page number formattings that I see in the documentations ...
hpesoj626's user avatar
  • 17.4k
11 votes
1 answer
541 views

How to debug METAPOST inlined in ConTeXt? (Or "message" primitive and "loggingall;" in inlined METAPOST)

I have a METAPOST program that works fine with mpost, but fails when I try to run it inline in ConTeXt. In order to debug it, I would like to see the usual METAPOST logging and/or to use the METAPOST "...
Colin Fraizer's user avatar
6 votes
2 answers
1k views

Metapost - Boundary box

I want to make a series of images with Metapost and Context. I want the height and width of the images to be fixed ( like a frame ) and center the picture drawn with Metapost inside that frame. So, is ...
manthosh's user avatar
  • 145
7 votes
1 answer
2k views

How to install metafun?

How can I install the metafun metapost macros? I have tried to tlmgr install metafun, but it cannot find it. Also a search for “metafun” on ctan yields only a introductory tutorial on ConTeXt, in ...
morbusg's user avatar
  • 25.6k