Best Practice 30.17.1. Only Edit LaTeX Files Rarely.
We want to stress that the LaTeX file created by various conversions is meant to be an intermediate format. In other words, it is ephemeral. We try to make it clean and organized, but it is not the LaTeX a human would write. You might be able to recycle a paragraph or two in other documents you create without PreTeXt. But it is not meant to be stable or archival, and no long-term use is supported in any way. In other words, it is not a supported output format, beyond compiling to a PDF without errors.
Because of that, you may find it necessary to manually adjust a file to control widows or orphans, or maybe the placement of a graphics file, or similar adjustments. Some of the most the common adjustments used by PreTeXt authors are inserting
\newpage
, \noindent
, or \par
to avoid awkward transitions, or to remove an occasional \leavevmode
; consult a good LaTeX reference before making such changes, as effects later in the output may be unpredictable.We view this as the final step before making a new edition, which might be a PDF that you submit to a print-on-demand service (Chapter 43). So hand-editing might be an annual exercise, at the most frequent. One way to keep track of larger number of edits over long periods of time is to write a script (in an appropriate language), which looks for unique strings before or after trouble spots and replaces the nearby content. Another minimally invasive option is to keep a separate git branch of the LaTeX file which makes the desired changes, which can then be applied on those rare occasions it is necessary (ideally, with little rebasing needed).