Version 0 of calling pdflatex

Updated 2007-07-06 07:36:42 by hoffi
 ::if 0 {
 @tclkitsh "%~dp0\%~n0.bat" %*
 @goto :EOF
 }

 # pl.bat - helper/shell for pdflatex (TexLive)
 # call pdflatex with specific or with newest file (win-doubleclick)
 # 05.07.2007, MHo
 # if no arg specified, it's assumed that the newest .tex file should be processed

 if {![llength $argv]} {
    set res [list ]
    foreach texfile [glob -nocomplain -- *.tex] {
       lappend res [list $texfile [file mtime $texfile]]
    }
    if {[llength $res]} {
       lappend argv [file rootname [lindex [lindex [lsort -integer -index 1 $res] end] 0]]
       puts "using '$argv'"
    }
 }

 # to be reorganized later
 # 3 steps to keep tocs and indices etc. accurate - later cond' breaks
 # better use bgExec to catch the output? What's if pdflatex prompts for input? hm...
 puts [exec -- pdflatex [lindex $argv 0]]
 puts [exec -- pdflatex [lindex $argv 0]]
 puts [exec -- pdflatex [lindex $argv 0]]
 exec -- $env(comspec) /c [lindex $argv 0].pdf &; # att: auto_execok-error with cmd /c