mkpic(1)
๐ 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 thebegincommand and ends with theendcommand. thebegincommand defines a name for the picture and defines a tex command with that name, prefixed with'Fig'. the resulting command is written to a.macfile. 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 (xmarkandymark) or above (XmarkandYmark) the axis. for the[xXyY]markcommands 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: seelabel. labels may not contain spaces; if you need spaces, use-instead ๐จylabelsโ same asxlabels, 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 withrectโฃ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 withbhat, 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 ๐
๐ COPYRIGHT ๐
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
- alpine 3.24: texmf-dist-pictures-doc 2026.0-r0 ยท LPPL-1.0 AND LPPL-1.1 AND LPPL-1.2 AND LPPL-1.3a AND LPPL-1.3c AND GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms