generate LaTeX/TeX syntax highlighted code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Hunter

    generate LaTeX/TeX syntax highlighted code


    Are there any tools that can be used to process python code and
    generate LaTeX/TeX output with syntax highlighted code?

    John Hunter
  • Brian Gough

    #2
    Re: generate LaTeX/TeX syntax highlighted code

    John Hunter <jdhunter@ace.b sd.uchicago.edu > writes:
    [color=blue]
    > Are there any tools that can be used to process python code and
    > generate LaTeX/TeX output with syntax highlighted code?[/color]

    Try lgrind.

    --
    Brian Gough

    Network Theory Ltd,
    Publishing the Python Manuals --- http://www.network-theory.co.uk/

    Comment

    • John Hunter

      #3
      Re: generate LaTeX/TeX syntax highlighted code

      >>>>> "Brian" == Brian Gough <bjg@network-theory.co.uk> writes:

      Brian> John Hunter <jdhunter@ace.b sd.uchicago.edu > writes:[color=blue][color=green]
      >> Are there any tools that can be used to process python code and
      >> generate LaTeX/TeX output with syntax highlighted code?[/color][/color]

      Brian> Try lgrind.

      Just did a little googling and found this in the lgrind FAQ

      My source code doesn't seem to align properly. What am I doing wrong?

      LGrind uses by default a proportional font for its output. That's part
      of the beauty. However, aligning with spaces doesn't work, since they
      are relative horizontal motions. When using tabs, everything is fine. If
      the standard tab width of 8 is too big for you, fiddle around with your
      editor to save the file with tabwidth 4, say, and then use '-t 4' as an
      option to LGrind.

      Should I be worried? Will I need to preprocess my python and convert
      spaces to tabs?

      Also, I did some searching on google groups - it appears you need to
      specify the syntax for python. I found this post from 1998



      Do you have something more recent, or is this what you use?

      Thanks!
      John Hunter

      Comment

      • David Eppstein

        #4
        Re: generate LaTeX/TeX syntax highlighted code

        In article <mailman.30.108 9121896.5135.py thon-list@python.org >,
        John Hunter <jdhunter@ace.b sd.uchicago.edu > wrote:
        [color=blue]
        > Are there any tools that can be used to process python code and
        > generate LaTeX/TeX output with syntax highlighted code?[/color]

        \usepackage{lis tings}



        --
        David Eppstein http://www.ics.uci.edu/~eppstein/
        Univ. of California, Irvine, School of Information & Computer Science

        Comment

        • Marc 'BlackJack' Rintsch

          #5
          Re: generate LaTeX/TeX syntax highlighted code

          In <mailman.30.108 9121896.5135.py thon-list@python.org >, John Hunter wrote:
          [color=blue]
          > Are there any tools that can be used to process python code and
          > generate LaTeX/TeX output with syntax highlighted code?[/color]

          The listings package has Python support. From the README:

          Abstract
          --------

          The `listings' package is a source code printer for LaTeX.
          You can typeset stand alone files as well as listings with
          an environment similar to `verbatim' as well as you can
          print code snippets using a command similar to \verb'.
          Many parameters control the output and if your preferred
          programming language isn't already supported, you can make
          your own definition.

          Ciao,
          Marc 'BlackJack' Rintsch

          Comment

          • Dave Kuhlman

            #6
            Re: generate LaTeX/TeX syntax highlighted code

            > John Hunter <jdhunter@ace.b sd.uchicago.edu > wrote:[color=blue]
            >[color=green]
            >> Are there any tools that can be used to process python code and
            >> generate LaTeX/TeX output with syntax highlighted code?[/color][/color]

            The SciTE text editor enables you to export to LaTeX (also to PDF,
            HTML, XML, and RTF). See:

            Scintilla, SciTE, Editing Component, Text Editor


            Dave


            --
            Dave Kuhlman

            Comment

            • Jussi Jumppanen

              #7
              Re: generate LaTeX/TeX syntax highlighted code

              In article <mailman.30.108 9121896.5135.py thon-list@python.org >,
              John Hunter <jdhunter@ace.b sd.uchicago.edu > wrote:
              [color=blue]
              > Are there any tools that can be used to process python code and
              > generate LaTeX/TeX output with syntax highlighted code?[/color]

              Take a look at the Doxygen tool:

              Source code documentation and analysis tool


              It will produce LaTex documentation directly from the from
              source code and understands C++, C, Java, IDL, to some
              extent Objective-C, PHP, C# and D.

              FYI I also wrote a zOxygen Windows based utility that wraps
              around the Doxygen tool:

              A powerful, feature packed, fully configurable IDE specifically designed for Windows developers....


              It is designed to simplify the process of document creation
              process for the case where you have a large number of project
              source files.

              Jussi Jumppanen

              Comment

              • John Hunter

                #8
                Re: generate LaTeX/TeX syntax highlighted code

                >>>>> "David" == David Eppstein <eppstein@ics.u ci.edu> writes:
                [color=blue][color=green]
                >> Are there any tools that can be used to process python code and
                >> generate LaTeX/TeX output with syntax highlighted code?[/color][/color]

                David> \usepackage{lis tings}

                David> http://www.ctan.org/tex-archive/macr...trib/listings/

                .... beyond my wildest dreams...

                JDH

                Comment

                Working...