I just made a couple of changes to this theme's style sheet. I wanted a slightly wider page in order to accommodate longer lines of code. I needed it because some code lines in my Dummy variables post ran over when rendered in IE and Opera. If you cut and pasted the code, errant end-of-line characters could have crept in. Cutting and pasting code you find here is encouraged, by the way. It's supposed to be ready to use.
So, OK, you can widen the page, but should you? People read comfortably text that's about four inches wide, I would guess. Computers don't care, but code is meant to be read by people. The text you're reading used to sit in a box 540 pixels wide. The current width is 600 pixels. The difference was enough to make the problem go away. It would be nice to know that it's also not big enough to harm your reading convenience.
If you tell me that it is, I will revert to a narrower column, and start using all sorts of tricks to make Stata code fit inside it. Easiest, of course, would be to set
#delimit ; . Then you don't care about end-of-line characters, because Stata will ignore them. But what if you're like me and you prefer
You can use local macros as placeholders for whatever would otherwise result in long lines of code, as in
local 1 The quick brown fox
local 2 jumped over the lazy dog.
di "`1' `2'"
That's not too bad. I have used this workaround before, but now I'll make it an explicit policy: I will trade width for length in my code in future entries.
Maybe this should be a general standard of writing code. It might encourage diligent encapsulation. You don't want very long do-files, or at least you don't want very long programs, for all sorts of good reasons. So you already do spread large projects across multiple do-files, multiple programs or both, if you're really into that sort of thing. If you also force yourself to have short lines, your code will be all the better for it. What do you think?