Last active
May 24, 2024 18:24
-
-
Save Gavinok/0d0f05c6223f1538aec7439f047234dd to your computer and use it in GitHub Desktop.
A collection of groff,pic,and eqn macros used in many of my local files. Note that many of these are not my own work and come from a variety of sources.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.defcolor LOCALBLUE rgb 0.1 0.1 0.9 | |
.de NOTE | |
\m[LOCALBLUE]NOTE\m[]: \\$* | |
.. | |
.de PROOF | |
.ft BI | |
PROOF | |
.ft | |
.. | |
.defcolor LOCALRED rgb 1 0.0 0.0 | |
.de TODO | |
\m[LOCALRED]TODO\m[]: \\$1 | |
.. | |
.\" .BU [[n|N|i|I|a|A num] | symbol] | |
.\" Example Usage | |
.\" .BU | |
.\" first line. | |
.\" .BU | |
.\" second line | |
.\" .LP | |
.\" .BU n | |
.\" first line. | |
.\" .BU | |
.\" second line | |
.\" .LP | |
.\" The macro looks like 18 , | |
.\" ********************* | |
.\" ************************My BU macro********************************** | |
.\" | |
.\" Predefine some registers and strings. These are also reset with | |
.\" every .NH [i] invocation. | |
.nr bu 0 | |
.ds symbol \\(bu | |
.ds numeric | |
.de BU \"{{{ | |
.\" | |
.\" If there is an argument, its either a symbol, or a numeric format & value | |
.\" | |
.if !'\\$1'' \{\ | |
. ds symbol | |
. ds numeric \$1 | |
. ie '\\$1'n' .af bu 1 | |
\" set format to 1 ... | |
. el \{\ | |
. ie '\\$1'N' .af bu 001 | |
\" set format to 001 ... | |
. el \{\ | |
. ie '\\$1'i' .af bu i | |
\" set format to lower case roman numerals | |
. el \{\ | |
. ie '\\$1'I' .af bu I \" set format to upper case roman numerals | |
. el \{\ | |
. ie '\\$1'a' .af bu a \" set format to lower case alphabetic | |
. el \{\ | |
. ie '\\$1'A' .af bu A | |
\" set format to upper case alphabetic | |
. el \{\ | |
. ds symbol \\$1 | |
. ds numeric | |
. \} | |
. \} | |
. \} | |
. \} | |
. \} | |
. \} | |
.\" | |
.\" If there is a second argument, it must be the start value | |
.\" | |
. if !'\\*[numeric]'' \{\ | |
. ie '\\$2'' \{\ | |
. nr bu 1 | |
. \} | |
. el \{\ | |
. nr bu \\$2 | |
. \} | |
. \} | |
.\} | |
.\" | |
.ie !'\\*[numeric]'' \{\ | |
. IP \\n(bu | |
. af bu 1 | |
. nr bu \\n(bu+1 | |
. ie '\\*[numeric]'n' .af bu 1 | |
. el \{\ | |
. ie '\\*[numeric]'N' .af bu 001 | |
. el .af bu \\*[numeric] | |
. \} | |
.\} | |
.el \{\ | |
. IP \\*[symbol] | |
.\} | |
.. \"}}} | |
.de striketrough \"{{{ | |
\Z'\\$1'\v'-.25m'\D'l \w'\\$1'u 0'\v'.25m'\\$2 | |
.. \"}}} | |
.ig | |
TODO: find link for the origin of these macros | |
Colored Box Backgrounds | |
Use .ll to set the line length so the box knows how big to be | |
.. | |
.de BB \"{{{ | |
.br | |
.in 1n | |
.ll -1n | |
.di BX | |
.. | |
.de EB | |
.br | |
.di | |
.in | |
.ll | |
.nr BW \\n(dl+1n | |
.nr BH \\n(dn+.5v | |
.ne \\n(BHu+.5v | |
.in 0 | |
\M[grey90]\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] | |
.sp -.5v | |
.nf | |
.BX | |
.in | |
.sp .5v | |
.fi | |
.. \"}}} | |
.\" EQN STUFF | |
\" From manual | |
.EQ \" {{{ | |
define ! 'special Ca' | |
define box 'special Bx' | |
.EN | |
.de Bx | |
.ds 0s \Z'\h'1n'\\*(0s'\ | |
\Z'\v'\\n(0du+1n'\D'l \\n(0wu+2n 0'\D'l 0 -\\n(0hu-\\n(0du-2n'\ | |
\D'l -\\n(0wu-2n 0'\D'l 0 \\n(0hu+\\n(0du+2n''\h'\\n(0wu+2n' | |
.nr 0w +2n | |
.nr 0d +1n | |
.nr 0h +1n | |
.nr 0skern 0 | |
.nr 0skew 0 | |
.. | |
.de Ca \"{{{ | |
. ds 0s \ | |
\Z'\\*(0s'\ | |
\v'\\n(0du'\ | |
\D'l \\n(0wu -\\n(0hu-\\n(0du'\ | |
\v'\\n(0hu' | |
.. \"}}} | |
.\" The following is a short eqn/troff macro for creating doing | |
.\" several things, but mainly to create oblique (or Italics) Greek | |
.\" lower-case letters for mathemtical equations. | |
.\" Simply include this file in your initial eqn set-up: | |
.\" .EQ | |
.\" include "alphas" | |
.\" gsize 12 | |
.\" delim `` | |
.\" .EN | |
.\" Note: some non-ASCII characters may differ on your set-up. | |
.\" Edit to taste. | |
.\" | |
.\" Written by Robert Marks, [email protected]. Vers. 1.0, Aug 22, 1995. | |
.\" | |
.EQ \" {{{ | |
define Fourier '"\s+4\f[ZCMI]F\fP\s0"' | |
define Laplace '"\s+4\f[ZCMI]L\fP\s0"' | |
define lcb % ^ roman "{"^ % | |
define rcb % ^ roman "}"^ % | |
define Fraction % {up 20 size -4 $1 down 25 "" back 12 size +1 "\S'+15'/\S'0'" up 5 "" fwd 6 size -4 $2} % | |
define Calcat % "\b'\(br\(br'" sub roman down 100 {~ $1 } % | |
define lower % sub up 30 fwd 50 % | |
define upper % sup up 30 % | |
define Integral % {size +2 int lower $1 upper $2} % | |
define alpha % "\S'+15'\s-1\H'+1'\(*a\H'0'\s+1\S'0'\h'0.2n'" % | |
define ALPHAit % "\S'+15'\s-1\H'+1'\(*A\H'0'\s+1\S'0'\h'0.1n'" % | |
define beta % "\S'+15'\s-1\H'+1'\(*b\H'0'\s+1\S'0'\h'0.2n'" % | |
define BETAit % "\S'+15'\s-1\H'+1'\(*B\H'0'\s+1\S'0'\h'0.2n'" % | |
define gamma % "\S'+15'\s-1\H'+1'\(*g\H'0'\s+1\S'0'\h'0.4n'" % | |
define GAMMAit % "\S'+15'\s-1\H'+1'\(*G\H'0'\s+1\S'0'\h'0.35n'" % | |
define delta % "\S'+15'\s-1\H'+1'\(*d\H'0'\s+1\S'0'\h'0.3n'" % | |
define DELTAit % "\S'+15'\s-1\H'+1'\(*D\H'0'\s+1\S'0'\h'0.1n'" % | |
define epsilon % "\S'+15'\s-1\H'+1'\(*e\H'0'\s+1\S'0'\h'0.2n'" % | |
define EPSILONit % "\S'+15'\s-1\H'+1'\(*E\H'0'\s+1\S'0'\h'0.25n'" % | |
define zeta % "\S'+15'\s-1\H'+1'\(*z\H'0'\s+1\S'0'\h'0.3n'" % | |
define ZETAit % "\S'+15'\s-1\H'+1'\(*Z\H'0'\s+1\S'0'\h'0.33n'" % | |
define eta % "\S'+15'\s-1\H'+1'\(*y\H'0'\s+1\S'0'\h'0.17n'" % | |
define ETAit % "\S'+15'\s-1\H'+1'\(*Y\H'0'\s+1\S'0'\h'0.28n'" % | |
define theta % "\S'+15'\s-1\H'+1'\(*h\H'0'\s+1\S'0'\h'0.2n'" % | |
define THETAit % "\S'+15'\s-1\H'+1'\(*H\H'0'\s+1\S'0'\h'0.2n'" % | |
define iota % "\S'+15'\s-1\H'+1'\(*i\H'0'\s+1\S'0'\h'0.17n'" % | |
define IOTAit % "\S'+15'\s-1\H'+1'\(*I\H'0'\s+1\S'0'\h'0.33n'" % | |
define kappa % "\S'+15'\s-1\H'+1'\(*k\H'0'\s+1\S'0'\h'0.3n'" % | |
define KAPPAit % "\S'+15'\s-1\H'+1'\(*K\H'0'\s+1\S'0'\h'0.33n'" % | |
define lambda % "\S'+15'\s-1\H'+1'\(*l\H'0'\s+1\S'0'\h'0.2n'" % | |
define LAMBDAit % "\S'+15'\s-1\H'+1'\(*L\H'0'\s+1\S'0'\h'0.1n'" % | |
define mu % "\S'+15'\s-1\H'+1'\(*m\H'0'\s+1\S'0'\h'0.2n'" % | |
define MUit % "\S'+15'\s-1\H'+1'\(*M\H'0'\s+1\S'0'\h'0.33n'" % | |
define nu % "\S'+15'\s-1\H'+1'\(*n\H'0'\s+1\S'0'\h'0.25n'" % | |
define NUit % "\S'+15'\s-1\H'+1'\(*N\H'0'\s+1\S'0'\h'0.33n'" % | |
define xi % "\S'+15'\s-1\H'+1'\(*c\H'0'\s+1\S'0'\h'0.2n'" % | |
define XIit % "\S'+15'\s-1\H'+1'\(*C\H'0'\s+1\S'0'\h'0.25n'" % | |
define omicron % "\S'+15'\s-1\H'+1'\(*o\H'0'\s+1\S'0'\h'0.2n'" % | |
define OMICRONit % "\S'+15'\s-1\H'+1'\(*O\H'0'\s+1\S'0'\h'0.2n'" % | |
define pi % "\S'+15'\s-1\H'+1'\(*p\H'0'\s+1\S'0'\h'0.25n'" % | |
define PIit % "\S'+15'\s-1\H'+1'\(*P\H'0'\s+1\S'0'\h'0.33n'" % | |
define rho % "\S'+15'\s-1\H'+1'\(*r\H'0'\s+1\S'0'\h'0.2n'" % | |
define RHOit % "\S'+15'\s-1\H'+1'\(*R\H'0'\s+1\S'0'\h'0.25n'" % | |
define sigma % "\S'+15'\s-1\H'+1'\(*s\H'0'\s+1\S'0'\h'0.3n'" % | |
define SIGMAit % "\S'+15'\s-1\H'+1'\(*S\H'0'\s+1\S'0'\h'0.3n'" % | |
define tau % "\S'+15'\s-1\H'+1'\(*t\H'0'\s+1\S'0'\h'0.3n'" % | |
define TAUit % "\S'+15'\s-1\H'+1'\(*T\H'0'\s+1\S'0'\h'0.3n'" % | |
define upsilon % "\S'+15'\s-1\H'+1'\(*u\H'0'\s+1\S'0'\h'0.2n'" % | |
define UPSILONit % "\S'+15'\s-1\H'+1'\(*U\H'0'\s+1\S'0'\h'0.4n'" % | |
define phi % "\S'+15'\s-1\H'+1'\(*f\H'0'\s+1\S'0'\h'0.2n'" % | |
define PHIit % "\S'+15'\s-1\H'+1'\(*F\H'0'\s+1\S'0'\h'0.2n'" % | |
define psi % "\S'+15'\s-1\H'+1'\(*q\H'0'\s+1\S'0'\h'0.35n'" % | |
define PSIit % "\S'+15'\s-1\H'+1'\(*Q\H'0'\s+1\S'0'\h'0.35n'" % | |
define chi % "\S'+15'\s-1\H'+1'\(*x\H'0'\s+1\S'0'\h'0.25n'" % | |
define CHIit % "\S'+15'\s-1\H'+1'\(*X\H'0'\s+1\S'0'\h'0.33n'" % | |
define omega % "\S'+15'\s-1\H'+1'\(*w\H'0'\s+1\S'0'\h'0.2n'" % | |
define OMEGAit % "\S'+15'\s-1\H'+1'\(*W\H'0'\s+1\S'0'\h'0.2n'" % | |
define aleph % "\S'+15'\s-1\H'+1'\(al\H'0'\s+1\S'0'\h'0.2n'" % | |
define ln % "\S'-15'\f2ln\fP\S'0'" % | |
define lscr % "\S'-15'\f2l\fP\S'0'" % | |
define becaus % "\u\s+5.\s0\d\s+5.\s0\u\s+5.\s0\d" % | |
define times % \(mu % | |
define (( "left (" | |
define )) "right )" | |
define [[ "left [" | |
define ]] "right ]" | |
define '' 'left ""' | |
define lt % roman "\^<\^" % | |
define < % roman "\^<\^" % | |
define gt % roman "\^>\^" % | |
define > % roman "\^>\^" % | |
define | % roman "\^|\^" % | |
define / % roman "\^\S'+18'\(br\S'0'\^"^ ^ % | |
define ++++ % \(pl % | |
define ==== % \(eq % | |
define prime % \(mt % | |
define there4 % \(tf % | |
define thf % \(tf % | |
define forall % \(fa % | |
define oppA % \(fa % | |
define exist % \(te % | |
define oppE % \(te % | |
define intersection % "\(ca" % | |
define union % "\(cu" % | |
define Exp % roman "Exp" % | |
define cov % roman "cov" % | |
define Cov % roman "Cov" % | |
define var % roman "var" % | |
define Var % roman "Var" % | |
define Prob % roman "Prob" % | |
define all % ~ roman "all" ~ % | |
define and % ~ roman "and" ~ % | |
define where % ~ roman "where" ~ % | |
define subject % ~ roman "subject" ~ % | |
define st % roman "st" % | |
define nd % roman "nd" % | |
define rd % roman "rd" % | |
define th % roman "th" % | |
define n.s. % roman "n.s." % | |
define s.t. % roman "s.t." % | |
define tr % roman "tr" % | |
define sgn % roman "sgn" % | |
define RR % "\fHI\h'-.85n'R\fP" % | |
define sroot % down 20 sqrt up 20 % | |
define app= % "\(mi" up 20 back 55 "\(ap" down 20 "\&" % | |
define -wig % "\(mi" up 20 back 55 "\(ap" down 20 "\&" % | |
define wig % "\(ap" % | |
define divby % ^ "\(di" ^ % | |
define member % "\(mo" % | |
define $ % "$" % | |
.EN \" }}} | |
.\" PIC STUFF | |
.PS \" {{{ | |
# e.g. dime( 1 , 2 , DIM1 ) | |
# dime( ht , wid , NAME, "text" ) | |
define dime { | |
$3: [ | |
W: line up $1/2 right $2/2 | |
N: line down $1/2 right $2/2 | |
E: line down $1/2 left $2/2 | |
S: line up $1/2 left $2/2 | |
NW: W.c | |
NE: N.c | |
SE: E.c | |
SW: S.c | |
] | |
"$4" at $3 | |
move to $3.s | |
} | |
define vec { | |
"$1" at ($2 + ($4/2)),($3 + ($5/2)) | |
arrow from $2,$3 to ($2+$4),($3+$5) | |
} | |
define dvec { | |
"$1" at ($2 + ($4/2)),($3 + ($5/2)) | |
arrow dashed from $2,$3 to ($2+$4),($3+$5) | |
} | |
# venn Diagrams | |
# e.g. vennDiagram1(2, 3, "1.", "A") | |
# move down from last box.s | |
# vennDiagram2(2, 3, "2.", "A", "B") | |
# move down from last box.s | |
define vennDiagram1 { | |
box height $1 width $2 | |
$3 at last box.nw - (0.1, 0.0) | |
"U" at last box.ne - (0.1, 0.1) | |
circle radius last box.height/4 at last box.c | |
$4 at last circle.nw + (-0.1, 0.1) | |
move to last box.e | |
} | |
define vennDiagram2 { | |
box height $1 width $2 | |
$3 at last box.nw - (0.1, 0.0) | |
"U" at last box.ne - (0.1, 0.1) | |
circle radius last box.height/4 at last box.c - (last box.height/8, 0) | |
$4 at last circle.nw + (-0.1, 0.1) | |
circle radius last box.height/4 at last box.c + (last box.height/8, 0) | |
$5 at last circle.ne + (0.1, 0.1) | |
move to last box.e | |
} | |
define vennDiagram3 { | |
box height $1 width $2 | |
$3 at last box.nw - (0.1, 0.0) | |
"U" at last box.ne - (0.1, 0.1) | |
circle radius last box.height/4 at last box.c - (last box.height/7, | |
-last box.height/10) | |
$4 at last circle.nw + (-0.1, 0.1) | |
circle radius last box.height/4 at last box.c + (last box.height/7, | |
last box.height/10) | |
$5 at last circle.ne + (0.1, 0.1) | |
circle radius last box.height/4 at last box.c - (0, last box.height/7) | |
$6 at last circle.sw - (0.1, 0.1) | |
move to last box.e | |
} | |
.PE \" }}} | |
.de @FE | |
.ie !\\n[fn*open] .@error FE without FS | |
.el \{\ | |
. nr fn*open 0 | |
. br | |
. nr par*box-fnspace +\\n[.d] | |
. ev | |
. fn*end-div | |
.\} | |
.. | |
.\" -------------------------------------------------------------------- | |
.\" B1 [fill_color [frame_color [frame_thickness]]] | |
.\" start boxed text | |
.\" | |
.de B1 \"{{{ | |
.ie \\n[.$]>0 \{\ | |
. nr par*box-compat 0 | |
. ds par*box-color \\$1 | |
. ds par*box-fcolor \\*[par*box-color] | |
. nr par*box-fthickness 0 | |
. | |
. if \\n[.$]>1 .ds par*box-fcolor \\$2 | |
. if \\n[.$]>2 .nr par*box-fthickness \\$3 | |
.\} | |
.el .nr par*box-compat 1 | |
. | |
.nr par*box-fnspace 0 | |
.br | |
.HTML-IMAGE | |
.di par*box-div \" beginn diverting text to par*box-div | |
.nr \\n[.ev]:li +1n | |
.nr \\n[.ev]:ri +1n | |
.nr par*box-in \\n[.in] | |
.\" remember what 1n is, just in case the point size changes | |
.nr par*box-n 1n | |
.in +1n | |
.ll -1n | |
.lt -1n | |
.ti \\n[par*box-in]u+1n | |
.. | |
.de @div-end!par*box-div | |
.B2 | |
.. \"}}} | |
.\" end boxed text | |
.\" Postpone the drawing of the box until we're in the top-level diversion, | |
.\" in case there's a footnote inside the box. | |
.de B2 \"{{{ | |
.ie '\\n(.z'par*box-div' \{\ | |
. br | |
. if \n[.V]>.25m .sp | |
. di \" end diverting text | |
. if \n[.V]>.25m .sp | |
. ds@need \\n[dn] | |
. par*box-mark-top | |
. | |
. nr \\n[.ev]:ri -\\n[par*box-n] | |
. nr \\n[.ev]:li -\\n[par*box-n] | |
. in -\\n[par*box-n]u | |
. ll +\\n[par*box-n]u | |
. lt +\\n[par*box-n]u | |
.\" box color isn't transparent, it must be drawn before writing the text | |
. par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n) | |
. ev nf | |
. par*box-div | |
. ev | |
.\} | |
.el .@error B2 without B1 | |
.HTML-IMAGE-END | |
.. | |
.de par*box-mark-top | |
.ie '\\n[.z]'' \{\ | |
. rs | |
. mk par*box-top | |
.\} | |
.el \!.par*box-mark-top | |
.. | |
.de par*box-draw | |
.ie '\\n[.z]'' \{\ | |
. nr par*box-in \\n[.i] | |
. nr par*box-ll \\n[.l] | |
. nr par*box-vpt \\n[.vpt] | |
. nr par*box-ad \\n[.j] | |
. ad l \" adjust to left | |
. vpt 0 \" disable vertical position trap | |
. in \\$1 | |
. ll \\$2 | |
.\" we are at the top left corner | |
.\" calculate the opposite | |
.nr par*box-top \\n[par*box-top]u+\\n[dn]-\\n[par*box-fnspace] | |
.if \\n[par*box-fnspace]>0 .nr par*box-top -\\n[fn*need]u | |
.ie \\n[par*box-compat] \{\ | |
\v'-1v+.25m'\ | |
\D'l (u;\\n[.l]-\\n[.i]) 0'\ | |
\D'l 0 |\\n[par*box-top]u'\ | |
\D'l -(u;\\n[.l]-\\n[.i]) 0'\ | |
\D'l 0 -|\\n[par*box-top]u' | |
.\} | |
.el \{\ | |
. | |
.\" first draw a solid polygon(\D'P...'), after that the borders (\D'p...') | |
\v'-1v+.25m'\M[\\*[par*box-color]]\D'P\ | |
(u;\\n[.l]-\\n[.i]) 0 \ | |
0 |\\n[par*box-top]u \ | |
-(u;\\n[.l]-\\n[.i]) 0 \ | |
0 -|\\n[par*box-top]u'\M[]\ | |
\m[\\*[par*box-fcolor]]\ | |
\D't \\n[par*box-fthickness]'\h'-\\n[par*box-fthickness]u'\D'p\ | |
(u;\\n[.l]-\\n[.i]) 0 \ | |
0 |\\n[par*box-top]u \ | |
-(u;\\n[.l]-\\n[.i]) 0 \ | |
0 -|\\n[par*box-top]u'\m[]\D't 0' | |
.\} | |
. | |
. br | |
. sp -1 | |
. in \\n[par*box-in]u | |
. ll \\n[par*box-ll]u | |
. vpt \\n[par*box-vpt] | |
. ad \\n[par*box-ad] | |
.\} | |
.el \!.par*box-draw \\$1 \\$2 | |
.. | |
.\"}}} /box | |
\" Markdown esque syntax | |
.de # | |
.SH 1 | |
.UL "\\$*" | |
.LP | |
.. | |
.de ## | |
.SH 2 | |
\\$* | |
.LP | |
.. | |
.de ### | |
.SH 3 | |
\\$* | |
.LP | |
.. | |
.de #### | |
.SH 4 | |
\\$* | |
.LP | |
.. | |
.de - | |
.IP \(bu 2 | |
\\$* | |
.. | |
.de -- | |
.RS | |
.IP \(bu 2 | |
\\$* | |
.RE | |
.. | |
.de Q | |
.KS | |
\m[blue]Question:\m[] \\$* | |
.. | |
.de A | |
\m[green]Answer:\m[] \\$* | |
.KE | |
.. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment