LaTeX::Parser - Perl extension to parse LaTeX files


  use LaTeX::Parser;
  my $l = new LaTeX::Parser 'file' => 'file.tex';
  my $p = $l->latex; # $p now hold a reference to an array of
                     # file.tex parsed

Or use it to break up LaTeX in a variable:

  my $l = new LaTeX::Parser 'content' =>
    '\textit{Three Lives} by Gertrude Stein.';

Contents of nested braces are extracted as a single element. Another LaTeX::Parser will have to be created to parse nested braces.

This is a very early version of LaTeX::Parser, there are many bugs. I think this will work fine with plain TeX files but I do not plan on ever support that.


For now, only simple descriptions of the modules functions.

LaTeX::Parser->new %hash

Creates a LaTeX::Parser object. All values in %hash are initialize to the values in the object. The only two tested values to set are `file' and `content'. `file' is the name of the file to load the LaTeX file from, and it get copied into `content'. If content is set by then %hash then `file' will never be called.


No arguments. Actualy does all the work. Loads the LaTeX file if not content was specified, and returns a reference to all parsed information.


Many bugs i'll find soon enough. Off the top of my head, I know backslashed brackes in LaTeX are considered normal brackets. I haven't even thought about math things, and don't think I will think about that any time soon.


Sven Heinicke, <>


perl(1), latex(1).