::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'" } } # Trivial wrappers by DKF proc pdflatex args { # With plenty of experience, 'nonstopmode' or 'batchmode' are most useful eval [list exec -- pdflatex --interaction=nonstopmode] $args } proc viewPdf filename { exec -- $env(comspec) /c $filename &; # att: auto_execok-error with cmd /c } # to be reorganized later # 3 steps to keep tocs and indices etc. accurate - later cond' breaks # better use bgExec to catch the output? set root [lindex $argv 0] puts [pdflatex $root] puts [pdflatex $root] puts [pdflatex $root] viewPdf $root.pdf
tonytraductor: In tickle text [1] I just did:
proc texpdf {} { if {$::filename != " "} { set data [.txt.txt get 1.0 {end -1c}] set fileid [open $::filename w] puts -nonewline $fileid $data close $fileid eval exec pdflatex $::filename } else { set filename [tk_getSaveFile -filetypes $::file_types] set data [.txt.txt get 1.0 {end -1c}] wm title . "Now Tickling: $::filename" set fileid [open $::filename w] puts -nonewline $fileid $data close $fileid eval exec pdflatex $::filename } }Am I over simplifying this? It works. But, I'm kind of new to both tcl and LaTeX, so, maybe I'm missing something (?).
See also PDF, TeX.