11

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.

clabacchio
  • 1,887
  • 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 04 '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 04 '12 at 15:26
  • @doncherry I agree that it seems like that, but since it seems that 'pleasant' and 'readable' are not completely subjective but have a theory behind (like I've tried to explain), I was guessing if that applies also to the plain code. – clabacchio Mar 04 '12 at 15:27
  • 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 04 '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 04 '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 04 '12 at 15:59
  • Here's a nice list of fonts designed to be used in editors: http://slant.co/topics/67/~what-are-the-best-programming-fonts – matth Apr 29 '13 at 10:45

1 Answers1

12

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.

Tobi
  • 56,353
  • 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 04 '12 at 16:01
  • @JosephWright: What looks wrong with Consolas? – Tobi Mar 04 '12 at 16:03
  • 3
    I know it's a typo but I like "hard line warping" :) – cgnieder Mar 04 '12 at 16:15
  • @Tobi Maybe it is the humanist feel of the Consolas typeface. I don't like it much either – or at least, I would not use it for code, though it would look better than Courier if I needed to write monospaced text that isn't code. – ienissei Mar 04 '12 at 16:20
  • @ienissei: OK, thats why these answers are subjective ;-) Which font do you prefer for coding? – Tobi Mar 04 '12 at 16:55
  • what definitely helps is using a non serif-font when working on a computer screen. I don't know whether consolas and courier fall into that category from a psychological-readability-perspective, as it were, for they certainly share some serif characteristics. I think I am using Helvetica in my Editor but there is actually no reason why I am doing so. @Tobi: what editor are you using? – ClintEastwood Mar 04 '12 at 17:05
  • 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 04 '12 at 17:17
  • @Tobi That's definitely very subjective, indeed. I really like Andalé Mono and Menlo for code – just a bit fancier than good old Courier. And as far as TeX is concerned, I don't mind using proportional fonts either, like Helvetica. But I apart form that, I really like the fact that some foundries are trying to revive or create good-looking mono-fonts (i.e. with a personality and style of their own). – ienissei Mar 04 '12 at 17:48
  • 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 04 '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 05 '12 at 00:44