mkpic(1)

๐Ÿ“ฆ version 2026.0, in alpine 3.24

๐Ÿ’– mkpic โ€” the manual, but make it cute ๐Ÿ’–

okay bestie, welcome to the mkpic page from the DekDoc scripts collection โœจ this is the mkpic(1) situation and honestly? it's giving "make tiny pictures with mfpic and feel like a genius" ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

mkpic โ€” the interface for making pictures with mfpic. that's it, that's the whole vibe ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

mkpic [options] [picfile]

โœจ OPTIONS โœจ

  • -c, --clean โ€” removes everything except the input file, and then it dies ๐Ÿ’€ so like, use this when you're done and you want the clutter gone. (it literally says "die", not me being dramatic.)
  • -p, --pdfsample โ€” makes a pdf file with sample images so you can peek at what you made ๐Ÿ‘€
  • -f, --font=<font command> โ€” sets the default font for labels, because the labels deserve main character energy too ๐Ÿซถ
  • --[no]box โ€” produces framed boxes (or doesn't, if you go --nobox) ๐ŸŽ
  • -V, --version โ€” reports the version number and then dies ๐Ÿ’€
  • -h, --help โ€” shows help info and then dies ๐Ÿ’€ (sensing a pattern? everything ends in death here, it's fine, it's fine ๐Ÿ˜ญ)
  • --[no]debug โ€” displays debugging information, for when you need to know everything ๐Ÿ•ต๏ธโ€โ™€๏ธ
  • -l, --log=<logfile> โ€” the file where warning messages go ๐Ÿ“
okay important: without an input file, the DATA section is used. so you can just run it raw and it'll pull from the script's own DATA section, no cap ๐Ÿ’–

๐Ÿ‘‘ COMMAND OVERVIEW ๐Ÿ‘‘

okay so here's the lineup of commands, each one with its argument shape. the args aren't fully explained here โ€” for those you gotta scroll to the SYNOPSIS section, bestie ๐Ÿซถ

begin
       name xl yl xmin ymin xmax ymax xlabel ylabel

end stop var=value #

       comment

arccst
       xcenter ycenter xstart ystart theta

arcset
       xstart ystart xend yend theta

arccrtt
       xcenter ycenter radius theta1 theta2

arc3
       x1 y1 x2 y2 x3 y3

xmark
       [label1] x1 [label2] x2 ...

Xmark
       [label1] x1 [label2] x2 ...

ymark
       [label1] y1 [label2] y2 ...

Ymark
       [label1] y1 [label2] y2 ...

xdrop
       x y

ydrop
       x y

xydrop
       x y

arrow
       x1 y1 x2 y2 label

label
       YX x y label

xlabels
       YX x y dx label ...

ylabels
       YX x y dy label ...

point
       x1 y1 x2 y2 ...

dpoint
       x1 y1 dx1 dy1 ...

lines
       x1 y1 x2 y2 ...

dlines
       x1 y1 dx1 dy1 ...

curve
       x1 y1 x2 y2 ...

dcurve
       x1 y1 dx1 dy1 ...

rect
       x1 y1 x2 y2

drect
       x y dx dy

dcrect
       x y dx dy

crect
       x1 y1 x2 y2

arect
       xc yc width height theta

bar
       x xdev height

func
       xmin xmax step expression-in-x

grid
       dx dy xgap ygap

hatch

bhat

ehat

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

okay so mkpic gives you an easy interface for making small pictures with mfpic ๐ŸŽจ to do that, you create an input file made of commands โ€” one per line, with space separated parameters. (or you can modify the DATA section of the mkpic script itself, which is what gets used if you run it with no input file ๐Ÿซถ). for an extensive description, go look at the files mkpicdoc.tex and mkpicdoc.pdf, which are part of the distribution ๐Ÿ“š

mkpic produces two files. assuming an input file named picfile, defaulting to mkpic, these are:

  • picfile.mac โ€” a macro file which will contain TeX commands for every picture โœจ
  • picfile.sty โ€” a style file for latex, defining the same TeX commands for every picture ๐Ÿ’…

with the --pdfsample option, two other files are produced:

  • picfile.pdf โ€” a PDF file containing all pictures. this lets you easily check the results of your designs ๐Ÿ‘€
  • picfile.tex โ€” the TeX source used for creating this PDF file ๐Ÿ“

in LaTeX, you have to include \usepackage{picfile} and to include commands like \Figname in your source, where name is the name you gave one of your pictures in an mkpic begin command ๐Ÿท๏ธ

in TeX and ConTeXt, you have to \inputโฃpicfile.mac and to include commands like \Figname in your source, where name is the name you gave one of your pictures in an mkpic begin command ๐Ÿท๏ธ

in TeX, you must use the \bye command (not \end) to finish your TeX source ๐Ÿšจ

see the RUNNING section for how to run mkpic and TeX, LaTeX, or ConTeXt ๐Ÿƒโ€โ™€๏ธ


๐ŸŽ€ COMMANDS ๐ŸŽ€

the source is set up so that it's easy to add your own commands โœจ currently the following commands have been implemented (the arguments are not listed here; for those, refer to the SYNOPSIS section):

  • begin, end โ€” every picture begins with the begin command and ends with the end command. the begin command defines a name for the picture and defines a tex command with that name, prefixed with 'Fig'. the resulting command is written to a .mac file. thus the command
begin aa ...

starts writing \def\Figaa{...} to the .mac file, and the picture can be reproduced in a TeX document by importing the .mac file and using the \Figaa command. xl and yl are the lengths of the x- and y-axes. xlabel and ylabel are the label that are placed at the ends of those axes. use a space to suppress labeling, or "-" to suppress drawing the axes at all ๐Ÿ‘‘

  • stop โ€” stops further reading of the input. super useful if you have many pictures but want to see only the first few for testing purposes ๐Ÿงช
  • var=value โ€” sets the variable var to value. this variable, or an expression containing it, can be used instead of any numerical parameter. variable names may contain lower and uppercase letters, digits or underscores, with the restriction that they must start with a letter and may not end in an underscore ๐Ÿšจ
  • # โ€” denotes a comment ๐Ÿ’ฌ
  • xmark, ymark, Xmark, Ymark โ€” these commands place one or more labels along the x- or y-axes, either below (xmark and ymark) or above (Xmark and Ymark) the axis. for the [xXyY]mark commands a parameter containing any character other than [-.0-9] is interpreted as the label (this implies that you cannot use expressions here!) to be placed and its position is expected in the next parameter. if a parameter is just a number, it is placed at that x-position. if you want a number to be interpreted as a label, put it in braces: {1950} ๐Ÿท๏ธ
  • arccst โ€” (mnemonic: center start theta.) draws an arc with its center in xcenter,ycenter, starting in xstart,ystart and with an arc length of theta degrees ๐ŸŒˆ
  • arcset โ€” (mnemonic: start end theta.) draws an arc starting in xstart,ystartend ending in xend,yend and with an arc length of theta degrees ๐ŸŒˆ
  • arccrtt โ€” (mnemonic: center radius theta1 theta2.) draws an arc with its center in xcenter,ycenter, a radius radius starting at theta1 degrees and ending at theta2 degrees ๐ŸŒˆ
  • arc3 โ€” (mnemonic: 3 points.) draws an arc starting at (x1,y1), through (x2,y2) and ending in (x3,y3) ๐ŸŒˆ
  • xdrop, ydrop, xydrop โ€” these commands draw dotted arrows perpendicularly to the x-axis, the y-axis and both axes, respectively, ending on the axes with the arrow head ๐Ÿน
  • arrow โ€” draws an arrow from (x1,y1) to (x2,y2) labeled on its tail with label ๐Ÿน
  • label โ€” draws a label at (x,y). YX tells how it will be adjusted: for Y=t,b,c (x,y) will be, in the y-direction, on top, bottom or center of the label respectively, for X=l,r,c it will be, in the x-direction, left, right or center adjusted on (x,y). thus
label tl 0 0 Hello World!

will draw the string "Hello World" with its lower left corner at (0,0) โœจ

  • xlabels โ€” draws many labels, starting at (x,y), and incrementing x with dx after every label. YX: see label. labels may not contain spaces; if you need spaces, use - instead ๐Ÿšจ
  • ylabels โ€” same as xlabels, but incrementing y with dy instead ๐Ÿ”
  • point โ€” draws points (dots) at (x1,y1), (x2,y2) et cetera โšซ
  • dpoint โ€” draws points (dots) starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera โšซ
  • lines โ€” draws line segments from (x1,y1) to (x2,y2), (x3,y3) et cetera ๐Ÿ“
  • dlines โ€” draws line segments starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera ๐Ÿ“
  • curve โ€” draws a bezier curve from (x1,y1) to (x2,y2), (x3,y3) et cetera ๐ŸŒŠ
  • dcurve โ€” draws a bezier curve starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera ๐ŸŒŠ
  • rect โ€” draws a rectangle with diagonal points at (x1,y1) and (x2,y2) ๐ŸŸฆ
  • drect โ€” draws a rectangle with diagonal points at (x,y) and (x+dx,y+dy) ๐ŸŸฆ
  • crect โ€” clears a rectangle with diagonal points at (x1,y1) and (x2,y2) ๐Ÿงฝ
  • dcrect โ€” clears a rectangle with diagonal points at (x,y) and (x+dx,y+dy) ๐Ÿงฝ
  • arect โ€” draws a rectangle with a widdh width and a height height; the middle of the bottom is at (xc,yc) and the centerline through (xc,yc) makes an angle theta with the x-axis. (yes, it says "widdh" in the original, and yes, we're keeping it exactly like that ๐Ÿ’€) ๐Ÿ“
  • bar โ€” draws a equivalent with rectโฃx-xdevโฃ0โฃx+xdevโฃheight ๐Ÿ“Š
  • func โ€” draws the function given by expression-in-x between xmin and xmax, stepping with step units in the x-direction. note that the expression-in-x will be evaluated by Metafont, so you will have to use metafont syntax ๐Ÿšจ ๐Ÿ“ˆ
  • grid โ€” draw dotted grid lines at distances dx and dy in the x- and y directions; the gaps between the dots are set to xgap an ygap respectively. for an esthetic appearance, be sure to use integer dx/xgap and dy/ygap ratios โœจ
  • hatch โ€” hatch the closed curve that follows ๐Ÿชก
  • bhat โ€” starts a path that will eventually be closed, and then hatched ๐Ÿชก
  • ehat โ€” ends a path started with bhat, closes it and then hatches it ๐Ÿชก
  • anything else โ€” will be inserted as is in the macro file, and therefore should be a valid mfpic statement. you use this when you need such a statement only once, or a few times and therefore see no need to define a proper command for it ๐Ÿ’…

๐Ÿƒโ€โ™€๏ธ RUNNING mkpic/TeX ๐Ÿƒโ€โ™€๏ธ

the effect of running

mkpic picfile

is the creation of picfile.mac, which you can \input into a TeX or ConTeXt source, and picfile.sty which can be input into a LaTeX source using the \usepackage command ๐ŸŽ‰

after running TeX (or LaTeX or ConTeXt), you will find a file picfile.mf and you will have to run Metafont on it, which (assuming you configured TeX for 600 dpi) produces picfile.600gf. this file will have to be converted to a pk file with gftopk. finally, you need to run TeX, normally at least twice, again. so for pdfLaTeX the sequence is:

mkpic picfile pdflatex file.tex mf picfile gftopk picfile.600gf pdflatex
file pdflatex file

like, it's a whole journey, but you got this ๐Ÿซถ


๐Ÿ’€ BUG ๐Ÿ’€

currently only up to 256 pictures can be generated. in the future this problem will probably be solved by introducing more than one font and generating tex-command names that have the font name in front ๐Ÿ”ฎ


๐Ÿซถ AUTHOR ๐Ÿซถ

Wybo Dekker (wybodekker@me.com) โ€” iconic, honestly ๐Ÿ‘‘


released under the GNU General Public License (www.gnu.orgcopyleftgpl.html) ๐ŸŒˆ


okay bestie that's the whole page ๐Ÿ’– go forth and make tiny little pictures, you're literally the main character of TeX right now โœจ

and before I go โ€” a lil sign-off for the record: this was mkpic version 1.03, dated October 03, 2025, filed under mkpic(1) ๐ŸŽ€๐Ÿฆ‹๐Ÿ’… no cap, that's a wrap, periodt.

๐Ÿ“ฆ where this page comes from