summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaa <kaa@disroot.org>2024-07-21 04:01:53 -0700
committerkaa <kaa@disroot.org>2024-07-21 04:01:53 -0700
commit773cd45a8efca0df49233620df1cc932b40fd1d5 (patch)
tree97126e27a71d94a2d318c909b12eb2ae788cc218
Paragraph macros. Shell script.
-rwxr-xr-xsh/off54
-rw-r--r--tmac/tmac.pg30
2 files changed, 84 insertions, 0 deletions
diff --git a/sh/off b/sh/off
new file mode 100755
index 0000000..aa92e98
--- /dev/null
+++ b/sh/off
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+BASE="/usr/local/neatroff"
+ROFF="$BASE/neatroff/roff"
+POST="$BASE/neatpost/post"
+PPDF="$BASE/neatpost/pdf"
+EQN="$BASE/neateqn/eqn"
+REFR="$BASE/neatrefer/refer"
+PIC="$BASE/troff/pic/pic"
+TBL="$BASE/troff/tbl/tbl"
+SOIN="$BASE/soin/soin"
+#GRAP="$BASE/troff/all/grap/grap"
+GRAP="9 grap"
+ROFFOPTS="-F$BASE -M$BASE/tmac"
+ROFFMACS="-mpost -mpg"
+POSTOPTS="-F$BASE -w80 -n"
+POSTOPTS="$POSTOPTS -pletter"
+REFROPTS="-m -e -o ct -p ref.bib"
+export GS_FONTPATH=$BASE/fonts
+
+fmt()
+{
+ in=$1
+ shift
+ POSTOPTS="$POSTOPTS $*"
+
+# Process through GhostScript.
+ < $in $TBL | $PIC | $ROFF $ROFFOPTS $ROFFMACS | tee ${in%%.*}.int | $POST $POSTOPTS | tee ${in%%.*}.ps | ps2pdf - ${in%.*}.pdf
+
+# Direct to PDF method. Faster when disk speed is unlimited. If GS_FONTPATH is unset, then the only option. Fonts are embedded very inefficiently.
+# < $in $SOIN | $TBL | $ROFF $ROFFOPTS $ROFFMACS | $PPDF $POSTOPTS > ${in%.*}.pdf
+}
+
+hup()
+{
+ if ! [ $1 ]
+ then
+ return
+ else
+ kill -HUP $1
+ fi
+}
+
+if ! [ -f $1 ] || [ -z $1 ]
+then
+ echo Provide an input file name.
+ exit
+fi
+
+fmt $*
+mupid=$(ps ax | grep "mupdf.*${1%tr}pdf" | \
+ grep -v grep)
+hup $mupid
+
diff --git a/tmac/tmac.pg b/tmac/tmac.pg
new file mode 100644
index 0000000..07f4af0
--- /dev/null
+++ b/tmac/tmac.pg
@@ -0,0 +1,30 @@
+.ssh 15
+.ss 12 0
+.pmll 20 9999999
+.ad pb
+.kn 0
+.\"fp - R TributeOT-Roman
+.\"fp - I TributeOT-Italic
+.ps 12
+.vs 20
+.ds page_width 8.5i
+.ds page_height 11i
+.ds top_margin 1i
+.ds side_margin 2i
+.ds bottom_margin \*[side_margin]
+.\"
+.po \*[side_margin]
+.ll \*[page_width]-(\*[side_margin]*2u)
+.de head
+' sp \*[top_margin]
+..
+.wh 0 head
+.de foot
+' bp
+..
+.wh -\*[bottom_margin] foot
+.de pg
+. ti 1m
+..
+.blm pg
+.\"