xiaofei@ACSU.BUFFALO.EDU (05/17/91)
I am sorry for the duplicate post. I was impatient in waiting INFO-TEX to
port the post to comp.text.tex. Here is the question about \parskip:
/* NABTEXM@TAMZEUS.BITNET wrote with my editing: */:
\parskip=xmm\parindent=xxpt
% ^ ^^
1st paragraph
\par % make sure this paragraph is closed before changing
% \parskip. A \par or vertical glue is sufficient.
% This code will not work as it suggests.
% What do you think the vspace here should be ?
% I think the vspace here is x mm, but TeX thinks it y mm.
% any one understand TeX's mind?
{\parskip=ymm\parindent=yypt
% ^ ^^
2nd paragraph
}
3rd paragraph
......
--
xiaofei@acsu.buffalo.edu / rutgers!ub!xiaofei / v118raqa@ubvms.bitnet
XITIJSCH@DDATHD21.BITNET (05/18/91)
xiaofei@ACSU.BUFFALO.EDU wrote: > I am sorry for the duplicate post. I was impatient in waiting INFO-TEX to > port the post to comp.text.tex. Here is the question about \parskip: > > /* NABTEXM@TAMZEUS.BITNET wrote with my editing: */: > \parskip=xmm\parindent=xxpt > % ^ ^^ > > 1st paragraph > \par % make sure this paragraph is closed before changing > % \parskip. A \par or vertical glue is sufficient. > > % This code will not work as it suggests. > % What do you think the vspace here should be ? > % I think the vspace here is x mm, but TeX thinks it y mm. > % any one understand TeX's mind? > > {\parskip=ymm\parindent=yypt > % ^ ^^ > > 2nd paragraph > } > > 3rd paragraph TeXbook, Chapter 14, p. 104: ``Just before switching to horizontal mode to begin scanning a paragraph, TeX inserts the glue specified by \parskip into the vertical list that will contain the paragraph, unless that vertical list is empty so far.'' I.e., a \parskip assignment changes the vertical glue *before* the *next* paragraph. So your 2nd paragraph has y mm in front. At the closing brace the old \parskip value is restored again, so the 3rd paragraph has x mm in front -- that's it. This way to do it is necessary: One may want to change the \parskip value before a new paragraph is started and the last change should take effect! BTW, the precise definition is given on pages 282 and 283 in the TeXbook (end of chapter 24). If a <horizontal command> is seen in vertical mode, ``TeX automatically performs an \indent command''. And the description of \indent states: ``The \parskip glue is appended to the current list, [...] Then TeX enters unrestricted horizontal mode, starting the horizontal list with an empty hbox whose width is \parindent.'' (So barbara was wrong ;-), the \parindent is used at the start of the paragraph. While I'm at it, just two hints to the above (and the original) TeX input: 1. If you want to change parameters of TeX which affects the line breaking, you should insert an empty line in front of the closing brace. (Better, use \begingroup and \endgroup -- it's more readable, and it's likely you will have to change this text :-) A lot of parameters (e.g., \hangindent) are looked at at the end of a paragraph -- and this would be outside the group! So, if you -- in the above example -- would assign some value to \hangindent within the group you would see no result at all! 2. The above order of specifying \parskip and \parindent is better than the original one. And the original one was unsafe. Why? -- \parindent is a dimension register. So the assignment is completed at the beginning of the next line. -- \parskip is a glue register. So the assignment scans ahead for the keywords `plus' or `minus'. I.e., take the input: \begingroup \parindent=1em \parskip=1ex plus value. \endgroup You will get an error at the letter `v'. So it's better to write it as \begingroup \parindent=1em \parskip=1ex plus value. \endgroup as an empty line (i.e., a \par) completes the assignment. Besides, it's better readable. -- Joachim =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Joachim Schrod Email: xitijsch@ddathd21.bitnet Computer Science Department Technical University of Darmstadt, Germany