Skip to content
Michael Butscher edited this page Jan 23, 2021 · 1 revision

Groff plugin

Description

This plugin enables you to use Groff. Groff is a document typesetter

Dependencies

  • Groff
  • !ImageMagick (used for converting the file generated by groff to a png)

Compatibility

Works on XP with 1.9 and probably 2.0

Might not work on Windows Vista. The grops postprocessor (part of Groff) is not working for me on Vista even with UAC disabled. (NOTE: The cygwin version of grops works fine on Vista.) The dvi postprocessor does work on Windows Vista but will only create greyscale images.

Install

Save the attached [/attachment/wiki/Groff/GroffClBridge.py GroffClBridge.py] to your Wikidpad/user_extensions file.

Or when using Windows Vista try [/attachment/wiki/Groff/GroffClBridge.py GroffClBridgeDvi.py]

Example

Image(EquilateralTriangle.png)

[:groff:///
.EQ I
delim $$
define / 'over'
h = a sin 60 \[de]
= 1 / 2 sqrt 3 ~ a
.EN
.sp
.EQ
r = 1 / 2 a~roman cot~left ( pi / 3 right )
= 1 / 2 a~tan~left ( pi / 6 right )
= 1 / 6 sqrt 3 ~ a
= h / 3
.EN
.sp
.EQ
R = 1 / 2 a~roman csc~left ( pi / 3 right )
= 1 / 2 a~roman sec~left ( pi / 6 right )
= 1 / 3 sqrt 3 ~ a
.EN
.PS
linethick = .3
# http://mathworld.wolfram.com/EquilateralTriangle.html
define equilateral_triangle_calculation{
   len = $1
   dx = len/2
   # height = (Half the length of one side) times (the square root of 3).
   h = (sqrt(3)*len)/2
   # center of inscribing circle from bottom of triangle (h/3)
   c = h/3
   Triangle: [
       linethick=1
       # bottom triangle side
       Bottomside: line len; "" "" "" "$ 1 over 2 a $" at .5 <last line .start, last line .center> ljust;
       {"60\[de]" "" at .8 <last line .center, last line .end> rjust}
       # right triangle side
       Rightside: line up h left dx from Bottomside.end;
       # left triangle side
       Leftside: line down h left dx;
       # left line label
       sprintf("$ a = $ %g ", len) at last line .center rjust
       linethick=.3
       line from Rightside .center to Bottomside .start;
       {"$ R $" "" at .5 <last line .end, last line .center> rjust;}
       {"" "$ r $" at .5 <last line .start, last line .center> ljust;}
   ]
   # circumscribing (outer) circle
   circle dashed rad len * (sqrt(3)/3) with .center at last [] .c - (0,c/2);
   # inscribing (inner) circle
   circle dashed rad len * (sqrt(3)/6) with .center at last circle .c;
   linethick=1.5
   line up c from last circle .s; {" $ r $" at last line .center ljust;}
   line to Triangle.sw
   line right len/2;
   #line down 2*c from last [].n; {"$ h $" at 1/3 <last line .end, last line .center>}; {line to last [].s};
   #{line c down right}; {"$ r $" at last line .center};{line to last [].sw};
   #sprintf("$ 1/6 * sqrt(3) * a $") at 2nd last line .end rjust
}
equilateral_triangle_calculation(3);
.PE
///;'args=';'iargs=-trim -density 120']
Clone this wiki locally