TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to generate Software Requirement Specification documents in LaTeX. I have to use Perl to accomplish this. The documents consist of tables, lists, pictures, TOC, table of figures, headings and so on ...

Can you give me some general advice on how to approach such a task? Are there maybe some Modules you found useful or "traps" I have to be aware off?

share|improve this question
Welcome to TeX.sx! The latex-project tag is about the LaTeX develop project itself. A latex tag is superfluous on this site. There is no ubuntu tag on askubuntu.com either, or a perl tag on perlmonks.org. Ok, the latter doesn't have any tag system, but would be also an good alternative site to ask this question. – Martin Scharrer Jun 29 '11 at 18:15
Thank you. The latex tags I used indeed make no sense. – AlexTheBird Jun 29 '11 at 18:28
Googling 'perl template latex' returned several starting points, mostly involving the Template::Latex module from CPAN. A PracTeX Journal article is also available. – Mike Renfro Jun 29 '11 at 20:48
Where do need the most help? The LaTeX side, e.g. which LaTeX code to choice for this? Or the Perl side, e.g. organizing the script and loading of templates, etc? Because the second part would be off-topic here and would be better suited on stackoverflow.com or programmers.stackexchange.com, besides the already mentioned external non-SX site perlmonks.org. – Martin Scharrer Jun 30 '11 at 6:50
That is the first time I use LaTeX, so I thought it would be a good idea to ask for some general advice or hints from people who are already generating LaTeX-docs with Perl. I have no specific problem, I just couldn't find a point to start. For example, thanks to the comments now I know, that it is a good idea to use templates. Now I know I must prepare/split my data in a way that it can be used to feed templates and I got two example programs to work with. – AlexTheBird Jul 1 '11 at 16:57
up vote 2 down vote accepted

I can give you two examples of LaTeX-generating Perl script written by me. Both are on CTAN (not CPAN!) and called sty2dtx and texdef.

For the first I read and parse some LaTeX code from an existing package (.sty file) and generate a .dtx file (Documented LaTeX) from it by adding the appropriate documentation macros, so that the package author only has to fill in the descriptions. I decided to write my own little template engine which simply places <+NAME+> markers where I need to add material. The template itself is actually at the end of the script in the __DATA__ section. Then I have a hash with of this variables, so I only need to loop over the template, find the markers, extract the NAME part and replace the whole marker with the NAME entry in the hash. Have a look at the source code.

share|improve this answer
Thanks for your time and efforts. I think the scripts are a good starting point. – AlexTheBird Jul 1 '11 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.