This is a Bash script for converting Japanese TeX files to PDF with (u)pLaTeX using mylatexformat.
Its function and interface are similar to ptex2pdf
, but this script makes use of mylatexformat
for compilation.
$ ptex2pdf-fmt.sh [options] basename[.tex]
options:
-v, -version version
-h, -help help
-f (re)generate format file even if it already exists
-i ignore format file and compile normally (disables -f)
-u use upLaTeX instead of pLaTeX
-s stop at dvi
-ot '<opts>' extra options for (u)pLaTeX
-recorder add "-recorder" option to (u)pLaTeX
-od '<opts>' extra options for dvipdfmx
-output-directory '<dir>' directory for created files
$ ptex2pdf-fmt.sh sample
This invokes the following commands:
platex -ini -jobname=sample &platex mylatexformat.ltx sample
platex &sample sample
dvipdfmx sample
Step 1 generates sample.fmt
, which works as a cache of preamble of sample.tex
. If there already exists sample.fmt
in current directory, Step 1 is omitted.
Step 2 intends to compile sample.tex
using sample.fmt
. Since expansion of preamble is already finished, Step 2 takes a shorter time than normal compilation.
If you change the contents of preamble, you must regenerate .fmt
file for the change to take effect.
When you use -i
option, this script does not generate or load .fmt
file. If you execute ptex2pdf-fmt.sh -i sample
, this invokes the following commands:
platex "\let\endofdump\relax\input{sample}"
dvipdfmx sample
Due to \let\endofdump\relax
, \endofdump
in sample.tex
does not cause the Undefined control sequence
error. The control sequence \endofdump
, defined in mylatexformat.ltx
, is a macro to stop caching.
Other options, like -ot
, -od
, have the same functions as ptex2pdf
.
For details, see my blog post (Japanese).