What packages are available for SQL Suite in LaTeX?

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

[edit] Requirement added: I would like the package to intelligently insert page breaks, so that when possible statements do not span multiple pages. Still reading the documentation, so it’s possible that any of a / m can do this already. Please let me know if this is the case.

Related: question

+4
source share
2 answers

You want to use the listings package. Is there any specific thing you want to do with it, or are you just asking which package works best? I have never encountered big problems with listings , although getting it to do the same thing I want is sometimes difficult (this is LaTeX; expecting something else would be foolish).

Edit (to refer to your editing): smart page splitting can be problematic; it is certainly beyond my abilities. listings could do this with explicit markup (run on LaTeX and insert a negative page break violation in the appropriate place, probably macro izable), but I don't think listings can do this automatically, and I doubt LGrind can do it too. You may have been lucky with finding luck or comp.text.tex on a specific LaTeX list (Usenet's comp.text.tex is a great place to try), but a page break in TeX has never been as good as a line break, and therefore I could not hold out would have too much hope, unfortunately.

+5
source

I use the listings package, but mostly for snippets. I do not need to worry about page breaks in general. One of the great features of listings is its high degree of flexibility. For example, I do not use my SQL code, but I can print my lists with capital keywords:

 \makeatletter \newcommand{\lstuppercase}{\uppercase\expandafter{\expandafter\ lst@token \expandafter{\the\ lst@token }}} \newcommand{\lstlowercase}{\lowercase\expandafter{\expandafter\ lst@token \expandafter{\the\ lst@token }}} \makeatother \lstdefinestyle{Oracle}{basicstyle=\ttfamily, keywordstyle=\lstuppercase, emphstyle=\itshape, showstringspaces=false, } 

And identify more keywords as needed:

 \lstdefinelanguage[Oracle]{SQL}[]{SQL}{ morekeywords={ACCESS, MOD, NLS_DATE_FORMAT, NVL, REPLACE, SYSDATE, TO_CHAR, TO_NUMBER, TRUNC}, } 

To use these definitions:

 \lstset{language=[Oracle]SQL, style=Oracle, } 

If I were to print large snippets of code, I would not worry about page breaks or write a preprocessor to split the code before transferring it to LaTeX .

+10
source

All Articles