[Doc-SIG] \begin{interactive}

Berthold Höllmann se6y095@public.uni-hamburg.de
Thu, 04 Mar 1999 16:42:41 +0100


David Ascher wrote:
> 
> Here's my hack for the day.  I keep writing doc, and I'm always frustrated
> when there's a mismatch between the stuff that the user is supposed to
> have input and the output that is shown.  Here's a solution for LaTeX
> documents:
> 
> The comment below should explain it to the LaTeXgnescenti.
> 
> Comments welcome.
> 
Hello David, hello all,

I took "proc.py" and developed "LaTeXPy.py" on it's ideas and code. I
also added "python.sty", which simply defines the preamble options.

"LaTeXPy.py" is not only ment to be used for python documentation, but
also for documents where som calculation is neede. The new "Python"
environment is used to execute some python code without leaving any
trace in the generated LaTeX file, the command "\CallPython" is ment to
insert python output into the LaTeX file. A function "PyLaTeX" can be
called to escape special characters.

As an Example, if you want to get a pair of curly braces in the LaTeX
output take this LaTeX input:

--- snip ---
\documentclass[a4paper]{article}
\usepackage{python}
\begin{document}
\begin{Python}
import LaTeXPy
\end{Python}
\CallPython{LaTeXPy.PyLaTeX('{}')}
\end{document}
--- snip ---

creates as output:

--- snip ---
\documentclass[a4paper]{article}
\usepackage{python}
\begin{document}
\begin{Python}
import LaTeXPy
\end{Python}
\CallPython[{\{\}}]{LaTeXPy.PyLaTeX('{}')}
\end{document}
--- snip ---

The package PyLaTeX-1.0 on my starship.python home contains UnitPrint,
which allowes nice formatting of Floats, Integers and PhysicalQuantities
(from Konrad Hinsen's ScientificPyton modules).

LaTeX.py on my homepage is ment to generate LaTeX files from python. I'm
not shure, which is the better srategy, to write a python file with
strings containing the LaTeX commands, or to write a LaTeX file with
embedded python code.

Any comments are welcome

Cheers

Berthold
-- 
bhoel@starship.python.net     http://starship.python.net/crew/bhoel/
        It is unlawful to use this email address for unsolicited ads
        (USC Title 47 Sec.227). I will assess a US$500 charge for
        reviewing and deleting each unsolicited ad.