#!/bin/bash
cd "`dirname "$1"`"  # Go to the right directory
# Pdflatex must be launched twice to get right bibliography and right page numbering
echo "-- First Latex run" > /tmp/pdflatexer_$UID.log
pdflatex "$1"  >> /tmp/pdflatexer_$UID.log
echo "-- First Latex run done" >> /tmp/pdflatexer_$UID.log
echo "-- BIBTEX Log" >> /tmp/pdflatexer_$UID.log
bibtex `basename "$1" .tex`.aux >> /tmp/pdflatexer_$UID.log
echo "-- BIBTEX Done" >> /tmp/pdflatexer_$UID.log
pdflatex "$1" >> /tmp/pdflatexer_$UID.log
# Shows the log (and it allows us to know when it is done)
zenity --text-info --filename=/tmp/pdflatexer_$UID.log 

