Debian Codegraph @

texmf-dist/doc/latex/textpos/examples/t11.tex

raw
1 %%% Testing: textblock in horizontal mode
2 %
3 % In textpos up to 1.9.1, a textblock in horizontal mode, with the
4 % [absolute] option, worked, in the sense of not failing, but produced
5 % ugly spacing, because in generating a `\par` it messed up
6 % inter-paragraph spacing. This had the result that the text either
7 % side of the textblock appeared as separate paragraphs with no space
8 % between them. The appearance in [relative] mode was OK, but with
9 % the `\par` visible. This isn't a _bug_, since the documentation
10 % didn't say anything other than that a `\par` is inserted at this
11 % point, but it's not pretty.
12
13 \documentclass{article}
14
15 \parindent=0pt
16 \baselineskip=12pt
17
18 \usepackage[absolute]{textpos}
19 \usepackage{color}
20
21 \definecolor{Blue}{rgb}{0.9,0.9,1.0}
22 \definecolor{Red}{rgb}{1.0,0.5,0.5}
23 \textblockcolour{Blue}
24
25 % Make the textblock contents, and size, stand out
26 \def\content#1{\noindent
27 \textcolor{Red}{\hbox to 1em{%
28 \vrule height 9pt depth 3pt width 2pt %12 pt total
29 \hss
30 \vrule width 2pt }\relax
31 #1}}
32
33 \begin{document}
34
35 \TPoptions{absolute=false}
36
37 Line 1. Line 1a. % no descenders on this line
38 % The sentence space between these should be the same as between these
39 % and 1bis
40 \begin{textblock}{5}(0,0)
41 \content{Relative, hmode}
42 \end{textblock}
43 Line \smash{1bis, preceded by sentence space}. % \smash, to ensure line has zero depth
44
45 Line 2 should be the usual baseline from 1.
46
47 \vskip 1cm
48
49 Line 3.
50
51 \begin{textblock}{5}(0,0)
52 \content{Relative, vmode}
53 \end{textblock}
54
55 Line 4.
56
57 Line 5 should be separated from line 4 by the same baseline as 4 from~3.
58
59 Line 6. Line 6a.
60 \begin{textblock*}{10cm}(0mm,0mm)
61 \content{Relative, hmode, star.}
62 \end{textblock*}
63 Line \smash{6bis, preceded by sentence space.}
64
65 Line 7. With second sentence.
66
67 \begin{textblock*}{10cm}(0mm,0mm)
68 \content{Relative, vmode, star.}
69 \end{textblock*}
70
71 Line 8 should be separated from 7 by the usual baseline.
72
73 \newpage
74 \TPoptions{absolute=true}
75
76 Line 9. Line 9a.
77 \begin{textblock}{5}(0,0)
78 \content{Absolute 1}
79 \end{textblock}
80 Line 9bis, preceded by sentence space. % the smash doesn't matter in absolute mode
81
82 Line 10.
83
84 \begin{textblock*}{5cm}(0mm,10mm)
85 \content{Absolute 2}
86 \end{textblock*}
87
88 Line 11 should be separated from 10 by the usual baseline.
89
90 \end{document}