Lout: An alternative to LaTeX?

I’ve recently been play­ing around with the Lout doc­u­ment type­set­ting sys­tem. Lout is in many ways sim­i­lar to LaTeX, was also cre­ated by aca­d­e­mics, and seems to cater to the same com­mu­nity. While there are dis­ad­van­tages, its chief advan­tages seem to be speed and size: a down­load of the entire sys­tem is less than 1 MB, and takes around 5 MB when installed.

Like LaTeX, you begin by edit­ing a text file. This text file con­sists firstly of a header or pre­am­ble, which is used to load libraries and set ini­tial para­me­ters. Next comes the body of the doc­u­ment, with spe­cial mark-up tags or com­mands for spe­cial ele­ments. In Lout, these typ­i­cally begin with @, much like LaTeX’s back­slash. Finally, there is a com­mand to end the document.

This text file is processed by lout to gen­er­ate the type­set doc­u­ment. By default, lout cre­ates a Post­Script file and sends it to std­out, though you can redi­rect it into a file, or send it directly to a printer:

lout my-document.lout > my-document.ps

With ghost­script installed, you can pass the result to ps2pdf to cre­ate a PDF instead:

lout my-document.lout | ps2pdf - my-document.pdf

I’ve mainly been test­ing with sim­ple doc­u­ments, but it seems to do its work very fast, and gen­er­ates far less “noise” on the command-line com­pared to LaTeX.

Here is a sam­ple lout file:

@SysInclude { doc }
@SysInclude { eq }
@SysInclude { graph }
@Document 
    @InitialSpace { tex }
    @InitialFont { Palatino Base 12p }
@Text @Begin
@Display @Heading { Sample Lout Document }
@PP
This is a sample paragraph. It is really just intended as filler, not as anything special. I should probably put in things like ``scare quotes'', and shouldn't avoid things like apostrophes so everyone can get a better sense of how things look. Maybe a sentence with a lot of different letters? How about: grumpy wizards make toxic brew for the evil Queen and Jack. I stole that from Google web fonts.@FootNote { You've heard of Google right? } What do you think?

@PP
Here is a new paragraph. Let's add words in @B bold and @I italics, shall we? How about @S { Small Caps }? We can even do a @ShadowBox { Shadow Box } if we like.

@QuotedDisplay {
This is a sample paragraph in a quotation display. It is really just intended as filler, not as anything special. I should probably put in things like ``scare quotes'', and shouldn't avoid things like apostrophes so everyone can get a better sense of how things look. Maybe a sentence with a lot of different letters? How about: grumpy wizards make toxic brew for the evil Queen and Jack. I stole that from Google web fonts. What do you think?
}

@Heading { A Numbered List }
@NumberedList
    @ListItem One
    @ListItem Two
@EndList

@Heading { Displayed Mathematics }
@Display @Eq { T(n) = big sum from i=0 to n-1 2 sup i = 2 sup n - 1}

@LeftDisplay @Heading { A Sample Graph }
@Graph
abovecaption { New South Wales road deaths
(per 100 million vehicle km) }
{
@Data points { plus } pairs { dashed }
{ 1963 5.6 1971 4.3 1976 3.7 1979 3.4
1982 2.9 1985 2.3 1988 2.0 }
}

@End @Text

The gen­er­ated out­put looks like this:

sample lout doc

The first three lines load spe­cific libraries and com­mands. As you can see, there are spe­cial libraries for type­set­ting equa­tions and com­plex math­e­mat­ics, as well as for mak­ing graphs and fig­ures. The next four lines rep­re­sent the rest of the “pre­am­ble”; here I do lit­tle more that set spac­ing to emu­late TeX in putting extra space between sen­tences, as well set the base font to Palatino. (The default oth­er­wise is Times.)

Lout’s para­graph lay­out algo­rithm is based on TeX’s, and so should gen­er­ate typo­graph­i­cally pleas­ing results in most cases. It has a built in func­tional pro­gram­ming lan­guage, and so is highly exten­si­ble in all sorts of ways. It has built in mech­a­nisms for lists, foot­notes, cita­tions, and most other rou­tine tasks you’d expect.

