I'm getting my head around LaTeX, and I find really awesome the fact that the documents are completely editable with a plain text editor, while getting a really neat and professional output.

I'm learning also a lot of concepts about typography, like how the spacing and the number of character per row have an effect on readability.

But what I wonder is: there is a set of guidelines/themes to format better the code for readability? I'm not referring to indentation or code cleanliness, but about spacing and management of long paragraphs.

Maybe I'm not aware of that, but I find strange that the author of a perfectly typesetted document has to read courier dense code.

  • 1
    I think I get your general point, but could you be a little more clear on what your actual question is? It seems to be something like "How to make LaTeX source code more pleasantly readable for myself". – doncherry Mar 4 '12 at 15:23
  • 1
    My LaTeX editor doesn't use monospaced text. Why bother when you can use tabs to do the alignment? Therefore I use a font I find comfortable reading. On top of that, soft-wrapping text means that the editor displays all text in the editor smartly. If you use diff or some kind of version control system, then perhaps hard wrapping text is a better idea (fixed line width), but most don't seem to bother these days. – qubyte Mar 4 '12 at 15:26
  • 4
    @clabacchio: As you say "you were guessing" -- your question seems to be more of a statement (-> rant) than a question. The only interrogative sentence is "does anybody cares about the readability of the LaTeX code?" and that's certainly not what you want to know. (In case it is, the answer is: Yes, Mark S. Everitt does ;)) – doncherry Mar 4 '12 at 15:37
  • 1
    @clabacchio: Why do you want to know that? What have you gained if you know that you are or aren't the only one? Don't you rather want to know what fonts/editors/whatever others recommend in order to make LaTeX source code more pleasantly readable? Whether or not you are the only one who writes LaTeX in a normal text environment is not of general interest and would render this question subject to closing as too localized. – doncherry Mar 4 '12 at 15:51
  • 1
    @doncherry Sorry for the misunderstanding, but mine was an indirect question for exactly the same you are saying; and I find Tobi's answer really useful...I'm trying to rewrite the question better – clabacchio Mar 4 '12 at 15:59

I’m using Consolas as font because I don’t like Courier. Furthermore I insert manual linebreaks at about 70 characters. One can think about using a proportional serif font but I need a monospace font to keep the readability of my definitions.

As Mark said in his comment above most editors can soft-wrap the lines. I prefer hard line warping because I like it ;-) … and if LaTeX gives me error messages its easier to find the error in a line with 70 character instead a line with ∞ characters that is soft-wrapped by my editor.

Here is how it looks in my editor:

my editor

That is ok for reading short sentences and creating content. I do my proofreading nearly always in the printed document, or at least in the PDF output but never in the source. If I want to read longer parts of my work I also prefer the PDF.

  • 3
    This shows the 'subjective' part nicely - lots of other people also like Consolas in preference to Courier, whereas I find Consolas incredibly irritating as it does not 'look right' for code :-) – Joseph Wright Mar 4 '12 at 16:01
  • 3
    I know it's a typo but I like "hard line warping" :) – clemens Mar 4 '12 at 16:15
  • 3
    @ClintEastwood: I think that there are also serif fonts that are readable on screen – e.g. Georgia was designed explicitly to be read on the screen rather than in printed documents. My editor is TeXstudio on OS X 10.6 but it’s available for Windows and Linux too. I really like it because it’s highly configurable, which is very helpful e.g. when coding dtx files. Unfortunately sometimes it crashes :-( – Tobi Mar 4 '12 at 17:17
  • 7
    The decision about hard or soft wrapping lines interacts with what works best with version control systems like SVN or Git. There is a third option: enter hard newlines only at the end of a sentence to make diff tools work better. – Christian Lindig Mar 4 '12 at 18:28
  • 1
    I’m not using SVN or something like that so the more precise error messages (and the optic) is why I use hard warping ;-) – Tobi Mar 5 '12 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.