SQL in Latex

  • What is the best way to format SQL in Latex?

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • What is latex? I know it is a type of rubber, but I am assuming it means something else in this context.

  • LaTeX - it's a document markup language that's used extensively in academic fields. Based on TeX

    http://www.latex-project.org/

    Timothy: Personally I'd just use a verbatim block, then you can format it any way you like. That's how I've so far done all code blocks Something like this:

    \begin{verbatim}

    SELECT ...

    FROM Sometable

    INNER JOIN SomeOtherTable ....

    WHERE ....

    \end{verbatim}

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Gail. I guess that's my one new thing learned for the day, so I can go home now.

  • Jack, to add just a little to what Gail said, it is similar in many ways to HTML except designed specifically for math and science publications.

    Gail, Thanks. I have been using verbatim so far and the results seem acceptable, but I was hoping there was something that might be superior or more focused on code.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • timothyawiseman (9/6/2008)


    What is the best way to format SQL in Latex?

    Spackle first to fill in any holes, sand, prime and then use a roller with a 3/8 inch nap. And don't forget to tape off the trim and windows, or you'll splatter everywhere. :hehe:

    ---------------------------------------------------------
    How best to post your question[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."

  • I have this horrible thought about SQL in spandex stuck in my head now. Yeah, I know, it's not quite what was written, but it sure is what my eyes saw the first time I noticed this thread.

    * Down brain! Bad, bad brain! No tasty-treat for you! *

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Have a look at listings package (http://en.wikibooks.org/wiki/LaTeX/Packages/Listings), also Google (http://www.google.co.uk/search?q=latex+listings). It supports syntax highlighting for many programming languages, including SQL, and produces very nice output.

    Gleb

    http://www.turbodad.com

  • GSquared (9/9/2008)


    I have this horrible thought about SQL in spandex stuck in my head now.

    Could be worse. Could be a SQL consultant in spandex....

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gleb, listings is exactly what I wanted. Thank you.

    Gail, I agree, a SQL consultant in latex is a scary thought, but SQL code in LaTeX (with listings) can look quite good.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • GilaMonster (9/9/2008)


    GSquared (9/9/2008)


    I have this horrible thought about SQL in spandex stuck in my head now.

    Could be worse. Could be a SQL consultant in spandex....

    Actually, one (and only one) of the DBAs I know would be just fine in spandex, now that I think about it. (Though, of course, I have no clue what anyone on this site looks like; I'm refering to someone I know in person.)

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • timothyawiseman (9/6/2008)


    What is the best way to format SQL in Latex?

    Dunno. I do all my SQL formatting in nylon, with lace undies and diamante jewellery. I prefer dinner suit, bow tie and cummerbund for VBScript, but I only get really down and dirty for Korn shell.

    It raises a few eyebrows round the office, but I don't understand why well written code should excite comment.

    Semper in excretia, suus solum profundum variat

  • majorbloodnock (9/11/2008)


    timothyawiseman (9/6/2008)


    What is the best way to format SQL in Latex?

    Dunno. I do all my SQL formatting in nylon, with lace undies and diamante jewellery. I prefer dinner suit, bow tie and cummerbund for VBScript, but I only get really down and dirty for Korn shell.

    Remind me to never watch you code SQL or Korn shell scripts. 😉

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply