fix defaults for x any y (to be strings)
[PyX.git] / examples / text / valign.txt
blob1c90db44f0143a3d7feb5f59a1e7453396df72e3
1 Vertical alignment
3 The example demonstrates the effect of several text attributes for vertical
4 alignment.
6 In the first line of the output, the extent of the whole text box is taken into
7 account by various versions of valign. While in this case, the valign attributes
8 are combined with a parbox each, the valign technique also perfectly works for
9 single line text. ...
11 In contrast, in the second line of the output a parbox is shown with different
12 values for the baseline. Note that by default, text is vertically aligned at
13 its baseline, that is, the line the letters are typed upon. For a parbox
14 containing several lines, there are several choices. PyX allows you to use the
15 top-most baseline (which is, by the way, the default when skipping the baseline
16 keyword argument of the parbox completely), and the bottom-most baseline in
17 your paragraph. Additionally you can also use the position just in the middle
18 of these two cases. Since the alignment along a baseline does not depend on the
19 size of the characters in your output, it is preferable to valign in most
20 use-cases.
22 In the last line of the output, the text.vshift is used to create some vertical
23 shift of the output corresponding to certain criteria. The universal case is
24 to use a certain fraction of a character height (or the height of any TeX
25 expression). For `vshift.topzero` the full height of the character `0` is used,
26 for `vshift.middlezero` half of the height of the character `0` is used and for
27 `vshift.bottomzero`, no shift will be done at all and the usual alignment at the
28 baseline will take place. Another interesting vertical shift value is the
29 `vshift.mathaxis`, which shifts the material by the height of the mathematical
30 axis. This axis is used by TeX to vertically align the mathematical operators
31 and the equal sign but also brackets and objects like the sum and integral
32 symbols. This shift typically is a little less in height as compared to
33 `vshift.middlezero` and fits well in various cases to visually center a single
34 line output in vertical direction. It is also useful to align text, although
35 the value of the shift is based on the configuration of the mathematical mode.
36 This means that the alignment might not be suitable for cases, where the
37 text mode of TeX was reconfigured without also adapting the math mode configuration.
39 ! Please don't get confused by the additional text.mathmode attribute in this
40 vshift example, which leads the text to be rendered in TeX's mathematical mode.
41 The `text.mathmode` attribute is by the way similar but not identical (due to the
42 use of `\displaystyle`) to encapsulating your expression in TeX's mathmode
43 delimiters `$`.