Changing format string behaviour to require comma separators. Adding rendering support for JPEG and PS (as opposed to EPS) formats.

Sun, 04 Mar 2012 11:45:16 +0000

author
Andy Buckley <andy@insectnation.org>
date
Sun, 04 Mar 2012 11:45:16 +0000
changeset 171
741d03a41ba3
parent 170
50af1eaa6dfb
child 172
5c15a8178ef3

Changing format string behaviour to require comma separators. Adding rendering support for JPEG and PS (as opposed to EPS) formats.

ChangeLog file | annotate | diff | comparison | revisions
pyslha.py file | annotate | diff | comparison | revisions
slhaplot file | annotate | diff | comparison | revisions
test file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Sat Mar 03 20:38:59 2012 +0100
     1.2 +++ b/ChangeLog	Sun Mar 04 11:45:16 2012 +0000
     1.3 @@ -1,3 +1,11 @@
     1.4 +2012-03-04  Andy Buckley  <andy.buckley@cern.ch>
     1.5 +
     1.6 +	* Version 1.4.0
     1.7 +
     1.8 +	* Adding rendering support for JPEG and PS (as opposed to EPS) formats.
     1.9 +
    1.10 +	* Changing format string behaviour to require comma separators.
    1.11 +
    1.12  2012-03-03  Andy Buckley  <andy.buckley@cern.ch>
    1.13  
    1.14  	* Version 1.3.3
     2.1 --- a/pyslha.py	Sat Mar 03 20:38:59 2012 +0100
     2.2 +++ b/pyslha.py	Sun Mar 04 11:45:16 2012 +0000
     2.3 @@ -24,7 +24,7 @@
     2.4  """
     2.5  
     2.6  __author__ = "Andy Buckley <andy.buckley@cern.ch"
     2.7 -__version__ = "1.3.3"
     2.8 +__version__ = "1.4.0"
     2.9  
    2.10  
    2.11  def _autotype(var):
     3.1 --- a/slhaplot	Sat Mar 03 20:38:59 2012 +0100
     3.2 +++ b/slhaplot	Sun Mar 04 11:45:16 2012 +0000
     3.3 @@ -97,41 +97,25 @@
     3.4      something more semantically queryable."""
     3.5  
     3.6      def __init__(self, fmtstr):
     3.7 -        self.format_string = fmtstr.lower()
     3.8 -        if "tikz" not in self.format_string:
     3.9 -            self.format_string = "tikz" + self.format_string
    3.10 -        if self.format_string == "tikz":
    3.11 -            self.format_string = "tikztex"
    3.12 -        elif self.format_string == "tikzfrag":
    3.13 -            self.format_string = "tikztexfrag"
    3.14 -        if "frag" in self.format_string and any(f in self.format_string for f in ["pdf", "eps", "png"]):
    3.15 -            logging.error("Oops! You can't currently use LaTeX fragment output together with graphics "
    3.16 -                          "formats, since the graphics can't be built from the incomplete LaTeX "
    3.17 -                          "file. We'll fix this, but for now you will have to run slhaplot twice: "
    3.18 -                          "once for the LaTeX fragment, and another time for the graphical output "
    3.19 -                          "formats. Exiting...")
    3.20 +        self.graphicsformats = ("pdf",  "eps", "ps", "png", "jpg")
    3.21 +        self.formats = fmtstr.lower().split(",")
    3.22 +        # TODO: Remove duplicates
    3.23 +        # TODO: Check for unknown formats
    3.24 +        if "texfrag" in self.formats and len(self.formats) > 1:
    3.25 +            logging.error("Oops! You can't currently use LaTeX fragment output together with either "
    3.26 +                          "full LaTeX or graphics output since the graphics can't be built from the "
    3.27 +                          "incomplete LaTeX file. We'll fix this, but for now you will have to run slhaplot twice: "
    3.28 +                          "once for the LaTeX fragment, and again time for the other formats. Exiting...")
    3.29              sys.exit(1)
    3.30  
    3.31 -    def make_tex(self):
    3.32 -        return ("tex" in self.format_string and not "frag" in self.format_string)
    3.33 -
    3.34 -    def make_texfrag(self):
    3.35 -        return ("texfrag" in self.format_string)
    3.36 -
    3.37 -    def make_pdf(self):
    3.38 -        return ("pdf" in self.format_string)
    3.39 -
    3.40 -    def make_eps(self):
    3.41 -        return ("eps" in self.format_string)
    3.42 -
    3.43 -    def make_png(self):
    3.44 -        return ("png" in self.format_string)
    3.45 -
    3.46      def needs_compilation(self):
    3.47 -        return any(f in self.format_string for f in ["pdf", "eps", "png"])
    3.48 +        return any(f in self.formats for f in self.graphicsformats)
    3.49  
    3.50      def file_extensions(self):
    3.51 -        return [f for f in ["tex", "pdf", "eps", "png"] if f in self.format_string]
    3.52 +        if "texfrag" in self.formats:
    3.53 +            return ["frag.tex"]
    3.54 +        else:
    3.55 +            return self.formats
    3.56  
    3.57  
    3.58  
    3.59 @@ -152,10 +136,10 @@
    3.60                    help="format in which to write output. 'tex' produces LaTeX source using the "
    3.61                    "TikZ graphics package to render the plot, 'texfrag' produces the same but "
    3.62                    "with the LaTeX preamble and document lines commented out to make it directly "
    3.63 -                  "includeable as a code fragment in LaTeX document source, and 'pdf' produces "
    3.64 -                  "a PDF file created by running pdflatex and pdfcrop on the 'tex' output. You "
    3.65 -                  "may also combine multiple formats just by listing them all in the format "
    3.66 -                  "string, e.g. 'png,pdf,tex' (default: %default)",
    3.67 +                  "includeable as a code fragment in LaTeX document source. The supported graphics "
    3.68 +                  "formats are PDF, EPS, PS, PNG, and JPEG via the 'pdf', 'eps', 'ps', 'png' and "
    3.69 +                  "'jpg' values respectively. Multiple formats can be created by listing them "
    3.70 +                  "comma-separated in the format string, e.g. 'png,pdf,tex' (default: %default)",
    3.71                    dest="FORMAT", default="pdf")
    3.72  parser.add_option("--preamble", metavar="FILE",
    3.73                    help="specify a file to be inserted into LaTeX output as a special preamble",
    3.74 @@ -441,168 +425,159 @@
    3.75  
    3.76      out = ""
    3.77  
    3.78 -    ## TIKZ FORMAT
    3.79 -    # TODO: Remove this test?
    3.80 -    if "tikz" in opts.FORMAT.format_string:
    3.81  
    3.82 -        ## Comment out the preamble etc. if only the TikZ fragment is wanted
    3.83 -        c = ""
    3.84 -        if opts.FORMAT.make_texfrag():
    3.85 -            c = "%"
    3.86 +    ## Comment out the preamble etc. if only the TikZ fragment is wanted
    3.87 +    c = ""
    3.88 +    if "texfrag" in opts.FORMAT.formats:
    3.89 +        c = "%"
    3.90  
    3.91 -        ## Write LaTeX header
    3.92 -        out += "%% http://pypi.python.org/pypi/pyslha\n\n"
    3.93 -        out += c + "\\documentclass[11pt]{article}\n"
    3.94 -        out += c + "\\usepackage{amsmath,amssymb}\n"
    3.95 -        out += c + "\\usepackage[margin=0cm,paperwidth=15.2cm,paperheight=9.8cm]{geometry}\n"
    3.96 -        out += c + "\\usepackage{tikz}\n"
    3.97 -        out += c + "\\pagestyle{empty}\n"
    3.98 -        out += c + "\n"
    3.99 -        ## Insert user-specified preamble file
   3.100 -        if opts.PREAMBLE is not None:
   3.101 -            out += c + "%% User-supplied preamble\n"
   3.102 -            try:
   3.103 -                fpre = open(opts.PREAMBLE, "r")
   3.104 -                for line in fpre:
   3.105 -                    out += c + line
   3.106 -            except:
   3.107 -                logging.warning("Could not read preamble file %s -- fallback to using \\input" % opts.PREAMBLE)
   3.108 -                out += c + "\\input{%s}\n" % opts.PREAMBLE.replace(".tex", "")
   3.109 -        else:
   3.110 -            out += c + "%% Default preamble\n"
   3.111 -            if tex2pix in dir() and tex2pix.check_latex_pkg("mathpazo.sty"):
   3.112 -                out += c + "\\usepackage[osf]{mathpazo}\n"
   3.113 -        #
   3.114 -        out += c + "\n"
   3.115 -        out += c + "\\begin{document}\n"
   3.116 -        out += c + "\\thispagestyle{empty}\n\n"
   3.117 +    ## Write LaTeX header
   3.118 +    out += "%% http://pypi.python.org/pypi/pyslha\n\n"
   3.119 +    out += c + "\\documentclass[11pt]{article}\n"
   3.120 +    out += c + "\\usepackage{amsmath,amssymb}\n"
   3.121 +    out += c + "\\usepackage[margin=0cm,paperwidth=15.2cm,paperheight=9.8cm]{geometry}\n"
   3.122 +    out += c + "\\usepackage{tikz}\n"
   3.123 +    out += c + "\\pagestyle{empty}\n"
   3.124 +    out += c + "\n"
   3.125 +    ## Insert user-specified preamble file
   3.126 +    if opts.PREAMBLE is not None:
   3.127 +        out += c + "%% User-supplied preamble\n"
   3.128 +        try:
   3.129 +            fpre = open(opts.PREAMBLE, "r")
   3.130 +            for line in fpre:
   3.131 +                out += c + line
   3.132 +        except:
   3.133 +            logging.warning("Could not read preamble file %s -- fallback to using \\input" % opts.PREAMBLE)
   3.134 +            out += c + "\\input{%s}\n" % opts.PREAMBLE.replace(".tex", "")
   3.135 +    else:
   3.136 +        out += c + "%% Default preamble\n"
   3.137 +        if tex2pix in dir() and tex2pix.check_latex_pkg("mathpazo.sty"):
   3.138 +            out += c + "\\usepackage[osf]{mathpazo}\n"
   3.139 +    #
   3.140 +    out += c + "\n"
   3.141 +    out += c + "\\begin{document}\n"
   3.142 +    out += c + "\\thispagestyle{empty}\n\n"
   3.143  
   3.144 -        ## Get coord space size: horizontal range is fixed by make-plots
   3.145 -        xmin = -3.0
   3.146 -        xmax = 19.0
   3.147 -        if opts.PARTICLES_LABELS_MERGE:
   3.148 -            ## Need more space if labels are to be merged horizontally
   3.149 -            xmin -= 1.0
   3.150 -            xmax += 1.0
   3.151 -        xdiff = xmax - xmin
   3.152 -        XWIDTH = 22.0
   3.153 -        def scalex(x):
   3.154 -            return x * XWIDTH/xdiff
   3.155 +    ## Get coord space size: horizontal range is fixed by make-plots
   3.156 +    xmin = -3.0
   3.157 +    xmax = 19.0
   3.158 +    if opts.PARTICLES_LABELS_MERGE:
   3.159 +        ## Need more space if labels are to be merged horizontally
   3.160 +        xmin -= 1.0
   3.161 +        xmax += 1.0
   3.162 +    xdiff = xmax - xmin
   3.163 +    XWIDTH = 22.0
   3.164 +    def scalex(x):
   3.165 +        return x * XWIDTH/xdiff
   3.166  
   3.167 -        ASPECTRATIO = 0.7 #0.618
   3.168 -        ydiff = ASPECTRATIO * XWIDTH
   3.169 -        ymin = 0.0
   3.170 -        ymax = ymin + ydiff
   3.171 +    ASPECTRATIO = 0.7 #0.618
   3.172 +    ydiff = ASPECTRATIO * XWIDTH
   3.173 +    ymin = 0.0
   3.174 +    ymax = ymin + ydiff
   3.175  
   3.176 -        ## Get range of masses needed (quite application-specific at the moment)
   3.177 -        maxmass = max(pd.mass for pid, pd in PDETAILS.iteritems())
   3.178 -        maxdisplaymass = maxmass * 1.1
   3.179 -        if maxdisplaymass % 100 != 0:
   3.180 -            maxdisplaymass = ((maxdisplaymass + 100) // 100) * 100
   3.181 -        yscale = (ymax-ymin)/maxdisplaymass
   3.182 +    ## Get range of masses needed (quite application-specific at the moment)
   3.183 +    maxmass = max(pd.mass for pid, pd in PDETAILS.iteritems())
   3.184 +    maxdisplaymass = maxmass * 1.1
   3.185 +    if maxdisplaymass % 100 != 0:
   3.186 +        maxdisplaymass = ((maxdisplaymass + 100) // 100) * 100
   3.187 +    yscale = (ymax-ymin)/maxdisplaymass
   3.188  
   3.189 -        ## Write TikZ header
   3.190 -        out += "\\centering\n"
   3.191 -        out += "\\begin{tikzpicture}[scale=0.6]\n"
   3.192 +    ## Write TikZ header
   3.193 +    out += "\\centering\n"
   3.194 +    out += "\\begin{tikzpicture}[scale=0.6]\n"
   3.195  
   3.196 -        out += "  %% y-scalefactor (GeV -> coords) = %e\n\n" % yscale
   3.197 +    out += "  %% y-scalefactor (GeV -> coords) = %e\n\n" % yscale
   3.198  
   3.199 -        ## Draw the plot boundary and y-ticks
   3.200 -        out += "  %% Frame\n"
   3.201 -        out += "  \\draw (%f,%f) rectangle (%f,%f);\n" % (scalex(xmin), ymin, scalex(xmax), ymax)
   3.202 -        out += "  %% y-ticks\n"
   3.203 +    ## Draw the plot boundary and y-ticks
   3.204 +    out += "  %% Frame\n"
   3.205 +    out += "  \\draw (%f,%f) rectangle (%f,%f);\n" % (scalex(xmin), ymin, scalex(xmax), ymax)
   3.206 +    out += "  %% y-ticks\n"
   3.207  
   3.208 -        def calc_tick_vals(vmax, vdiff_nominal=100, max_num_ticks=12):
   3.209 -            """Calculate a display-optimised list of values at which tick marks will be drawn.
   3.210 +    def calc_tick_vals(vmax, vdiff_nominal=100, max_num_ticks=12):
   3.211 +        """Calculate a display-optimised list of values at which tick marks will be drawn.
   3.212  
   3.213 -            TODO: Generalize:
   3.214 -             1. Scale by powers of 10 to bring smallest tick val into 1-10 range. (Handling 0?)
   3.215 -             2. Calculate ticks vector by incrementing in units of {1, 2, 5}
   3.216 -             3. If #ticks > max (determined by available space on plot, i.e. vdiff_plot),
   3.217 -                multiply increment factor by 10 and goto 2.
   3.218 -            """
   3.219 -            ok = False
   3.220 -            vticks = None
   3.221 -            vdiff_scalefactor = 1
   3.222 -            while not ok:
   3.223 -                vticks = xrange(0, int(vmax)+1, vdiff_nominal*vdiff_scalefactor) # the +1 ensures that vmax is included
   3.224 -                if len(vticks) <= max_num_ticks:
   3.225 -                    ok = True
   3.226 -                vdiff_scalefactor *= 2
   3.227 -            return vticks
   3.228 +        TODO: Generalize:
   3.229 +         1. Scale by powers of 10 to bring smallest tick val into 1-10 range. (Handling 0?)
   3.230 +         2. Calculate ticks vector by incrementing in units of {1, 2, 5}
   3.231 +         3. If #ticks > max (determined by available space on plot, i.e. vdiff_plot),
   3.232 +            multiply increment factor by 10 and goto 2.
   3.233 +        """
   3.234 +        ok = False
   3.235 +        vticks = None
   3.236 +        vdiff_scalefactor = 1
   3.237 +        while not ok:
   3.238 +            vticks = xrange(0, int(vmax)+1, vdiff_nominal*vdiff_scalefactor) # the +1 ensures that vmax is included
   3.239 +            if len(vticks) <= max_num_ticks:
   3.240 +                ok = True
   3.241 +            vdiff_scalefactor *= 2
   3.242 +        return vticks
   3.243  
   3.244 -        for mtick in calc_tick_vals(maxdisplaymass):
   3.245 -            ytick = mtick * yscale
   3.246 -            out += "  \\draw (%f,%f) node[left] {%d};\n" % (scalex(xmin), ytick, mtick)
   3.247 -            if mtick > 0 and mtick < maxdisplaymass:
   3.248 -                ## The 0.3 needs to be in the (arbitrary) plot coords
   3.249 -                out += "  \\draw (%f,%f) -- (%f,%f);\n" % (scalex(xmin+0.3), ytick, scalex(xmin), ytick)
   3.250 -        out += "  \\draw (%f,%f) node[left,rotate=90] {Mass / GeV};\n" % (scalex(xmin-2.2), ymax)
   3.251 +    for mtick in calc_tick_vals(maxdisplaymass):
   3.252 +        ytick = mtick * yscale
   3.253 +        out += "  \\draw (%f,%f) node[left] {%d};\n" % (scalex(xmin), ytick, mtick)
   3.254 +        if mtick > 0 and mtick < maxdisplaymass:
   3.255 +            ## The 0.3 needs to be in the (arbitrary) plot coords
   3.256 +            out += "  \\draw (%f,%f) -- (%f,%f);\n" % (scalex(xmin+0.3), ytick, scalex(xmin), ytick)
   3.257 +    out += "  \\draw (%f,%f) node[left,rotate=90] {Mass / GeV};\n" % (scalex(xmin-2.2), ymax)
   3.258  
   3.259 -        ## Decay arrows
   3.260 -        if DDETAILS:
   3.261 -            out += "\n  %% Decay arrows\n"
   3.262 -            for pidfrom, todict in sorted(DDETAILS.iteritems()):
   3.263 -                for pidto, dd in sorted(todict.iteritems()):
   3.264 -                    out += "  %% decay_%d_%d, BR=%0.1f%%\n" % (dd.pidfrom, dd.pidto, dd.br*100)
   3.265 +    ## Decay arrows
   3.266 +    if DDETAILS:
   3.267 +        out += "\n  %% Decay arrows\n"
   3.268 +        for pidfrom, todict in sorted(DDETAILS.iteritems()):
   3.269 +            for pidto, dd in sorted(todict.iteritems()):
   3.270 +                out += "  %% decay_%d_%d, BR=%0.1f%%\n" % (dd.pidfrom, dd.pidto, dd.br*100)
   3.271  
   3.272 -                    def scalethickness(br):
   3.273 -                        if opts.DECAYS_STYLE in ["const", "brcolor"]:
   3.274 -                            return 0.8
   3.275 -                        elif "brwidth" in opts.DECAYS_STYLE:
   3.276 -                            return 1.0 * br
   3.277 -                        else:
   3.278 -                            raise Exception("Unexpected problem with unknown decay line style option: please contact the PySLHA authors!")
   3.279 +                def scalethickness(br):
   3.280 +                    if opts.DECAYS_STYLE in ["const", "brcolor"]:
   3.281 +                        return 0.8
   3.282 +                    elif "brwidth" in opts.DECAYS_STYLE:
   3.283 +                        return 1.0 * br
   3.284 +                    else:
   3.285 +                        raise Exception("Unexpected problem with unknown decay line style option: please contact the PySLHA authors!")
   3.286  
   3.287 -                    def scalecolor(br):
   3.288 -                        if opts.DECAYS_STYLE in ["const", "brwidth"]:
   3.289 -                            return None
   3.290 -                        elif "brcolor" in opts.DECAYS_STYLE:
   3.291 -                            return "black!"+str(60*dd.br + 10)
   3.292 -                        else:
   3.293 -                            raise Exception("Unexpected problem with unknown decay line style option: please contact the PySLHA authors!")
   3.294 +                def scalecolor(br):
   3.295 +                    if opts.DECAYS_STYLE in ["const", "brwidth"]:
   3.296 +                        return None
   3.297 +                    elif "brcolor" in opts.DECAYS_STYLE:
   3.298 +                        return "black!"+str(60*dd.br + 10)
   3.299 +                    else:
   3.300 +                        raise Exception("Unexpected problem with unknown decay line style option: please contact the PySLHA authors!")
   3.301  
   3.302 -                    out += "  \\draw[-stealth,line width=%0.2fpt,dashed,color=%s] (%f,%f) -- (%f,%f);\n" % \
   3.303 -                        (scalethickness(dd.br), scalecolor(dd.br) or dd.color,
   3.304 -                         scalex(dd.xyfrom[0]), yscale*dd.xyfrom[1], scalex(dd.xyto[0]), yscale*dd.xyto[1])
   3.305 +                out += "  \\draw[-stealth,line width=%0.2fpt,dashed,color=%s] (%f,%f) -- (%f,%f);\n" % \
   3.306 +                    (scalethickness(dd.br), scalecolor(dd.br) or dd.color,
   3.307 +                     scalex(dd.xyfrom[0]), yscale*dd.xyfrom[1], scalex(dd.xyto[0]), yscale*dd.xyto[1])
   3.308  
   3.309 -        ## Draw mass lines
   3.310 -        if PDETAILS:
   3.311 -            out += "\n  %% Particle lines\n"
   3.312 -            for pid, pdetail in sorted(PDETAILS.iteritems()):
   3.313 -                y = pdetail.mass*yscale
   3.314 -                out += "  %% pid%s\n" % str(pid)
   3.315 -                out += "  \\draw[color=%s,thick] (%f,%f) -- (%f,%f);\n" % \
   3.316 -                    (pdetail.color, scalex(pdetail.xedges.left), y, scalex(pdetail.xedges.right), y)
   3.317 +    ## Draw mass lines
   3.318 +    if PDETAILS:
   3.319 +        out += "\n  %% Particle lines\n"
   3.320 +        for pid, pdetail in sorted(PDETAILS.iteritems()):
   3.321 +            y = pdetail.mass*yscale
   3.322 +            out += "  %% pid%s\n" % str(pid)
   3.323 +            out += "  \\draw[color=%s,thick] (%f,%f) -- (%f,%f);\n" % \
   3.324 +                (pdetail.color, scalex(pdetail.xedges.left), y, scalex(pdetail.xedges.right), y)
   3.325  
   3.326 -        ## Particle labels
   3.327 -        if PLABELS:
   3.328 -            out += "\n  %% Particle labels\n"
   3.329 -            for ld in PLABELS:
   3.330 -                anchors_pstricks_tikz = { "r" : "left", "l" : "right" }
   3.331 -                out += "  \\draw (%f,%f) node[%s] {\small %s};\n" % \
   3.332 -                    (scalex(ld.xy[0]), yscale*ld.xy[1], anchors_pstricks_tikz[ld.anchor], ld.texlabel)
   3.333 +    ## Particle labels
   3.334 +    if PLABELS:
   3.335 +        out += "\n  %% Particle labels\n"
   3.336 +        for ld in PLABELS:
   3.337 +            anchors_pstricks_tikz = { "r" : "left", "l" : "right" }
   3.338 +            out += "  \\draw (%f,%f) node[%s] {\small %s};\n" % \
   3.339 +                (scalex(ld.xy[0]), yscale*ld.xy[1], anchors_pstricks_tikz[ld.anchor], ld.texlabel)
   3.340  
   3.341 -        ## Write TikZ footer
   3.342 -        out += "\\end{tikzpicture}\n\n"
   3.343 +    ## Write TikZ footer
   3.344 +    out += "\\end{tikzpicture}\n\n"
   3.345  
   3.346 -        ## Write LaTeX footer
   3.347 -        out += c + "\\end{document}\n"
   3.348 +    ## Write LaTeX footer
   3.349 +    out += c + "\\end{document}\n"
   3.350  
   3.351 -        ## Write output
   3.352 -        if opts.FORMAT.make_tex():
   3.353 -            writeout(out, outname+".tex")
   3.354 -        if opts.FORMAT.needs_compilation():
   3.355 -            import tex2pix
   3.356 -            r = tex2pix.Renderer(out)
   3.357 -            if opts.FORMAT.make_pdf():
   3.358 -                r.mkpdf(outname+".pdf")
   3.359 -            if opts.FORMAT.make_png():
   3.360 -                r.mkpng(outname+".png")
   3.361 -            if opts.FORMAT.make_eps():
   3.362 -                r.mkeps(outname+".eps")
   3.363 -
   3.364 -    ## UNRECOGNISED FORMAT!
   3.365 -    else:
   3.366 -        logging.error("Other formats not currently supported! How did we even get here?!")
   3.367 -        sys.exit(2)
   3.368 +    ## Write output
   3.369 +    if "tex" in opts.FORMAT.formats:
   3.370 +        writeout(out, outname+".tex")
   3.371 +    if "texfrag" in opts.FORMAT.formats:
   3.372 +        writeout(out, outname+".frag.tex")
   3.373 +    if opts.FORMAT.needs_compilation():
   3.374 +        import tex2pix
   3.375 +        r = tex2pix.Renderer(out)
   3.376 +        for f in opts.FORMAT.file_extensions():
   3.377 +            if f not in ("tex", "frag.tex"):
   3.378 +                r.mk(outname+"."+f)
     4.1 --- a/test	Sat Mar 03 20:38:59 2012 +0100
     4.2 +++ b/test	Sun Mar 04 11:45:16 2012 +0000
     4.3 @@ -1,2 +1,8 @@
     4.4 +#! /usr/bin/env bash
     4.5 +
     4.6 +FORMAT=pdf
     4.7 +#FORMAT=pdf,eps,ps,png,jpg
     4.8 +
     4.9 +if [[ -n "$1" ]]; then FORMAT=$1; fi
    4.10  python pyslha.py spcfiles/sps1a.spc || exit 1
    4.11 -slhaplot spcfiles/* --br=0.1
    4.12 +slhaplot -f $FORMAT spcfiles/* --br=0.1

mercurial