*! version 1.0.2 08apr2011 Ben Jann program tex version 9.2 if `"${TeXdoc_docname}"'=="" { di as txt "(texdoc not initialized; nothing to do)" exit // di as error "texdoc not initialized" // exit 499 } mata: texdoc_fput(st_global("TeXdoc_docname")) end version 9.2 mata: mata set matastrict on void texdoc_fput(string scalar fn) { real scalar fh fh = _fopen(fn, "a") if (fh < 0) { stata("sleep 500") fh = fopen(fn, "a") } fput(fh, st_local("0")) fclose(fh) } end