I can think of the fol­low­ing advan­tages for learn­ing Lout:

  1. It’s light­weight! You could carry it around on a floppy disk, and the typ­i­cal instal­la­tion is less than 1% of a medium sized (La)TeX instal­la­tion. That’s neat.
  2. It’s fast! Type­set­ting a small doc­u­ment at least seems to take less time than it does with LaTeX.
  3. It can be extended easily.
  4. It’s free and open source, and can be used with any text edi­tor. (I was pleased to dis­cover that vim has syn­tax high­light­ing for Lout!)
  5. There are far fewer exter­nal pack­ages to remem­ber the ins and outs of, and main­tain­ing a Lout sys­tem is far eas­ier than main­tain­ing a TeX system.
  6. A sin­gle com­pre­hen­sive user’s guide is avail­able: here.
  7. It’s fun to learn some­thing new.

But that’s not to say there aren’t sig­nif­i­cant disadvantages.

  1. It’s not widely used, so you have trou­ble shar­ing with col­leagues, and an impos­si­ble time sub­mit­ting to journals.
  2. You’re far less likely to find pre-made bib­li­og­ra­phy styles or tem­plates for var­i­ous jour­nals or publishers.
  3. You won’t be able to make use of the many spe­cific and pow­er­ful pack­ages that have been cre­ated for the (La)TeX ecosystem.
  4. Con­ver­sion tools and other spe­cial­ized soft­ware is harder to find.
  5. The com­mu­nity of users with exper­tise you can drawn on is much smaller.
  6. Some­times it’s not so fun to (have to) learn some­thing new.

That said, I’ve really only begun scratch­ing the sur­face of learn­ing Lout, and am by no means an expert. I wel­come your feed­back. For expe­ri­enced users, what have you found to like or dis­like about it? For inex­pe­ri­enced users, what are your first impressions?

Posted Tuesday, October 25th, 2011 under Linux, Mac, open source, text editors, Uncategorized.

