kthompso@ptolemy.arc.nasa.gov (Kevin Thompson) (02/22/89)
[GNU Emacs Version 18.52] I do a lot of editing within tex-mode and LaTeX mode, and often have words that begin with a "\" in my paragraphs. If such words are at the beginning of lines, emacs seems not to respond properly to fill-paragraph; I end up having to delete the backslash, fill-paragraph, then re-insert the "\". This appears to *not* be a problem in some other modes. Does this problem reveal gross misunderstanding on my part, or is there something I can do? The variable paragraph-start gets reset in tex-mode.el, which I though promising, but the fill-paragraph doesn't appear to refer to it (cursory examination, I apologize). Kevin -- kthompso@ptolemy.arc.nasa.gov Sterling Software/Nasa-Ames Research Center
gildea@BBN.COM (Stephen Gildea) (02/23/89)
Date: 22 Feb 89 08:18:16 GMT From: Kevin Thompson <eos!ptolemy!kthompso@labrea.stanford.edu> I do a lot of editing within tex-mode and LaTeX mode, and often have words that begin with a "\" in my paragraphs. If such words are at the beginning of lines, emacs seems not to respond properly to fill-paragraph; ... This behavior is intentional. In the usual case where backslashes appear at the beginning of a line, they are not part of the paragraph and should not be filled into it. Often the backslash is part of a command that separates two paragraphs. Two examples: \subsection{Focal Mechanism of the Main Shocks} The focal mechanism of the second main shock ($m_b = 6.0$), shown in Figure 3, was determined from long-period arrivals at World-Wide Standard Seismographic network stations. Both {\em S\/} and {\em P\/} wave first motions were used; however, the solution is more strongly constrained by the {\em S\/} wave polarizations. The results are shown in Table 1.\marginboxed{Table 1} \item Design and implementation of software for real-time data acquisition. \item Device driver writing. \item Graphics library implementation. Since Emacs cannot easily decide whether a particular backslash is part of the paragraph text or not, it must treat them all the same. Since it is much more common for a "word" beginning with a backslash to *not* be text, Emacs assumes that is always the case. Looking at the first example above, we see that all uses of backslash that are within the paragraph do not start words (that is, are not preceded by whitespace). Of course, if the normal behavior of TeX mode isn't right for you, it is easy to change. Try the following in your .emacs file: (setq TeX-mode-hook '(lambda () (setq paragraph-start "^[ \t]*$\\|^[\f%]" ;don't look at backslash paragraph-separate paragraph-start))) < Stephen
sps@magoo.mcnc.org (Stephen P. Schaefer) (02/23/89)
If I remember my TeX correctly, you could keep the \'s of word entities (things that should be embedded in a paragraph, and not start it) from starting a line by surrounding the construct with a no-op pair of braces, e.g., {\my-abrev}. A nuisance, yes, but normally infrequent enough that the price is low in return for the ability to recognize paragraph beginnings. -- Stephen P. Schaefer, Postmaster MCNC sps@mcnc.org P.O. Box 12889 ...!mcnc!sps RTP, NC 27709
halvers@phecda.steinmetz (Pete Halverson) (02/23/89)
In article <SPS.89Feb23024621@magoo.mcnc.org> sps@magoo.mcnc.org (Stephen P. Schaefer) writes: > If I remember my TeX correctly, you could keep the \'s of word > entities (things that should be embedded in a paragraph, and not start > it) from starting a line by surrounding the construct with a no-op > pair of braces, e.g., {\my-abrev}. Almost. Note that braces define a dynamic scoping environment which might otherwise hide the effects of your command---something like {\bf} is thus effectively a no-op in TeX, and is probably not what the user wanted. A better way is to precede the "word" commands with an empty group, e.g. {}\my-abrev, which should be sufficient to placate the paragraph fill routines while preserving environment scope. > A nuisance, yes, but normally infrequent enough that the price is low > in return for the ability to recognize paragraph beginnings. Good point, though. Thanks for suggesting it. > Stephen P. Schaefer, Postmaster MCNC