0

I've been looking around but I don't really know what to search for. How do you usually write a LaTeX document so that anyone else reading it won't have such a hard time?

I've been indenting and aligning to make the code more readable to me, but the moment I resize the window it all goes to hell. For instance:

\begin{itemize}
    \item This is a long sentence that's going to
          break to the next line.
\end{itemize}

Personally, I think that's easy to read, but if I gave the tex file to someone and they opened it in full screen the alignment would be way off. Should I stick to left justification and just be sure to use plenty of white space and comments? Something like:

\begin{itemize}

% Item 1
\item This is a long sentence that's going to
break to the next line

\end{itemize}

One last question (sorry!) should I stick to the 80-100 character limit that's common practice in programming languages? or just let it run to the end of the line of whatever window size I am using?

Thanks for taking the time to read this and thanks for any answers I get!

  • 2
    IMO, if you're using a line-based diff/version control system, its best to put a whole sentence on one line, regardless of the number of characters. Then you can easily see when you made a change in a given sentence :-) – darthbith Oct 29 '14 at 22:42
  • 2
    why does the alignment change if you make the window bigger, you can just have an newline after to it should linebreak there whatever. You can of course have it all on one line and just let the editor wrap the line as suggested in the comment above, but then there is no alignment anyway. either way don't manually indent and space just let your editor format it or use something like latexindent – David Carlisle Oct 29 '14 at 22:47
  • It changes because like you said I am manually indenting. The moment I change the window size the indentation gets messed up. – steveclark Oct 30 '14 at 1:15
  • Personally, I stick to whatever form I feel comfortable with if I am the primary author. Obviously different people will have different ideas on how to write tex documents. But I would definitely not break a line manually in the tex file. Either I'd use the editors line wrap or have it be in a single line. – Markus Oct 30 '14 at 8:15
  • @steveclark but if you are manually indenting you should put a newline in the source so it stays there, it doesn't make sense to "indent" just by adding spaces. – David Carlisle Oct 30 '14 at 10:07

Your Answer

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

Browse other questions tagged or ask your own question.