[OS X TeX] Nobody knows

Will Robertson will at mecheng.adelaide.edu.au
Tue Mar 23 10:13:11 CET 2004


Hi

I just noticed Maarten's post on comp.text.tex involving a bash shell 
script to run LaTeX as many times as necessary to get things right with 
figure numbers et al.

Considering TeXShop is all about making Mac the most simple and pleasant 
way of writing LaTeX, why hasn't such a script been implemented?

I suppose alternatively, I could ask "Why doesn't everyone use iTeXMac?" 
or "Why doesn't everyone write ConTeXt?".

To conclude my post of questions no-one will answer (don't use this 
sentence as an excuse, though)---has anything been done by anyone on 
using folder packages to represent TeX documents with a single file?

Thanks,

Will

PS Maarten's aformentioned post is appended:
-----------
\begin{maarten}

 > > I don't see this (never have seen it). Are you sure it is not
 > > something else (although updating never hurts)?
 >
 > The version of LaTeX I am using on Solaris is dated 1999. When you
 > reference a Table, it leaves the Table number blank. I end up just
 > manually inserting the number, but that means I could have the wrong
 > number if I insert a table and forget to renumber all the following
 > table references. It's just one of those annoying little potential
 > "gotchas" that I hate to have to remember.

Given the second part of your reply, you seem to be aware that the
correct table number (or figure number or any other reference for that
matter) only appears after the first run. Try to post a minimal
example that doesn't work for you and report back.

 > By the way, while I'm at it, let me also mention what I consider a
 > minor design flaw in LaTeX. I think the two-pass execution that is
 > required to get references correct is a bad idea. Why? I wrote a
 > simple shell script to go directly from LaTeX to pdf, but the two-pass
 > business made it more difficult than it should be to make the script
 > deal intelligently with failure of the first run.

Just grep the log file for errors, this is what i cooked up in bash:

# the masterdocname is set as an argument,
# and the docclass is filtered with perl
# basic run, under full draft mode (speed!)
pdflatex -file-line-error-style -interaction=nonstopmode \
     "\PassOptionsToClass{draft}{$docclass}" \
     "\PassOptionsToPackage{draft}{graphicx}" \
     "\PassOptionsToPackage{draft}{graphics}" \
     "\PassOptionsToPackage{draft}{hyperref}" \
     "\input{$masterdocname}" > /dev/null

# filter for errors, I use bbedit, can be replaced by vi or so.
errors=`perl -e 'while(<>){ if ( /^(\\S+?):(\\d+):\\s(?!pdfTeX)/s ) {
     print "bbedit +$2 $1\\n"; } }' ${masterdocname%%.tex}.log`
if [ "$errors" == "" ] ; then
     # run bibtex (needed after the clean sheet)
     bibtex ${masterdocname%%.tex}

# after the bibliography generation at least two runs are needed
     pdflatex -file-line-error-style -interaction=nonstopmode \
         "\PassOptionsToClass{draft}{$docclass}" \
         "\PassOptionsToPackage{draft}{graphicx}" \
         "\PassOptionsToPackage{draft}{graphics}" \
         "\input{$masterdocname}" > /dev/null

# a run without draft, and noninteractive
     crossrefs=`grep 'Rerun' ${masterdocname%%.tex}.log`
     if [ "$crossrefs" != "" ] ; then
         pdflatex -file-line-error-style -interaction=nonstopmode \
             $masterdocname
     fi

     crossrefs=`grep 'Rerun' ${masterdocname%%.tex}.log`
     if [ "$crossrefs" != "" ] ; then
         pdflatex -file-line-error-style -interaction=nonstopmode \
             $masterdocname
     fi
else
     echo "an error occurred"
     echo "resolve this error before continuing..."
     eval $errors
fi
# end of partial script

(remember that this fragment needs more details (setting some
variables, getting the master document if you happen to run it on a
part, ...)

HTMH

Maarten
-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the macostex-archives mailing list