Perl Scripts

If the scripts require any libraries of my own, I have usually included them. Should I have forgotten one then you can download it separately.

bibtexformat

Since this little script has gained quite some popularity lately, it has been given its own little page. This sections was kept to avoid dead links in the Papers forum.

getpapers

Download getpapers (source)

This script was written to be used in combination with Papers which lets you define smart lists to generate collections of publications (e.g. all papers by a certein author or a special topic). Papers also lets you export a BibTeX library containing only the papers in that collection. The script getpapers extracts each PDF link contained in that database and copies the PDFs into the current folder.

Usage:   getpapers  library.bib

library.bib must be a BibTeX library exported by Papers. All local-url fields are
extracted and the file://localhost prefix is removed in order to copy all files to
the current directory.

maketex

Download maketex (source)

Even though LaTeX frontends such as WinEdt, TexMaker, etc. provide of course a function to compile the document, in some cases special switches are required, the error/warning output by TeX is better or other reasons make the compilation via command line a better choice. Also, if you use vim or similar editors, there is no compile button.

The script provides the important compilation sequences in one command and simplifies the routine. If one wants to compile from .tex to .pdf, including BibTeX and compiling twice to update all references, this only requires the -all option.

Usage:   maketex [-clean] [-all] [-full] [-tex] [-bib] [-dvi] [-ps] [-pdf]
                 [-s] [-f a4] [-pdftex] [-xetex]
                 [file1.tex ...] 

         clean   erases aux, bbl, blg, dvi, log, ps, pdf and toc of each given file
         all     same as "dvi pdf"
         full    same as "clean dvi pdf"
         tex     runs only latex
         bib     runs only bibtex
         dvi     runs latex, bibtex, latex, latex
         ps      runs latex, dvips
         pdf     runs latex, dvips, ps2pdf
         pdftex  uses pdflatex instead of the latex command
         xetex   uses xelatex instead of the latex command

         f       choose a paper format (determined from the \documentclass line otherwise)
         s       (silent) display only error messages of the last BibTeX and LaTeX run
         sx      (extra silent) also omits over/underfull boxes errors and changes
                 [htb] specifiers

         If no file is specified, all files containing \begin{document} are compiled.

mergelatex

Download mergelatex (source)

It is very handy to split up a LaTeX documents in several parts (e.g. each section) and include the single files via include directives in a main file. If the document is ready and to be passed on to others, it is often easier to combine the sections into a single LaTeX file. Especially scientific journals usually require a single file. To ease up combining the files, I wrote this script which does it with only a single command.

For another purpose, several filter possibilities have been added. In the process it is possible to strip the file of all tables, figures, equations, extra spaces, etc.

Usage:   mergelatex file.tex -o filemerged.tex [-nofig]

         -merge       replace \input command with the actual file

         -nofigure    skips complete figure environments
         -nographic   skips graphics, figure caption is kept

         -notable     skips complete table environments
         -notabular   skips tabular environments (keeps table caption)

         -noequation  skips equation environment
         -noenlarge   skips lines containing \noenlargethispage
         -nocomment   skips comments
         -nonewpage   skips \pagebreak and \newpage
         -placements  removes table and figure placements (e.g. [p!])
         -nospaces    removes \vspace and \hspace commands

         -s           silent mode

plotspectrum

Download plotspectrum (source and documentation)
Download plotspectrum (documentation only)

This is a powerful front end for gnuplot, using the latter to create 2D or 3D plots containing one or more spectra as postscript files. It can be configured via a whole lot of command line options (often derived from the actual gnuplot commands) and also creates the gnuplot command file if requested. That way plotspectrum can be used to create the "rough" gnuplot command file quickly (even via a script) and then the produced command file can be fine-tuned afterwards if desired.

