tufte layout files:
[lyx.git] / lib / scripts / lyxpreview-platex2bitmap.py
blob103de29f55e273bb7641b70a2f3b9154336d52a3
1 #! /usr/bin/env python
3 # This script takes a pLaTeX file and generates a collection of
4 # png or ppm image files, one per previewed snippet.
5 # Example usage:
6 # lyxpreview-platex2bitmap.py ppm 0lyxpreview.tex 128 000000 faf0e6
8 # This script takes five arguments:
9 # FORMAT: The desired output format. 'ppm'.
10 # TEXFILE: the name of the .tex file to be converted.
11 # DPI: a scale factor, used to ascertain the resolution of the
12 # generated image which is then passed to gs.
13 # FG_COLOR: the foreground color as a hexadecimal string, eg '000000'.
14 # BG_COLOR: the background color as a hexadecimal string, eg 'faf0e6'.
16 import sys
17 from legacy_lyxpreview2ppm import legacy_conversion
19 def usage(prog_name):
20 return "Usage: %s <format> <latex file> <dpi> <fg color> <bg color>\n"\
21 "\twhere the colors are hexadecimal strings, eg 'faf0e6'"\
22 % prog_name
24 def main(argv):
25 # Parse and manipulate the command line arguments.
26 if len(argv) != 6:
27 error(usage(argv[0]))
28 # The arguments of legacy_conversion are the same as
29 # those used in LyX 1.3.x, except for the last argument.
30 vec = [ argv[0], argv[2], argv[3], argv[1], argv[4], argv[5], "platex"]
31 return legacy_conversion(vec)
33 if __name__ == "__main__":
34 main(sys.argv)