SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files
PyC2LaTeX 0.7 (06.11.04)

PyC2LaTeX 0.7 (06.11.04) takes a given adl, c, idl or java file and writes a (beautiful) latex file to prettyprint the code. Currently line numbering, indentation, support for international characters (for user interfaces) and syntaxhighlighting are featured. Besides these I just print out the code as is to leave your code as you desired (and of course to force you writing pretty code). The produced code is written in a standalone file "filename.tex" (where the inputfile is called "filename.{adl, c, idl, java}"). This file can be included in any given latex file.
Furthermore this program constructs a compilable preview file that is created automatically (can easily be deactivated in config/options.py) as the program runs. If there are any ambitious programmers out there, I put a TODO list for this script on my homepage:
http://www.sbox.tugraz.at/home/s/santa/ (section programming) one of the neatest things would be code cross referencing.

One of the main purposes of this program is to provide LaTeX output, that can be easily included in other LaTeX documents by simply including %%%%%%%%%%%%%%%%%%%%
\usepackage{color}
%%%%%%%%%%%%%%%%%%%%
in the document header (everything that occurs before the 'begin{document}' command), writing the line
%%%%%%%%%%%%%%%%%%%%
\input{PATH_TO_PYC2LATEX/config/config.ltx} %%%%%%%%%%%%%%%%%%%%
(or, if you prefer black and white output use config_no_syntaxhighlighting.ltx)
right after the 'begin{document}' statement (warning, you must not use the variables '\parindentOld' and '\linenumber' in your document, because they are used by PyC2LaTeX) and including your produced files wherever you want typing
%%%%%%%%%%%%%%%%%%%%
\input{PATH_TO_YOUR_FILE/filename.ltx}
%%%%%%%%%%%%%%%%%%%%
If there are any ambitious programmers out there, I put a TODO list for this script on my homepage:
http://www.sbox.tugraz.at/home/s/santa/ (programming.html) one of the neatest things would be a code cross referencing.


Installation
To make this script work correctly you need to add the paths PATH_TO_PYC2LATEX and PATH_TO_PYC2LATEX/config to you PYTHONPATH environment variable. If you use bash and this script resides in ~/bin/PyC2LaTeX you have to type the following:
PYTHONPATH=$PYTHONPATH:~/bin/PyC2LaTeX:~/bin/PyC2LaTeX/config

Furthermore you need to make the script executable by typing something like
chmod u+x PyC2LaTeX.py
(on Unix systems, does not work using Windows) and to add it to your PATH environment variable. Using the bash shell type the following PATH=$PATH:~/bin/PyC2LaTeX

Since setting your environment every time you log in is annoying you might want to add the following lines to the end of your ~/.bashrc (assuming that you use Unix or Linux and the Bash shell) PYTHONPATH=$PYTHONPATH:~/bin/PyC2LaTeX:~/bin/PyC2LaTeX/config export PYTHONPATH
PATH=$PATH:~/bin/PyC2LaTeX


Usage
To use this script you need a current version of python installed, which can be obtained at (www.python.org). Having followed the instructions in the Installation section call it by typing: PyC2LaTeX.py what/ever/path/filename.{adl, c, idl, java} on Unix systems and the output will be written to what/ever/path/filename.ltx
If you use Windows type
python PyC2LaTeX.py what/ever/path/filename.{adl, c, idl, java} since Windows does not support executable scripts.
Configuration
Beginning with version 0.6.1 this script supports an easy to use configuration file that does not require any kind of Python or LaTeX knowledge.
If you know a little LaTeX (which I expect most serious c programmers to do) detailed configuration should be a child's play simply changing the .ltx files in '/config/'


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.