Usage:   plotspectrum file1 [...]  [-x min max]        [-y min max]
                                   [-o outputfile]     [-p]
                                   [-lw linewidth]     [-title "title"]
                                   [-xlabel "label"]   [-ylabel "label"]
                                   [-ls 1 2 3 ...]     [-using 1:2 1:3 5:6]
                                   [-every 10] [-k "key1" "key2" ... ]

    file1       the extension .cd or .ld is added if omitted

    -a          use absorbance  units for y-axis (default is ellipticity for .cdl
                and .cd files)
    -e          use ellipticity units for y-axis (default)
    -ld         LD (absorbance units) for the y-axis, default for .ld
    -dr         dichroic ratio (absorbance units) for the y-axis, default for .dr
    -ldr        reduced LD (absorbance units) for the y-axis, default for .ldr

    -w          use wavelengths (nm) for x-axis, default for all dichroism spectra
    -wn         use wavenumbers for the x-axis
    -xlabel     specify a label for the x-axis
    -ylabel     specify a label for the y-axis
    -zlabel     specify a label for the z-axis

    -x          x-range, e.g. 150 250, default is 150 250 for spectra
    -xtics      the distance of the tics on the x-axis
    -mxtics     defines the minor tics on the x-axis
    -noxtics    disable tics of the x-axis

    -y          the y-range, e.g. -1000 1000 or 1000
    -ytics      the distance of the tics on the y-axis
    -mytics     defined the minor tics on the y-axis
    -noytics    disable tics of the y-axis

    -z          the z-range, e.g. -1000 1000 or 1000
    -ztics      the distance of the tics on the z-axis
    -mztics     defined the minor tics on the z-axis
    -noztics    disable tics of the z-axis

    -cmd        keep the gnuplot command file for later changes
    -cfg        create a .cfg file with the command used to produce the spectrum
    -pdf        create a PDF from the postscript
    -gif        create a GIF file instead of postscript (automatically, if .gif
                extension is given with -o
    -res        defines the GIF resolution xres yres (default 1024x768)

    -o          defines the file name of the output file
    -p          preview mode: open gnuplot instead of writing to a file
    -s          define the size of the plot (default is 1,1)

    -t          specify a title for the plot
    -notitle    specifically disable the title
    -lines      plot a line spectrum instead of a curve (used automatically for
                .cdl and .abl)
    -impulses   same as "-lines"
    -points     use points for plotting
    -dots       use dots for plotting
    -pm3d       use PM3D (this requires grid data, see -grid)

    -contour x  enables the plot of the contours (grid data required) and x defines
                the number of intervalls into which the z-range is divided into
    -cbase      plot the contours at the base
    -csurface   plot the contours on the surface
    -cboth      plot the contours on both the base and the surface
    -grid x     create grid data using column x (counting starts at 1)

    -nocolour   do not use colours (terminal-depended, X11 will still be coloured)
    -solid      use only solid lines (terminal-depended)

    -ls         A list of numbers from 1 to 15, which define the line styles. The
                first style is assigned to the first spectrum etc. A style marked
                with an asterisk (-ls 2*) is assigned to all other graphs.
                If the style contains points, "linespoints" are used.
    -lt         A list of numbers from 1 to 10, which define the line types
                (1=solid, 2=dashed, etc.). The first number is assigned to ls 1,
                second to ls 2, etc. An asterisk marks a default type.
                See the manual for an example.
    -lc         A list of strings defining the line colour sequence in which they
                are to be assigned to the line styles. (Asterisk for default.)
    -pt         A list of integers with the point types assigned to the line styles.
                Use 0 for no point style. An asterisk marks a default style.
    -lw         A list of integers defining the line widths of the line styles
                (default 4). An asterisk marks a default width.

    -every      print only every nth data point of all graphs
    -pd         point distance, default is 5, detects too many data points
                per x-value automatically if linespoints are used and sets "every"
                to the given value for that graph
    -using      Defines which columns are to be plotted in a multi-column input
                file. More than one value can be given for multiple files and
                the syntax follows the gnuplot format, e.g. '-using 1:2 1:3 1:4'
                An asterisk marks the default to be taken for all plots, e.g.
                -using 1:2* 1:3 1:5

    -splot      uses splot instead of plot (to create 3D plots)

    -bezier     use bezier curves to connect the points smoothly
    -sbezier    use sbezier curves to connect the points smoothly
    -unique     use the 'unique' fitting routine to smooth curves
    -csplines   use splines to connect the points smoothly
    -acsplines  use weighted splines to connect the points smoothly
                (third column with weighting factors needed)

    -nokey      do not display the key (legend)
    -k          keys for each graph used in the legend (order matters!)
    -ktop       place key at the top
    -kbottom    place key at the bottom
    -kbelow     place key below the plot
    -kinside    place key inside the plot
    -koutside   place key outside the plot
    -kreverse   place line sample to the left of the keys (default)
    -knoreverse place line sample to the right of the keys
    -kleft      place key left
    -kright     place key right
    -kLeft      justify key labels left
    -kRight     justify key labels right
    -ksamplen   define the length of the samples in the key (default 2)
    -kspacing   define the spacing of the samples in the key (default 1.25)

    -d          an integer, adjusts the /Dashlength value in the PS file
    -dl1        a real number, adjusts the /dl1 value in the PS file
                (this is the actual length of the dashes)
    -dl2        a real number, adjusts the /dl2 value in the PS file
                (this is the distance between the dashes)

Valid XHTML 1.0 Strict Made on a Mac Page created using TYPOlight Valid CSS!

Parts of this content were created while working in the Hirst group (Nottingham, UK).
Ben Bulheller