2

I have just completed writing my very own LaTex package, how can i make the package to be self documented like maybe from comments in the package code?

  • 3
    package ltxdoc, where the .dtx file can provide both the documentation as well as the .sty file – Steven B. Segletes Jun 16 '14 at 10:19
2

Assuming you've written the package as a .sty file, a good start at a combined source code/documentation is provided by the Perl script sty2dtx (requires Perl). The script also works for document classes with the --type class switch.

Usage:

perl sty2dtx.pl < mypkg.sty > mypkg.dtx

or

perl sty2dtx.pl mypkg.sty mypkg.dtx

Refer to the README for a complete list of supported options.

The script generates a .dtx file for use in the workflow described in How to Package Your LaTeX Package. The generated .dtx forms a starting point by showing any comments in your .sty file as text in documentation generated by running (pdf)latex on the .dtx file.

This will give you a good starting point for a package in the literate programming style, with generated documentation in the style of many LaTeX packages. From here, it's up to you to add content to the documentation within the base framework provided by sty2dtx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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