Hi all,

The following is a script to repeatedly compile a LyX document that's
under construction or debugging:

==============================================================
#!/bin/sh

mainname=ch20

flagg=a

while [ "$flagg" != "q" ]; do
        rm $mainname.tex
        rm $mainname.aux
        rm $mainname.pdf
        rm $mainname.log
        rm $mainname.dvi
        lyx --export xetex $mainname.lyx
        xelatex $mainname.tex
        mupdf $mainname.pdf
        echo
        echo -n "Hit q then Enter to quit, "
        echo -n "any else to continue=\>"
        read flagg
done
==============================================================

Obviously, the preceding was made to repeatedly compile a document
called ch20.lyx, but this can be  changed, or it can be changed to $1
so that you can put the document name minus extension on the
shellscript command line.

Notice that this script uses --export xetex and xelatex. This is so you
can compile documents that use non-TeX fonts. There's also a way to do
it with LuaTeX, but I don't know it.

This script uses mupdf to view the finished PDF. Since discovering
mupdf, I've configured LyX to use it as LyX's exclusive PDF reader.
It's lightning fast, and even though it doesn't automatically update
when the file it's reading changes, after doing Ctrl+Shift+R in LyX and
waiting for that to complete, you can press the r key in mupdf for an
instant update. Or if you really want automatic updates, write a little
script to loop inotifywait and rerun mupdf every time the PDF changes.


SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb

Reply via email to