Friday, February 4, 2011

Dominant paradigms

LaTeX does two main things for me. It produces fantastically typeset and beautiful documents but, perhaps more importantly, it helps me write a consistent, logical structure into my documents from the start. I'm not a natural writer and I can get REALLY lost in my own thought processes. Trying to sit down at the keyboard and just write a document will result in logical and grammatical diarrhea which will take awhile to sort out, reorganize and turn into something useful.

The tools and techniques I use are available in WYSIWYG document software but you'll find them discussed in the last chapter of the manual with a title something like "Things less than 1% of you might use (but only if you are in professional publishing)". They are available but, they're far from the dominant paradigm. If they try to use it at all, most people end up jury-rigging this kind of functionality instead of using what the software offers and then end up with a nightmare. LaTeX gives you simple hooks to build your document off of and they're one of the first things you learn about.

When I write something I pretty much always follow these steps (and this goes equally for papers, articles, posters and Beamer presentations.):
  1. Document setup: write preamble text, \usepackage for packages I know will be necessary (math, graphics, etc), and \begin{document} \end{document}
  2. Now lay out the high level logical structure by putting in \section{} tags. This might be as simple as
    \section{Introduction}
    \section{Background}
    \section{.....}
    \section{Conclusions}
    I'll often also include commands or comments to note where titlepage, table of content, bibliography, etc. commands will go.

  3. Now lay out more refined levels of logical structure with \subsection{} and \subsubsection{} (Leslie Lamport wrote LaTeX to only go to subsubsection level for good layout reasons. You can define lower levels but it's often not worth it. When I need another level I use \subsubsection*{} to get an unnumbered subsubsection). This gets you to a a deeper structure like
    \section{Cloud Droplet Retrieval}
    %Break down relevant instruments that do retrievals
    \subsection{MODIS}
    \subsubsection{Technique}
    %Radiance retrieval a la Nakajima-King
    \subsubsection{Assumptions}
    \subsection{POLDER}
    \subsubsection{Technique}
    %Fits to Mie simulation
    ...etc
  4. Note that in building this structure I haven't written any of the document. I'll include notes about the final level of structure but I try to avoid actually writing any of it. The notes can be done as in-line comments like above, as live text or within a comment environment. Each method can have its place.

    I don't write much here because I find that once I have something written as a sentence or as paragraphs, I become very reluctant to alter it significantly. Maybe I'm too attached to supposed cleverness but, I tend to move sentences around and then morph grammar rather than do the right thing; delete them and move on. Better to not have them there in the first place.
  5. Once this logical structure has settled (or is mostly settled), I start to flesh out the body of the text. You can do this by simply expanding on the comments you've left behind but often I will do this by writing each section in a separate document and using \input{} lines to bring them into the main document. This keeps the logical structure of the document clean, easy to read and easy to edit around my actual text. Doing it this way can lead to headaches when you try to do labels and references for figures, tables, though, so experiment and see what works best for you. LaTeX can handle the separate files well but it can be a pain to the carbon wetware moving around in multiple files trying figure out what goes where.
  6. Clean up anything in the actual typesetting that LaTeX doesn't do quite the way you want (LaTeX is built to be smart about typesetting but sometimes I feel a need to do things my way)
Add an underlayer of coherent, useful directory structure and you can end up with a consistent, simple process for writing even long-winded tripe like a dissertation.

It's all about process. A good, consistent process will do wonders and LaTeX makes it easy to build a good process.

Wednesday, February 2, 2011

Introductory tip

Well, this sort of started as a joke but, here I am starting with my first LaTeX tip of the day. Names notwithstanding, I don't intend to hold myself to a guaranteed tip per day. I do have a few other things to do but, as time permits, I will put down in text any little hints that I have for producing documents using LaTeX. I've used LaTeX for a long time (and TeX and nroff/troff before that) and used them all long before ever seeing Word or OpenOffice so to me it's not really a question of superiority of one over the other. I do happen to think LaTeX is superior in all ways but what's most important is that LaTeX has helped me to develop a process for document preparation that focuses on the document logic and structure first instead of trying to shoehorn it in later. Sure you can do this with any system but, I think LaTeX and UNIX just make it easier and more natural.

Today's tip is simple just to get things started. If you haven't been there already, I suggest you check out two places online: CTAN and wikibooks.

CTAN is the Comprehensive TeX Archive Network. All things TeX and LaTeX can be found there. All packages, documentation related software, etc. usually end up here.

Wikibooks LaTeX is a great resource and reference for learning how to use LaTeX. I used to store and print out all the package manual pdfs (still have them in my file cabinet) for reference but lately I head to wikibooks first and see if that provides a solution to my problem. if I need to go deeper, I start reading up on the appropriate package.