.TH mkpic 1 "October 03, 2025" "mkpic version 1.03" "DekDoc scripts" .SH NAME mkpic - interface for making pictures with mfpic .SH Synopsis .B mkpic [options] [picfile] .SH Options .B -c,--clean .RS remove all but the input file and die .RE .B -p,--pdfsample .RS create pdf file with sample images .RE .B -f,--font= .RS set default font for labels .RE .B --[no]box .RS produce framed boxes .RE .B -V,--version .RS report version number and die .RE .B -h,--help .RS display help info and die .RE .B --[no]debug .RS display debugging information .RE .B -l,--log= .RS file for warning messages .RE Without an input file, the DATA section is used. .SH Command overview .B begin .RS .B name xl yl xmin ymin xmax ymax xlabel ylabel .RE .B end .B stop .B var=value .B # .RS .B comment .RE .B .B arccst .RS .B xcenter ycenter xstart ystart theta .RE .B arcset .RS .B xstart ystart xend yend theta .RE .B arccrtt .RS .B xcenter ycenter radius theta1 theta2 .RE .B arc3 .RS .B x1 y1 x2 y2 x3 y3 .RE .B .B xmark .RS .B [label1] x1 [label2] x2 ... .RE .B Xmark .RS .B [label1] x1 [label2] x2 ... .RE .B ymark .RS .B [label1] y1 [label2] y2 ... .RE .B Ymark .RS .B [label1] y1 [label2] y2 ... .RE .B .B xdrop .RS .B x y .RE .B ydrop .RS .B x y .RE .B xydrop .RS .B x y .RE .B .B arrow .RS .B x1 y1 x2 y2 label .RE .B label .RS .B YX x y label .RE .B xlabels .RS .B YX x y dx label ... .RE .B ylabels .RS .B YX x y dy label ... .RE .B .B point .RS .B x1 y1 x2 y2 ... .RE .B dpoint .RS .B x1 y1 dx1 dy1 ... .RE .B lines .RS .B x1 y1 x2 y2 ... .RE .B dlines .RS .B x1 y1 dx1 dy1 ... .RE .B curve .RS .B x1 y1 x2 y2 ... .RE .B dcurve .RS .B x1 y1 dx1 dy1 ... .RE .B .B rect .RS .B x1 y1 x2 y2 .RE .B drect .RS .B x y dx dy .RE .B dcrect .RS .B x y dx dy .RE .B crect .RS .B x1 y1 x2 y2 .RE .B arect .RS .B xc yc width height theta .RE .B bar .RS .B x xdev height .RE .B .B func .RS .B xmin xmax step expression-in-x .RE .B .B grid .RS .B dx dy xgap ygap .RE .B hatch .RS .B .RE .B bhat .RS .B .RE .B ehat .RS .B .RE .SH Description mkpic provides an easy interface for making small pictures with mfpic. To this end an input file has to be created consisting of commands, one per line, with space separated parameters (or you modify the DATA section of the mkpic script, which is used if you run it without an input file). For an extensive description see 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: .B picfile.mac .RS a macro file which will contain TeX commands for every picture .RE .B picfile.sty .RS a style file for latex, defining the same TeX commands for every picture. .RE With the --pdfsample option, two other files are produced: .B picfile.pdf .RS a PDF file containing all pictures. This lets you easily check the results of your designs. .RE .B picfile.tex .RS the TeX source used for creating this PDF file. .RE In LaTeX, you have to include \\usepackage{picfile} and to include commands like \\Fig\fIname\fR in your source, where \fIname\fR 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 \\Fig\fIname\fR in your source, where \fIname\fR is the name you gave one of your pictures in an mkpic begin command. In TeX, you must use the \\bye command (\fInot\fR \\end to finish your TeX source See the RUNNING section for how to run mkpic and TeX, LaTeX, or ConTeXt. .SH Commands The source is set up so that it is 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): .B begin, end .RS 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 .RE .B .RS .B begin aa ... .RE .B .RS 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. .RE .B .RS 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. .RE .B .B stop .RS stops further reading of the input. Useful if you have many pictures, but want to see only the first few for testing purposes. .RE .B .B var=value .RS 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. .RE .B .B # .RS .B .RE .RS denotes a comment .RE .B .B xmark, ymark, Xmark, Ymark .RS 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. .RE .B .RS 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}. .RE .B .B arccst .RS (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. .RE .B .B arcset .RS (Mnemonic: start end theta.) Draws an arc starting in xstart,ystartend ending in xend,yend and with an arc length of theta degrees. .RE .B .B arccrtt .RS (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. .RE .B .B arc3 .RS (Mnemonic: 3 points.) Draws an arc starting at (x1,y1), through (x2,y2) and ending in (x3,y3). .RE .B .B xdrop, ydrop, xydrop .RS 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. .RE .B .B arrow .RS draws an arrow from (x1,y1) to (x2,y2) labeled on its tail with label .RE .B .B label .RS 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 .RE .B .RS .B label tl 0 0 Hello World! .RE .B .RS will draw the string "Hello World" with its lower left corner at (0,0) .RE .B .B xlabels .RS 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. .RE .B .B ylabels .RS Same as xlabels, but incrementing y with dy instead. .RE .B .B point .RS draws points (dots) at (x1,y1), (x2,y2) et cetera. .RE .B .B dpoint .RS draws points (dots) starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera. .RE .B .B lines .RS .B .RE .RS draws line segments from (x1,y1) to (x2,y2), (x3,y3) et cetera. .RE .B .B dlines .RS draws line segments starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera. .RE .B .B curve .RS draws a bezier curve from (x1,y1) to (x2,y2), (x3,y3) et cetera. .RE .B .B dcurve .RS draws a bezier curve starting at (x1,y1) and then moving by (dx1,dy1), (dx2,dy2) et cetera. .RE .B .B rect .RS draws a rectangle with diagonal points at (x1,y1) and (x2,y2). .RE .B .B drect .RS draws a rectangle with diagonal points at (x,y) and (x+dx,y+dy). .RE .B .B crect .RS clears a rectangle with diagonal points at (x1,y1) and (x2,y2). .RE .B .B dcrect .RS clears a rectangle with diagonal points at (x,y) and (x+dx,y+dy). .RE .B .B arect .RS 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. .RE .B .B bar .RS draws a equivalent with rect␣x-xdev␣0␣x+xdev␣height .RE .B .B func .RS 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. .RE .B .B grid .RS 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. .RE .B .B hatch .RS hatch the closed curve that follows. .RE .B .B bhat .RS starts a path that will eventually be closed, and then hatched. .RE .B .B ehat .RS ends a path started with bhat, closes it and then hatches it. .RE .B .B anything else .RS 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. .RE .SH 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 .SH 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. .SH Author Wybo Dekker (wybodekker@me.com) .SH Copyright Released under the GNU General Public License (www.gnu.org\fIcopyleft\fRgpl.html)