Skip to content

Instantly share code, notes, and snippets.

@sijanec
Created October 19, 2020 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sijanec/0f5cbc2d894d74f48df80e35838ac967 to your computer and use it in GitHub Desktop.
Save sijanec/0f5cbc2d894d74f48df80e35838ac967 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this is what my vimrc does for tex documents with do-vimlatex-onwrite on write.
SECONDS=0 # bash time counter
pdflatex -synctex=1 -interaction=nonstopmode --shell-escape $1.tex # >> %:p:h/pdflatex.log 2>> %:p:h/pdflatex.log &
podofouncompress $1.pdf $1-uncompressed.pdf
sed -e "s/aaasecgeninsaaa/$SECONDS/g" <$1-uncompressed.pdf >$1-modified.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1-recompressed.pdf $1-modified.pdf
mv $1-recompressed.pdf $1.pdf
rm $1-uncompressed.pdf $1-modified.pdf
wid=`xdotool search --name "Mozilla Firefox" | head -1`
wid_current=`xdotool getactivewindow`
xdotool windowactivate $wid
xdotool key F5
xdotool windowactivate $wid_current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment