Git Product home page Git Product logo

tex-watch's Introduction

Automatic continuous recompilation for LaTeX files on change. The PDF viewer is launched or refreshed after compilation. The whole process is fast enough to simulate WYSIWIG.

Features:
---------
- Supports multi-file LaTeX project in multiple directories.
- Supports pdflatex, xelatex, lualatex on TexLive.
- Supports bibtex, bibtex8.
- Supports precompiled preamble with make format.
- Supports launching viewers: mupdf, Okular, evince, xpdf, skim, ghostview. mupdf is sent a refresh signal when a new PDF is available. Other viewers auto-reload.
- Supports using another directory for output and auxiliary files to reduce clutter in main directory.

Requirements:
------------
Linux (file change detection is specific to Linux) with inotify-tools installed, Bash, 
TexLive (texlive-mylatexformat for precompiled preamble)

How to use:
-----------
Launch tex-watch as described below. It will compile the LaTex file and if successful, launch your chosen viewer. Use an editor that saves the file frequently. (See below to set up Vim for this.) Whenever any of the project files is changed, tex-watch will recompile and refresh the viewer on success. mupdf is recommended for speed.

Put this in ~/.vim/ftplugin/tex.vim to save your LaTeX files whenever they are changed:
autocmd TextChanged,TextChangedI <buffer> update
If you prefer to wait till you have finished typing, add this instead:
set autosave=2
Vim will now wait for 2 seconds after the last file change before writing the file (0 disables autosave).
Caution: Please have the undo feature set up properly before using this or you may lose important edits!

Follow this how-to to use a precompiled preamble:
http://www.howtotex.com/tips-tricks/faster-latex-part-iv-use-a-precompiled-preamble/
This is especially useful if you use many packages.

Usage: 
------
tex-watch [-h] [-l LATEX] [-v VIEWER] [-b BIBTEX] [-o OUTPUT_DIR] MAINFILE.tex [FILES] [DIRECTORIES] ...
  Recompile MAINFILE.tex whenever it or FILES or DIRECTOIRES change and update
  (or launch) mupdf to show the output if compilation is successful.

  -h        Display this help and exit
  -v        Alternate viewer [mupdf]
  -l        Alternate latex compiler [pdflatex]
  -b        Alternate bibtex program [bibtex8] Use false to disable bibtex
  -o        Output directory (if not the current directory)
  -p        Use precompiled preamble
  DIRECTORIES   These are added to TEXINPUTS

  Requirements: inotify-tools and optionally mupdf (fast pdf viewer),
  texlive-mylatexformat (precompiled preamble).


Inspiration:
------------
Similar functionality in IDEs:
gummi, kile, etc.

Automatic compilation: 
latexmk: Perl based; too slow for continuous compilation.

Preview:
Emacs + AucTex + preview-latex  (https://www.gnu.org/software/auctex/preview-latex.html)
vim-live-latex-preview (https://bbs.archlinux.org/viewtopic.php?id=107164)

TODO:
-----
Test with biber
Test with plain LaTeX (dvi output) and ConText.
Automatically get list of dependencies from main LaTeX file.
Port to Windows, Mac OSX.

Bugs:
----
Will not detect changes to preamble (eg: new package) if PRECOMPILE is used. Delete the .fmt file to get it to notice the changes.

tex-watch's People

Contributors

ssameer avatar

Stargazers

Jáchym Kohout avatar Heber MQ avatar Vinney Cavallo avatar EmD avatar Aditya Zutshi avatar

Watchers

James Cloos avatar  avatar

tex-watch's Issues

expected behavior or bug: kill - no such process

Hello! I just found your great little script!

In testing it out (and learning LaTeX...) I tried adding something inane, like:

\beginasedfd

to the source file and get the following error in the tex-watch command window:

/home/my-user/bin/tex-watch: line 107: kill: (20952) - No such process

Seems like it's trying to kill a pdf viewer window that it can't find (i'm using the default viewer you suggest).
Probably worth noting: I have \nonstopmode at the top of my sourcefile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.