Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on MetaPost. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/metapost.e> # or at <http://angg.twu.net/e/metapost.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.mailing-lists» (to "mailing-lists") # «.debian» (to "debian") # «.drawdot» (to "drawdot") # «.scrollmode» (to "scrollmode") # «.emp» (to "emp") # «.asymptote» (to "asymptote") # «.euclid-byrne» (to "euclid-byrne") # «.stitz-zeager» (to "stitz-zeager") # «.entry-level-metapost» (to "entry-level-metapost") # (find-angg ".emacs.papers" "metapost") # (find-angg ".emacs" "metapost") # (find-es "tex" "metapost") # (find-zsh "availabledebs | sort | grep texlive-metapost") ##### # # mailing-lists # 2019dec01 # ##### # «mailing-lists» (to ".mailing-lists") # https://tug.org/mailman/listinfo/metapost # https://tug.org/pipermail/metapost/ ##### # # Debian packages # 2011apr14 # ##### # «debian» (to ".debian") # (find-status "texlive-metapost") # (find-vldifile "texlive-metapost.list") # (find-udfile "texlive-metapost/") # (find-status "texlive-metapost-doc") # (find-vldifile "texlive-metapost-doc.list") # (find-udfile "texlive-metapost-doc/") /usr/share/texmf-texlive/metapost/base * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cat /var/lib/dpkg/info/texlive-metapost-doc.list \ | grep 'pdf$' \ | sort \ | tee /tmp/o \ | awk '{ print "(find-pdf-page \"" $1 "\")"}' \ | tee /tmp/o2 # (find-fline "/tmp/o2") # (find-mpintropage 1 "Contents") # (find-mpintrotext "") # (find-mpintropage 10 "btex $f(x)=x^2$ etex") # (find-mpintrotext "btex $f(x)=x^2$ etex") # (find-mpmanpage 1 "Contents") # (find-mpmantext "") # (find-mpmanpage (+ 1 5) "outputtemplate :=") # (find-mpmantext "outputtemplate :=") # (find-mpmanpage (+ 1 27) "when prologues is 3") # (find-mpmantext "when prologues is 3") # (find-mpmanpage (+ 1 8) "4 Curves") # (find-mpmantext "4 Curves") # (find-mpmanfile "examples.mp.gz" "beginfig(5)") # (find-mpmanpage (+ 1 42) "beginfig(34)") # (find-mpmantext "4 Curves") # (find-mpmanpage (+ 1 42) "beginfig(34)") # (find-mpmantext "4 Curves") # (find-mpmanfile "examples.mp.gz" "beginfig(1)") # (find-mpmanfile "examples.mp.gz" "% Keep the function single-valued") # (find-mpmanfile "mpman.tex.gz" "z1 = (60,40)") # (find-mpmangrep "zgrep -nH -e 60,40 *") # (find-mpmangrep "zgrep -nH -e beginfig.26. *") * (eepitch-mpost) * (eepitch-kill) * (eepitch-mpost) null outputtemplate:="/tmp/mp-%3c.mps"; prologues:=3; beginfig(26); numeric scf, #, t[]; 3.2scf = 2.4in; path fun; # = .1; % Keep the function single-valued fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right}..{curl .1}(3.2,2#)) yscaled(1/#) scaled scf; x1 = 2.5scf; for i=1 upto 2: (t[i],whatever) = fun intersectiontimes ((x[i],-infinity)--(x[i],infinity)); z[i] = point t[i] of fun; z[i]-(x[i+1],0) = whatever*direction t[i] of fun; draw (x[i],0)--z[i]--(x[i+1],0); fill fullcircle scaled 3bp shifted z[i]; endfor label.bot("x1", (x1,0)); label.bot("x2", (x2,0)); label.bot("x3", (x3,0)); draw (0,0)--(3.2scf,0); pickup pencircle scaled 1pt; draw fun; endfig; % (find-pspage "/tmp/mp-026.mps") beginfig(26); endfig; % (find-mpmanpage (+ 1 36) "beginfig(26)") % (find-mpmantext "4 Curves") beginfig(1); a=.7in; b=0.5in; z0=(0,0); z1=(a,0); z2=(0,b); z0=.5[z1,z3]=.5[z2,z4]; draw z1..z2..z3..z4..cycle; drawarrow z0..z1; drawarrow z0..z2; label.top(btex $a$ etex, .5[z0,z1]); label.lft(btex $b$ etex, .5[z0,z2]); endfig; * (eepitch-mpost) * (eepitch-kill) * (eepitch-mpost) null outputtemplate:="/tmp/mp-%3c.mps"; prologues:=3; beginfig(1); endfig; % (find-pspage "/tmp/mp-001.mps") * (eepitch-mpost) * (eepitch-kill) * (eepitch-mpost) null outputtemplate:="/tmp/mp-%3c.mps"; prologues:=3; beginfig(1); endfig; % (find-pspage "/tmp/mp-001.mps") beginfig(1); draw origin--(100,100); endfig; beginfig(5); for i=0 upto 2: z[i]=(0,50i); z[i+3]-z[i]=(60,40); z[i+6]-z[i]=(120,0); endfor pickup pencircle scaled 24; def gray = withcolor .8white enddef; draw z0--z3--z6 gray; linejoin:=mitered; draw z1..z4--z7 gray; linejoin:=beveled; draw z2..z5--z8 gray; dotlabels.bot(0,1,2,3,4,5,6,7,8); endfig; linejoin:=rounded; % (find-pspage "/tmp/mp-005.mps") * (eepitch-mpost) * (eepitch-kill) * (eepitch-mpost) null beginfig(1); ;; (find-zsh "dmissing microtype") http://www.gnu.org/software/3dldf/ ##### # # scrollmode # 2011apr14 # ##### # «scrollmode» (to ".scrollmode") * (eepitch-mpost) * (eepitch-kill) * (eepitch-mpost) null tracingonline:=1; scrollmode; show drawdot; show drawdot(1); # (find-mfbookpage (+ 13 61) "tracingonline:=1; scrollmode;") # (find-mfbooktext "tracingonline:=1; scrollmode;") ##### # # drawdot # 2011apr14 # ##### # «drawdot» (to ".drawdot") # (find-metapostgrep "grep -nH -e drawdot base/*") # (find-metapostfile "base/mfplain.mp" "def drawdot") # (find-metapostfile "base/mfplain.mp" "def t_ =") # (find-metapostfile "base/mfplain.mp" "def pc_ =") # (find-metapostfile "base/plain.mp" "def drawdot") # (find-metapostfile "base/plain.mp" "def _op_ =") (find-3 '(find-metapostfile "base/mfplain.mp" "def drawdot") '(find-metapostfile "base/plain.mp" "def drawdot") ) ##### # # Embedded MetaPost # 2011apr25 # ##### # «emp» (to ".emp") # http://www.ntg.nl/maps/28/16.pdf # (find-pdf-page "/usr/share/doc/texlive-metapost-doc/latex/emp/emp.pdf") # (find-sh "locate luamplib") # (find-fline "/usr/share/texmf-texlive/tex/luatex/luamplib/") # (find-fline "/usr/share/texmf-texlive/tex/luatex/luamplib/luamplib-createmem.lua") # (find-fline "/usr/share/texmf-texlive/tex/luatex/luamplib/luamplib.lua") # (find-fline "/usr/share/texmf-texlive/tex/luatex/luamplib/luamplib.sty") ;; (find-udfile "texlive-luatex/luatex/luamplib/") ;; (find-udfile "texlive-luatex/luatex/luamplib/README") (code-pdf-page "luamplib" "/usr/share/doc/texlive-luatex/luatex/luamplib/luamplib.pdf") (code-pdf-text "luamplib" "/usr/share/doc/texlive-luatex/luatex/luamplib/luamplib.pdf") ;; (find-luamplibpage) ;; (find-luamplibtext) ##### # # Asymptote # 2013may04 # ##### # «asymptote» (to ".asymptote") # http://www.artofproblemsolving.com/Wiki/index.php/Asymptote_%28Vector_Graphics_Language%29 # https://asymptote.sourceforge.io/gallery/ # https://asymptote.sourceforge.io/ ##### # # Jeremy Button's MetaPost version of Oliver Byrne's Euclid's Elements # 2020apr07 # ##### # «euclid-byrne» (to ".euclid-byrne") # See: (find-books "__analysis/__analysis.el" "euclid-byrne") # http://www.math.ubc.ca/~cass/Euclid/byrne.html # https://github.com/jemmybutton/byrne-euclid # https://github.com/jemmybutton/byrne-euclid/releases/tag/0.4%2B0.1 # https://github.com/jemmybutton/byrne-euclid/releases/download/0.4%2B0.1/byrne_context.pdf # (code-pdf-page "byrneeuclid" "$S/https/github.com/jemmybutton/byrne-euclid/releases/download/0.4%2B0.1/byrne_context.pdf") # (code-pdf-text "byrneeuclid" "$S/https/github.com/jemmybutton/byrne-euclid/releases/download/0.4%2B0.1/byrne_context.pdf") # (find-byrneeuclidpage) # (find-byrneeuclidtext) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/byrne-euclid/ cd ~/usrc/ git clone https://github.com/jemmybutton/byrne-euclid cd ~/usrc/byrne-euclid/ export PAGER=cat git branch --list -a git for-each-ref git log --oneline --graph --all -20 # (find-fline "~/usrc/") # (find-fline "~/usrc/byrne-euclid/") # (find-gitk "~/usrc/byrne-euclid/") # (code-c-d "byrneeuclid" "~/usrc/byrne-euclid/") # (find-byrneeuclidfile "") # (find-byrneeuclidgrep "grep --color -nH --null -e input *") # (find-byrneeuclidfile "byrne_euclid_man.tex" "to generate the book pdf") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/byrne-euclid/ context byrne_euclid_man.tex |& tee ocbe # (find-pdf-page "~/usrc/byrne-euclid/byrne_euclid_man.pdf") # (find-pdf-text "~/usrc/byrne-euclid/byrne_euclid_man.pdf") context byrne_context.tex |& tee ocbc # mpost lettrines.mp # context byrne_context.tex # On building errors: # (find-byrneeuclidfile "ocbc" "EBGaramond12-Regular") # (find-byrneeuclidfile "byrne_context.log" "EBGaramond12-Regular") # https://github.com/jemmybutton/byrne-euclid/issues/41 # See: # https://wiki.contextgarden.net/Fonts_in_LuaTeX#How_LuaTeX_handles_system_fonts ##### # # stitz-zeager # 2022jul26 # ##### # «stitz-zeager» (to ".stitz-zeager") # (find-books "__analysis/__analysis.el" "stitz-zeager") # https://stitz-zeager.com/Precalc4Source.zip # https://stitz-zeager.com/Precalculus4.pdf # (code-c-d "stitzz4" "~/usrc/Precalc4Prelim/") # (find-stitzz4file "") # (find-stitzz4sh "find * | grep jp") # (find-stitzz4file "IntroductiontoFunctions/FunctionsandtheirRepresentations.tex") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "~/usrc/Precalc4Prelim/") rm -Rv ~/usrc/Precalc4Prelim/ ~/usrc/__MACOSX/ mkdir ~/usrc/Precalc4Prelim/ cd ~/usrc/Precalc4Prelim/ unzip -d ~/usrc/ $S/https/stitz-zeager.com/Precalc4Source.zip rm -Rv ~/usrc/__MACOSX/ ##### # # entry-level-metapost # 2022dec20 # ##### # «entry-level-metapost» (to ".entry-level-metapost") # https://tug.org/TUGboat/contents.html Entry-level MetaPost # https://tug.org/TUGboat/intromp/ # https://tug.org/TUGboat/intromp/tb106voipio-grid.pdf # https://tug.org/TUGboat/intromp/tb107voipio-moveit.pdf # https://tug.org/TUGboat/intromp/tb108voipio-color.pdf # https://tug.org/TUGboat/intromp/tb109voipio-lines.pdf ;; <voipio1> ;; https://tug.org/TUGboat/intromp/tb106voipio-grid.pdf ;; (find-fline "$S/https/tug.org/TUGboat/intromp/") (code-pdf-page "voipio1" "$S/https/tug.org/TUGboat/intromp/tb106voipio-grid.pdf") (code-pdf-text "voipio1" "$S/https/tug.org/TUGboat/intromp/tb106voipio-grid.pdf") ;; (find-voipio1page) ;; (find-voipio1text) # (find-angg "MP/test1.mp") https://tex.stackexchange.com/questions/517137/how-do-i-draw-this-picture-of-boxes-with-arrows-in-latex \documentclass[border=5mm]{standalone} \usepackage{luatex85} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} def drawtailarrow expr p = _apth := p; _fintarr enddef; def _fintarr text t = draw (up--down) scaled 3 shifted point 0 of _apth t; draw _apth t; filldraw arrowhead _apth t enddef; beginfig(1); numeric ht, wd; ht = 21; wd = 34; path box[]; box1 = unitsquare xscaled wd yscaled ht; box3 = box1 shifted (3 wd, 0); box5 = box1 shifted (6 wd, 0); box2 = unitsquare scaled ht shifted point 1 of box1; box4 = unitsquare scaled ht shifted point 1 of box3; box6 = unitsquare scaled ht shifted point 1 of box5; z0 = center box1 shifted (-3/2 wd, 0); label("$C$", z0); label("$4$", center box1); label("$6$", center box3); label("$6$", center box5); label("Nil", center box6); forsuffixes $=1,2,3,4,5,6: draw box$ withcolor 3/4 blue; endfor interim linecap := 0; % these parameters improve the look of interim linejoin := 0; % the arrows drawn with a fat pen interim ahangle := 30; drawoptions(withpen pencircle scaled 1.2 withcolor 2/3 red); drawtailarrow z0 shifted 10 right -- point 7/2 of box1; drawtailarrow center box2 -- point 7/2 of box3; drawtailarrow center box4 -- point 7/2 of box5; drawoptions(); endfig; \end{mplibcode} \end{document} # http://tug.org/mailman/listinfo/metapost # http://tug.org/pipermail/metapost/ # http://www.tug.org/metapost.html # http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html # http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.305.gif * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) for i in $(seq 1 305); do psnec http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.$i.gif done http://www.tug.org/TUGboat/Articles/tb28-3/tb90hoekwater-mplib.pdf http://www.tug.org/TUGboat/Articles/tb29-3/tb93hoekwater.pdf http://www.tug.org/TUGboat/Articles/tb28-3/tb90hoekwater-mplib.pdf http://www.tug.org/TUGboat/Articles/tb30-1/tb94zheng.pdf https://www.yld.io/blog/lessons-from-metafont/ https://github.com/guidoism/wildwood/blob/main/house.org tracingall; # Local Variables: # coding: utf-8-unix # End: