texliveonfly.py [options] file.tex
or, for python 3,
python3 texliveonfly.py [options] file.tex
instead of "lualatex" or "pdflatex". The current options are:
Options: --version show program version number and exit -h, --help print this help text and exit -c COMPILER, --compiler=COMPILER your LaTeX compiler; defaults to pdflatex -a ARGS, --arguments=ARGS arguments to pass to compiler; default is: "-synctex=1 -interaction=nonstopmode" --texlive_bin=LOCATION Custom location for the TeX Live bin folder --terminal_only Forces us to assume we can run only in this terminal. Permission escalators will appear here rather than graphically or in a new terminal. -s OPTION, --speech_when=OPTION Toggles speech-synthesized notifications (where supported). OPTION can be "always", "never", "installing", "failed", or some combination. -f, --fail_silently If tlmgr cannot be found, compile document anyway.
Setting this command within your favourite editor will allow you to download packages on the fly. The script defaults to PdfLaTeX with arguments '-synctex=1 -interaction=nonstopmode'.
As of the Sep 27 version, the script should be compatible with either python 2 or 3. It depends strongly on the TeX Live Package Manager (tlmgr), so please make sure you are using at least TeX Live 2010. It should resolve all missing included packages and a fair number of missing fonts. It was written on Ubuntu 10.04 and should work on all Linux systems; the Sep 26th version should also work on OS X (but hasn't been tested as of this posting).
Any comments, suggestions, or bug reports are appreciated, and I hope you enjoy.
- Script: http://pastebin.com/cxpUkrPc
- Download: http://pastebin.com/raw.php?i=cxpUkrPc (right click and save as texliveonfly.py)
Updates:
- September 19, 2011: Added options and changed name (lualatexonfly was no longer an accurate description).
- September 24, 2011: Core functionality remains unchanged, but a lot of minor improvements!
- Now displays output from the compiler, as well as allowing the user to interact with the compiler (i.e. interaction=nonstopmode is no longer your only option).
- Now inherits the compiler's exit code (so that programs depending on it work more consistently)
- Slightly improved messages for user.
- Script now fails more gracefully under certain circumstances.
- SHOULD now work on OS X (need someone to actually test!)
- September 25, 2011: Minor code restructuring and bugfixes from the Sep 24th version, but most importantly:
- Changed the option --engine/-e to --compiler/-c. (It's more intuitive, and we'll make sure not to use the compiler module!)
- September 26, 2011: Fixed OS X package downloading bug. Still needs testing, however.
- September 27, 2011: Script should now be compatible with python 2 (my best guess is: python 2.4+)! The #!/usr/bin/env line now calls "python" rather than "python3".
- October 1, 2011: Version 1.00 released! Please note:
- Default compiler is now pdflatex, to cater to the mainstream user. However, this and the default arguments can now easily be changed at the top of the script.
- Privilege escalation is now graphical (except for failsafes) and only happens if we need it.
- New options, --texlive_bin=LOCATION and --terminal_only (e.g. when you only have a terminal interface). The former allows the script to work on local installs, even when you don't have access to sudo.
- OS X support should be solidified (though field testing still requested).
- Code cleanup.
- October 3, 2011: Version 1.10
- kdesudo added to list of permission escalators
- Can now provide verbal updates via platform's speech synthesizer. This can be turned toggled via --speech_when=always/installing/failed/some combination.
- October 4th, 2011: Version 1.2. Script was largely changed from an object-oriented to functional style, which here makes a bit more sense. Minor fixes.