13 comments

  1. I can’t help but draw com­par­i­son with Con­TeXt (based on TeX, now users Lua­TeX as the pri­mary engine). Most of you points also true for Con­TeXt, except for 1, 2, and 6. (OK, that makes it almost half of your pos­i­tive points .…)

    The full instal­la­tion of Con­TeXt is around 220MB, and that will not fit any floppy, but eas­ily fit any USB drive. (Almost half of the space is used by fonts, so in, prin­ci­ple, you can come up with a smaller sys­tem). I don’t know how fair it is to com­pare the sizes of only the bina­ries. On my sys­tem, pdf­tex is around 1.3MB, the lua­tex binary is around 4MB.… It is the fonts, the link­ing pro­grams (bib­tex, makeidx, etc) and the macro pack­age that take most of the space.

    Con­TeXt in gen­eral is slower than LaTeX, but its doc­u­men­ta­tion is spread across mul­ti­ple man­u­als. (Most users switch­ing from LaTeX find Con­TeXt doc­u­men­ta­tion to be chaotic, YMMV).

    So, if you like to try out some­thing new, you could also try ConTeXt.

  2. Denis J. Navas says:

    I had the same pur­pose with Lout, but have not been able to put it to work. The instruc­tions aren’t clear on how could be used on Win­dows XP.

    Will be inter­est­ing if you can share, how you get a work­ing installation.

    Sin­cerely,

    • Denis. sorry, I use Linux, and just installed the pack­age from my pack­age repo. No clue how to make it work on Win­dows. Maybe some­one else will post instructions.

  3. Denis J. Navas says:

    Thanks.

    I hope some­one could have a clue.

  4. Kevin, This looks pretty cool. Thanks! I know you said you only did small doc­u­ments, but any guesses about how it would feel to write a 5K word phi­los­o­phy paper using Lout?

    Also, have you tried any of the other alter­na­tives like asci­idoc or Doc­Book or ReStruc­tured Text? I won­der how they com­pare to Lout and LaTeX.

  5. As we both noted, I haven’t done it, but my guess would be that it would be about as easy as writ­ing one in LaTeX. Of course, writ­ing that first one in LaTeX is much harder than the next one, and so on, and I’m sure the same is true for lout.

    I was inter­ested in lout because it is actu­ally type­set­ting soft­ware. I’m not too famil­iar with the oth­ers you men­tion, but I think they’re for­mats, not lay­out sys­tems, and the result you get would depend on what soft­ware you processed or viewed them with. Indeed, if I’m not mis­taken, asci­idoc has a LaTeX back­end for cre­at­ing PDFs, and an XML back­end for other out­put for­mats, putting another level of con­ver­sion in between you and your final prod­uct, which to me (as a con­trol freak), defeats part of the pur­pose of mark-ing up doc­u­ments myself.

    • That makes per­fect sense. I didn’t rec­og­nize the dif­fer­ence between markup and type­set­ting lan­guages until you pointed it out. Now it is obvi­ous! :) Thanks.

  6. Miroslav (=myname is PeaceCelebrator in English transcript) says:

    Hello Kevin, thank you for your descrip­tion and opin­ion about Lout. I found lout a cou­ple days before and now I have the same expe­ri­ences: Lout the best tool for non pro­gram­mers, for com­mon peo­ple who don’t afraid to type one com­mand line into the ter­mi­nal win­dow. I have some expe­ri­ences with TEX/Latex (dos, Win­dows) but this is space shut­tle tech­nol­ogy for me who write smthing only one day per month. Last year I wrote a hun­dred pages book for my chil­dren. Typ­ing text took 50 hours. Set­ting and tex make­up­ing approx 100 hour. Horrible.hufff.

    Shortly about Lout and con­fir­ma­tion your worlds: + very small and sim­ple + open. You can mod­ify inside lout any­thing, add fonts and so on + qual­ity ps and pdf cre­ation (I’m using ps export and than ghost­script because needs of embed­ding fonts) + sup­port for other lan­guages (czech :-) + its like a TEX engine, e.g. qual­ity in the details of type­set­ting – prob­a­bly so com­plex for novices because user’s guide is too heavy for the lunch read­ing. I think about 12pgs pub­li­ca­tion “Lout in one day”. It will be fine. (Its chal­lenge to wrote it now, isnt it?) – graph­ics sup­port: the “inline” graph­ics func­tion can be use­less and com­pli­cated for use. I pre­fer exter­nal graph/picture pro­gram. Maybe the bet­ter sup­port for incln gif/tif pic­tures will be use­full. not only ps . Nice day for all typists!

  7. Glad to read that peo­ple are actively using Lout, try­ing it, dis­cov­er­ing it. I’ve been a long-time user. It’s been great for any short one-off papers or other things of per­sonal use or for which all I need is a PDF to send or upload. Some­times when I’m at a book­store brows­ing, I’m impressed to read in the pref­ace or colophon that the author used Lout.

    But yeah, it is not well known in the aca­d­e­mic pub­lish­ing world, and there’s prac­ti­cally nowhere to pub­lish a paper writ­ten using Lout. A book, being com­plete pub­lish­able prod­uct in itself, seems to be prac­ti­cal, but a paper that’s going to be gath­ered into a bunch of oth­ers to become a phys­i­cal prod­uct, will still have to be LaTeX. But someday…?

  8. @Denis J Navas:

    Denis, I have had sucess with lout on WinXP. Get the binary from source­forge. Go here: http://​source​forge​.net/​p​r​o​j​e​c​t​s​/​l​o​ut/ and read my note about cre­at­ing a cou­ple of fold­ers that the binary install seems to fail to cre­ate in winXP. You can use it from the stan­dard win­dows con­sole, but I just hap­pened to have recently installed git which comes with git-bash, and that makes it a lot more fun to work with — a great shell for winXP.

    You’ll want gs9.04 (or what­ever is lat­est) installed, as well as ghostview. Here’s why: You’ll be tempted to do … lout –PDF my.lout > my.pdf but while this works for most things, the direct to pdf route often qui­etly drops some out­put — you will think that lout does not work as adver­tised in the excel­lent man­u­als, but it does. Do this instead … lout my.lout > my​.ps. Then do ps2pdf my​.ps to get my.pdf, with per­fect and com­plete output.

    You have to set your paths for lout and gs9.04 (ghost­script), if mem­ory serves you need to set the path for both ‘bin’ and ‘library’ for gs9.04.

    One last thing. When you want to change paper size in lout, it’s easy and the man­ual spells it out very clearly. But when you con­vert your .ps to .pdf via ps2pdf, it’s a some­what ver­bose command.

    Sup­pose you had already changed the paper size in lout from ‘let­ter’ to ‘A5’. Lout han­dles this seam­lessly. But if you use ps2pdf on this file, it will indeed con­vert it to pdf, but in ‘let­ter’, or ‘A4’, or what­ever your default page size is.

    Here’s how you do it on winXP, the only diff from linux/unix is that the equal signs ‘=’ get replaced by pound, or hash signs ‘#’. This appar­ently has to do with the com­piler that was used to com­pile the win­dows binary. So do this to con­vert my​.ps:

    C:\Documents and Settings\myself\My Documents\loutish> ps2pdf –dDEVICEWIDTHPOINTS#420 –dDEVICEHEIGHTPOINTS#595 my​.ps

    Note the pound signs, i.e. #‘s. What would I do with­out the inter­net? Don’t know if I ever would have fig­ured this out. Likely not.

    The 420 and 595 are just the A5 dims expressed in points.

    see this site for more on this quirk: http://​www​.rhinocerus​.net/​f​o​r​u​m​/​l​a​n​g​-​p​o​s​t​s​c​r​i​p​t​/​6​8​3​3​1​7​-​p​s​2​p​d​f​-​p​a​p​e​r​-​s​i​z​e​.​h​tml

    One more thing. Jef­frey Kingston has writ­ten the best man­u­als that I’ve ever encoun­tered for a free (gpl) pro­gram. The man’s writ­ing is astound­ingly clear, and typos are non-existent. He is very hon­est about lout’s short­com­ings — and they are few. Don’t be afraid of the ‘expert’ man­ual, either. I’m not remotely an expert and yet I’ve found that when some built-in doesn’t do exactly what you want, lout allows you to very sim­ply and reli­ably put any text or graphic any where you want on a page. Can’t say enough good things about lout. Sin­cere thanks to Mr. Kingston.

    frinty

    ps add @operamail daught com to my name on the line above if you need more info

  9. In a pre­vi­ous intent I barely made it work. I will fol­low your instruc­tions. Its par­tic­u­larly rel­e­vant what you learned about the use of the ‘#’ instead of ‘=’.

    Nor­mally I use bat file to sta­b­lish the envi­ron­ment vari­ables. That’s how I get it work­ing, but not 100% correct.

    A great THANKS to your iniciative.

    God bless you,

    Denis J. Navas

  10. Frint says:

    @ Denis J Navas,

    I’ll be work­ing with lout (again) tonight and it func­tions flaw­lessly on winXP.

    the binary I used is here: http://​source​forge​.net/​p​r​o​j​e​c​t​s​/​l​o​u​t​/​f​i​l​e​s​/​l​o​u​t​-​w​i​n​3​2​/​l​o​u​t​-​3​.​3​8​-​w​i​n​3​2​-​2​0​0​9​1​0​27/

    While I no longer remem­ber the instal­la­tion process, I vividly remem­ber try­ing end­lessly to get the thing to work. In the end, it was sim­ple — my lout folder was under c:\Program files\. THAT DID NOT AND WILL NOT WORK with the binary. I don’t know if that was my mis­take, or a mis­take in the pack­ag­ing — it’s been a while.

    The lout folder should be directly under C:\, i.e. c:\lout\

    Your bin\ and lout.lib\ fold­ers will of course reside in said lout folder.

    I had to move some stuff around man­u­ally, but I was very pleased with the results.

    I use lout fre­quently. I am just a duf­fer (not a com­puter expert). Only a few lan­guages seem to work the way my brain does, among them awk, python, and lout. I am a neo­phyte in all of them yet find them very use­ful. Good luck with lout.

    Using a unix like shell such as git-bash (comes with git) or unxu­tils (search source­forge) makes using lout bet­ter expe­ri­ence than the win­dows con­sole (com​mand​.com or what­ever it’s called).

  11. Frint says:

    @Denis J. Navas

    One last thing. You can set path all day long to no avail. The lout binary has been com­piled to look for lout in c:\lout\

    Set­ting your path cor­rectly is impor­tant, but lout must be in c:lout\

    If you don’t want it there you will have to com­pile it from source after direct­ing it to do so where you want. Ugh! Com­pil­ing is fun on linux, but I’m lost on Windows.

    Brent

Leave a Reply