#/usr/bin/ksh
#
# Script to difference ROPP81 and ROPP90 ROPP PP UGs
#
# After using this script, users will need to:
# 1) Manually fix the monkey business assoc with
#   L373 of pp_background.tex:
#\begin{eqnarray}
#\eta(p,t) = \vv_L \cdot \vu_L - \vv_G \cdot \vu_G = p\dot\theta + }
#    (The \end{eqnarray} gets placed there for some reason.)
# 
# 2) Use the old names of the routines at the bottom of romsaf_ropp_ug_pp.tex
#\include{pp_phasetobangle}
#\include{pp_routines}
#
# 3) cd $dir81
#    for file in ../common/appendix_use.tex figs/pp_invert_tool_overview.eps pp_background.tex pp_module_files.tex pp_phasetobangle.tex pp_routines.tex romsaf_ropp_ug_pp.tex table_config.tex table_config_ropp4.tex ; do
#      svn revert $file
#    done
#    after you've finished, to restore the pristine $dir81 ROPP PP UG.
#
# Apart from that, latexdiff does remarkably well with such a complicated 
# mess of latex files and figures.
#
# IDC, 26/04/2016

cd $ROPP_DOC  # trunk


# One off tex file

dir90=ropp_ug_v90/common

dir81=ropp_ug_v81/common

file=appendix_use.tex

echo "latexdiff $dir81/$file $dir90/$file > $dir81/temp.tex"
      latexdiff $dir81/$file $dir90/$file > $dir81/temp.tex

echo "mv $dir81/temp.tex $dir81/$file"
      mv $dir81/temp.tex $dir81/$file


dir90=ropp_ug_v90/ropp_ug_pp

dir81=ropp_ug_v81/ropp_ug_pp


# Most tex files

for file in pp_background.tex pp_module_files.tex romsaf_ropp_ug_pp.tex table_config.tex table_config_ropp4.tex ug_pp_intro.tex ; do

echo "latexdiff $dir81/$file $dir90/$file > $dir81/temp.tex"
      latexdiff $dir81/$file $dir90/$file > $dir81/temp.tex

echo "mv $dir81/temp.tex $dir81/$file"
      mv $dir81/temp.tex $dir81/$file

done


# Changed figure

file=figs/pp_invert_tool_overview.eps

echo "cp $dir90/$file $dir81/$file"
      cp $dir90/$file $dir81/$file


# Renamed files (1)

file90=pp_phase2bangle.tex
file81=pp_phasetobangle.tex

echo "latexdiff $dir81/$file81 $dir90/$file90 > $dir81/temp.tex"
      latexdiff $dir81/$file81 $dir90/$file90 > $dir81/temp.tex

echo "mv $dir81/temp.tex $dir81/$file81"
      mv $dir81/temp.tex $dir81/$file81


# Renamed files (2)

file90=pp_bangle2refrac.tex
file81=pp_routines.tex

echo "latexdiff $dir81/$file81 $dir90/$file90 > $dir81/temp.tex"
      latexdiff $dir81/$file81 $dir90/$file90 > $dir81/temp.tex

echo "mv $dir81/temp.tex $dir81/$file81"
      mv $dir81/temp.tex $dir81/$file81

