Questions tagged [metafun]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
46 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 ; ...
  • 1,011
2 votes
2 answers
52 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 ...
  • 1,011
3 votes
2 answers
71 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((...
  • 1,011
3 votes
3 answers
226 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 ...
  • 155
1 vote
1 answer
82 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?...
  • 1,011
7 votes
2 answers
245 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)) ;...
  • 1,011
2 votes
2 answers
182 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 ...
0 votes
1 answer
118 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 ...
  • 1,011
4 votes
2 answers
217 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?
  • 1,011
8 votes
3 answers
366 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 ...
  • 81
4 votes
1 answer
211 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 ...
  • 1,011
2 votes
1 answer
108 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. ...
  • 65
4 votes
1 answer
152 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 ...
  • 65
3 votes
2 answers
158 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 ...
  • 3,002
3 votes
2 answers
448 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{...
  • 3,002
1 vote
1 answer
179 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 ...
  • 3,002
2 votes
2 answers
246 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{...
  • 1,011
2 votes
2 answers
237 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 := ...
  • 1,011
5 votes
1 answer
565 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 ...
  • 1,011
2 votes
1 answer
267 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 ...
  • 173
2 votes
2 answers
166 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 ...
  • 173
3 votes
1 answer
77 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[...
  • 3,002
2 votes
1 answer
134 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 ...
3 votes
1 answer
236 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 ...
  • 377
4 votes
1 answer
394 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]...
2 votes
3 answers
138 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} \...
  • 163
1 vote
1 answer
193 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 ...
  • 65
6 votes
2 answers
448 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: ...
  • 1,693
5 votes
1 answer
272 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 ...
  • 1,693
4 votes
1 answer
181 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 ...
  • 11.3k
12 votes
0 answers
463 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: \...
5 votes
1 answer
157 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 ...
  • 3,002
1 vote
1 answer
302 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, ...
  • 3,002
4 votes
1 answer
496 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 ...
  • 1,693
2 votes
1 answer
330 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:...
1 vote
1 answer
315 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, ...
2 votes
1 answer
449 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/...
  • 21
4 votes
3 answers
488 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
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 ...
9 votes
1 answer
770 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 ...
  • 16.9k
10 votes
1 answer
469 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 "...
5 votes
2 answers
905 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 ...
  • 135
7 votes
1 answer
1k 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 ...
  • 25.1k