From 773cd45a8efca0df49233620df1cc932b40fd1d5 Mon Sep 17 00:00:00 2001 From: kaa Date: Sun, 21 Jul 2024 04:01:53 -0700 Subject: Paragraph macros. Shell script. --- sh/off | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 sh/off (limited to 'sh') 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 + -- cgit v1.2.3