[Swift-commit] r3345 - text/parco10submission

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Jun 15 09:23:30 CDT 2010


Author: wozniak
Date: 2010-06-15 09:23:30 -0500 (Tue, 15 Jun 2010)
New Revision: 3345

Added:
   text/parco10submission/lx.zsh
Log:
Add lx.zsh


Added: text/parco10submission/lx.zsh
===================================================================
--- text/parco10submission/lx.zsh	                        (rev 0)
+++ text/parco10submission/lx.zsh	2010-06-15 14:23:30 UTC (rev 3345)
@@ -0,0 +1,149 @@
+#!/bin/zsh
+
+# Guide:
+# Use +f to force a recompile.
+# Use +p & +d to create PDF & PS files.
+# Modify DOC to change the relevant tex file.
+# Modify TMP & BIB to use different temporary storage.
+
+DEFAULTDOC="paper"
+COMPILER="pdflatex"
+
+NEEDBIB="yes"
+MAKE_PS="no"
+MAKE_PDF="no"
+FORCE="no"
+
+TMP=.latex.out
+BIB=.bibtex.out
+
+for arg in ${*}
+  do
+  case ${arg} in
+      ("+f") FORCE="yes"    ;;
+      ("+p") MAKE_PS="yes"  ;;
+      ("+d") MAKE_PDF="yes" ;;
+      ("-b") NEEDBIB="no"   ;;
+      ("+b") NEEDBIB="yes"  ;;
+      (*)    DOC="${arg}"   ;;
+  esac
+done
+
+[[ ${DOC} == "" ]] && DOC=${DEFAULTDOC}
+[[ ${MAKE_PDF} == "yes" ]] && MAKE_PS="yes"
+
+clean()
+{
+    local t
+    t=( core* *.aux *.bbl *.blg *.dvi *.latex* *.log *.pdf *.ps )
+    t=( ${t} *.toc *.lot *.lof .*.out )
+    if [[ ${#t} > 0 ]]
+        then
+	rm -fv ${t}
+    else
+	print "Nothing to clean."
+    fi
+    return 0
+}
+
+scan()
+{
+    [[ $1 == "" ]] && return
+    typeset -g -a $1
+    local i=1
+    while read T
+      do
+      eval "${1}[${i}]='${T}'"
+      (( i++ ))
+    done
+}
+
+biblio()
+{
+  if [[ -f ${DOC}.bbl &&
+           ${DOC}.bbl -nt $( readlink Wozniak.bib ) ]]
+   then
+    rm ${DOC}.bbl
+  fi
+  if { bibtex ${DOC} > ${BIB} }
+   then
+    printf "."
+    ${COMPILER} ${DOC} > /dev/null
+    printf "."
+    ${COMPILER} ${DOC} > ${TMP}
+    printf "."
+    WARNS=( $( grep "Warning--" ${BIB} ) )
+    if (( ${#WARNS} > 0 ))
+      then
+      printf "\n"
+      print "Bibtex:"
+      print ${WARNS}
+    fi
+  else
+    printf "\n"
+    cat ${BIB}
+  fi
+}
+
+printable()
+{
+  if [[  ! -f ${DOC}.ps  ||
+	 ${DOC}.dvi -nt ${DOC}.ps  ]]
+   then
+      if [[ ${MAKE_PS} == "yes" ]]
+      then
+	  dvips  -q -o ${DOC}.ps -t Letter ${DOC}.dvi
+	  printf "!"
+      fi
+  fi
+
+  if [[ ! -f ${DOC}.pdf ||
+        ${DOC}.ps -nt ${DOC}.pdf  ]]
+  then
+      if [[ ${MAKE_PDF} == "yes" ]]
+      then
+	  ps2pdf ${DOC}.ps ${DOC}.pdf
+	  printf "!"
+      fi
+  fi
+}
+
+[[ ${DOC} == "clean" ]] && clean && exit
+
+grep -h includegraphics *.tex | scan A
+EPSS=()
+for line in ${A}
+do
+    EPS=( $( print ${${line/'{'/ }/'}'/ } ) )
+    EPS=${EPS[2]}.eps
+    EPSS=( ${EPSS} ${EPS} )
+done
+for EPS in ${EPSS}
+  do
+  [[ ${EPS} -nt ${DOC}.dvi ]] && FORCE="yes"
+done
+
+if [[ ! -f ${DOC}.dvi                ||
+        -f error                     ||
+           ${DOC}.tex -nt ${DOC}.dvi ||
+	   lx.zsh     -nt ${DOC}.dvi ||
+           dht.bib    -nt ${DOC}.dvi ||
+	   $( readlink Wozniak.bib ) -nt ${DOC}.dvi ||
+	   ${FORCE} == "yes" ]]
+ then
+  if { ${COMPILER} --interaction nonstopmode ${DOC} > ${TMP} }
+   then
+    printf "OK"
+    rm -f error
+    [[ ${NEEDBIB} == "yes" ]] && biblio
+  else
+    printf "Error! \n"
+    egrep '^l.|^!|argument' ${TMP}
+    touch error
+  fi
+fi
+[[ ${MAKE_PS} == "yes" ]] && printable
+printf "\n"
+grep "LaTeX Warning:" ${TMP}
+
+return 0


Property changes on: text/parco10submission/lx.zsh
___________________________________________________________________
Name: svn:executable
   + *




More information about the Swift-commit mailing list