Search code examples
sqllatextypeset

What packages are available to typeset SQL in LaTeX?


I'm looking for a package to typeset SQL statements in LaTeX. So far I have heard of listings and lgrind, are there any other suggestions?

[edit] Added requirement: I'd like the package to be able in intelligently insert page breaks, so that where possible statements do not span multiple pages. Still reading documentation, so it is possible that either of the a/m are able to do this already- Please let me know if this is the case.

Related: question


Solution

  • You want to use the listings package. Is there a specific thing you want to do with it, or are you just asking which package works best in general? I've never encountered any big problems with listings, though getting it to do Exactly What I Want is sometimes tricky (it's LaTeX; to expect anything else would be folly).

    Edit (to address your edit): intelligent page breaking might be problematic; it's certainly beyond my abilities. listings might be able to do it with explicit markup (escape to LaTeX and insert a negative page break penalty at appropriate place; likely macro-izable), but I don't think listings can do it automatically, and I doubt LGrind can do it either. You might have better luck searching or asking on a LaTeX-specific list (comp.text.tex on Usenet is a great place to try), but page breaking in TeX has never been as good as line breaking, and so I wouldn't hold out too much hope, unfortunately.