#!/bin/sh
#
# Everything after a `#' is ignored
#
# remove the string `> /dev/null' if you want more log-output
# remove the line containing `batchmode' if you want even more 
#  log-information while running LaTeX
#
#----------------- create a `ltxdoc.cfg': --------------------------

# Put here a list of options to pass to the class:
OPT=a4paper

echo "\PassOptionsToClass{$OPT}{article}"                > ltxdoc.cfg
echo "\batchmode"                                        >> ltxdoc.cfg

# The next lines produce full indexes and change logs
# you may not want those. 
#echo "\AtBeginDocument{\RecordChanges}"                 >> ltxdoc.cfg
#echo "\AtEndDocument{\PrintChanges}"                    >> ltxdoc.cfg
echo "\AtBeginDocument{\CodelineIndex\EnableCrossrefs}"  >> ltxdoc.cfg
echo "\AtEndDocument{\PrintIndex}"                       >> ltxdoc.cfg
echo "\AtEndDocument{\addcontentsline{toc}{section}{Index}}" >> ltxdoc.cfg

# If you do not want any code listings, just documentation, then instead
# of the lines above, uncomment the following:
#echo "\AtBeginDocument{\OnlyDescription}"               >> ltxdoc.cfg

#---------- latex the documentation using `ltxdoc.cfg': --------------

ThisDoc=youngtab.dtx
Base=youngtab

echo "1st latex $ThisDoc"
if (latex $ThisDoc > /dev/null) 
then
  echo "2nd latex $ThisDoc"
  latex $ThisDoc > /dev/null

  echo "makeindex -s gind.ist $Base.idx"
  makeindex -s gind.ist $Base.idx
  echo "3rd latex $ThisDoc"
  latex $ThisDoc > /dev/null
else
  echo "!!! LaTeX ERROR: $ThisDoc. (See $Base.log.)"
fi
