/usr/bin/laps is in epix 1.2.14-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | #! /bin/bash
#
# laps: latex to Postscript/PDF
#
# Options: --help for usage, --version for version and license
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Andrew D. Hwang <For address, do "laps -V">
#
. "/usr/share/epix/epix-lib.sh"
declare -a DVIPS_OPTS
declare -a LAPS_FILE_LIST
declare -i LAPS_FILE_COUNT
PS2PDF="ps2pdf"
LATEX="latex"
LAPS_PDF=
LATEX_INTERACT="batchmode"
LAPS_EXTENSIONS="tex dtx ltx" # or NULL
LAPS_DOT_EXT=".${LAPS_EXTENSIONS// /|.}" # for usage message
LAPS_DEFAULT_EXT="tex"
declare -a TMP_CMD
function laps_help ()
{
cat <<"HELP"
Options:
-h, --help
Show this message and exit
-V, --version, --gpl
Show version and license
-v, --verbose
Scroll output/error messages
-H, --huge
Use hugelatex (if available)
-i, --interactive
Run (La)TeX interactively
-n, --no-config
Ignore $(HOME)/.dvipsrc
--pdf
Post-process ps file with ps2pdf
--pdf(la)tex
Use pdf(la)tex instead of latex.
-ps, --ps, --pslatex
Use pslatex instead of latex.
-P<printer>
dvips printer options, e.g. "-Pamz", may be given on the command
line. They are also read from ~/.dvipsrc if this file exists.
-t, --tex
Use tex instead of latex
HELP
ePiX_bugreport
} # End of laps_help
function laps_parse_options {
# Command-line options start with "-"
while [ "$1" != "${1#-}" ]; do
case "$1" in
-h|--help)
ePiX_usage laps $LAPS_DOT_EXT
laps_help
exit 0
;;
-H|--huge)
if [ $(which hugelatex 2> /dev/null) ]; then
LATEX="hugelatex"
else
ePiX_warn " hugelatex not available, ignoring \"$1\" option"
fi
shift
;;
-i|-int|--interactive)
QUIET=0
LATEX_INTERACT="errorstopmode"
shift
;;
-n|--no-config) # do not use ~/.dvipsrc
export DVIPSRC=/dev/null
shift
;;
-pdf|--pdf)
LATEX="${LATEX##pdf}"
LAPS_PDF="yes"
shift
;;
--pdflatex)
LATEX="pdflatex"
LAPS_PDF=""
shift
;;
--pdftex)
LATEX="pdftex"
LAPS_PDF=""
shift
;;
-ps|--ps|--pslatex)
LATEX="pslatex"
shift
;;
-P)
DVIPS_OPTS=("${DVIPS_OPTS[@]}" "-P$2")
shift 2
;;
-P*)
DVIPS_OPTS=("${DVIPS_OPTS[@]}" "$1")
shift
;;
# Deliberately undocumented; run silently
-q|--quiet)
QUIET=1
LATEX_INTERACT="batchmode"
shift; continue
;;
-t|--tex)
LATEX="tex"
shift
;;
-V|--version|--gpl)
ePiX_version laps
ePiX_license
exit 0
;;
-v|--verbose)
if [ -z "$2" ]; then
echo "Please use -V for version"
exit 0
fi
QUIET=0
if [ "$LATEX_INTERACT" = "batchmode" ] # Not --interactive
then
LATEX_INTERACT="nonstopmode"
fi
shift
;;
-vv)
echo "Discontinued option -vv; please use -v for verbose output"
exit 0
;;
*)
ePiX_warn "Ignoring unknown option \"$1\""
shift
;;
esac
done
LAPS_FILE_LIST=("$@")
} # End of laps_parse_options
function laps_compile_files()
{
if [ -z "$1" ]; then ePiX_die "No input file specified"; fi
# file counts
local processed=0
local success=0
local failure=0
for EPIX_INFILE in "${LAPS_FILE_LIST[@]}"; do
# sets EPIX_INROOT, EPIX_SUFFIX, EPIX_NOTFOUND, touches EPIX_LOGFILE
epix_parse_filename "$EPIX_INFILE" "$LAPS_EXTENSIONS"
let processed=processed+1
if [ "$EPIX_NOTFOUND" = "yes" ]; then
let failure=failure+1
continue
fi
TMP_CMD=($LATEX -interaction=$LATEX_INTERACT "$EPIX_INROOT.$EPIX_SUFFIX")
TEMPFILES=("{TEMPFILES[@]}" "${EPIX_INROOT}.dvi" "${EPIX_INROOT}.log")
# aux file out of date
if [ "$EPIX_INROOT.$EPIX_SUFFIX" -nt "$EPIX_INROOT.aux" ]; then
ePiX_msg "aux file out of date"
ePiX_command "${TMP_CMD[@]}"
fi
ePiX_command "${TMP_CMD[@]}"
if [ "${EPIX_INROOT}.$EPIX_SUFFIX" -nt "$EPIX_INROOT.dvi" ]; then
ePiX_warn "\"${TMP_CMD[*]}\" failed"
let failure=failure+1
continue
fi
if [ "$LATEX" = "latex" -o "$LATEX" = "tex" ]; then
TMP_CMD=(dvips "${DVIPS_OPTS[@]}" -f -o "$EPIX_INROOT.ps" "$EPIX_INROOT.dvi")
ePiX_command "${TMP_CMD[@]}"
if [ "$EPIX_INROOT.dvi" -nt "$EPIX_INROOT.ps" ]; then
ePiX_warn "${TMP_CMD[*]} failed"
let failure=failure+1
continue
fi
fi
if [ "$LAPS_PDF" = "yes" ]; then
TMP_CMD=($PS2PDF "$EPIX_INROOT.ps")
ePiX_command "${TMP_CMD[@]}"
if [ "$EPIX_INROOT.ps" -nt "$EPIX_INROOT.pdf" ]; then
ePiX_warn "${TMP_CMD[*]} failed"
let failure=failure+1
continue
fi
fi
let success=success+1
ePiX_echo -e "\nTranscript written on $EPIX_LOGFILE"
done # for EPIX_INFILE in $LAPS_INFILE_LIST
if [ $processed -gt 1 ]; then
if [ "$QUIET" -eq 0 ];
then
echo "$processed files processed: $success successfully, $failure failed" >&2
fi
fi
}
### main ###
if [ $# -eq 0 ]; then
ePiX_usage laps $LAPS_DOT_EXT
laps_help
exit 0
fi
laps_parse_options "$@"
laps_compile_files "${LAPS_FILE_LIST[@]}"
exit 0
|