Debian Codegraph @

texmf-dist/doc/latex/typog/crooked-paragraphs.mp

raw
1 %%
2 %% This is file `crooked-paragraphs.mp',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% typog.dtx (with options: `crookedparagraphs')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2024, 2025 by Ch. L. Spiel
12 %%
13 %% This work may be distributed and/or modified under the conditions
14 %% of the LaTeX Project Public License, either version 1.3c of this
15 %% license or (at your option) any later version. The latest version
16 %% of this license is in
17 %% https://www.latex-project.org/lppl.txt
18 %% and version 1.3c or later is part of all distributions of LaTeX
19 %% version 2003/12/01 or later.
20 %%
21 %% This work has the LPPL maintenance status `maintained'.
22 %%
23 %% The Current Maintainer of this work is Ch. L. Spiel.
24 %%
25 %% This work consists of the files typog.dtx and typog.ins
26 %% and the derived files typog.sty, slant-angle.mp, invertedmarks.mp,
27 %% crooked-paragraphs.mp, smooth-parshapes.mp, title.mp,
28 %% typog-example.tex, typog-minimal-test.tex,
29 %% typog-without-microtype-test.tex
30 %% typog-grep.pl.in, typog-grep.pl,
31 %% typog-grep.pod, and teximan2latex.sed.
32 %%
33 %%
34 prologues := 3;
35
36 def draw_filled_rectangle(expr lower_left, upper_right, color) =
37 fill lower_left -- (xpart upper_right, ypart lower_left) --
38 upper_right -- (xpart lower_left, ypart upper_right) --
39 cycle
40 withcolor color;
41 enddef;
42
43 u := 100;
44
45 em := 10;
46 linelength := 2u;
47 baselineskip := 1.2em;
48 parskip := 3;
49 parindent := 2.5em;
50
51 cmykcolor line_color;
52 line_color := (.08, 0, 0, .18); % cold silver
53
54 color customred[];
55 customred[1] := (.890, .282, .282);
56 customred[2] := (.831, .110, .110);
57 customred[3] := (.686, .043, .043);
58 customred[4] := (.569, .000, .000);
59 customred[5] := (.420, .000, .000);
60
61 color margin_color;
62 margin_color := customred[2];
63
64 beginfig(1); % short line -- gap
65 y := 0;
66 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
67 y := y - baselineskip;
68 draw_filled_rectangle((0, y), (1.1em, y + 1em), line_color);
69 y := y - baselineskip;
70 draw_filled_rectangle((parindent, y), (linelength, y + 1em), line_color);
71 y := y - baselineskip;
72 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
73
74 draw_filled_rectangle((-.667em, 1em), (-.333em, -3baselineskip), margin_color);
75 draw_filled_rectangle((linelength + .333em, 1em), (linelength + .667em, -3baselineskip), margin_color);
76 endfig;
77
78 beginfig(2); % short line -- covered
79 y := 0;
80 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
81 y := y - baselineskip;
82 draw_filled_rectangle((0, y), (2parindent, y + 1em), line_color);
83 y := y - baselineskip;
84 draw_filled_rectangle((parindent, y), (linelength, y + 1em), line_color);
85 y := y - baselineskip;
86 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
87
88 draw_filled_rectangle((-.667em, 1em), (-.333em, -3baselineskip), margin_color);
89 draw_filled_rectangle((linelength + .333em, 1em), (linelength + .667em, -3baselineskip), margin_color);
90 endfig;
91
92 beginfig(3); % completely filled line -- no clear paragraph break
93 y := 0;
94 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
95 y := y - baselineskip;
96 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
97 y := y - baselineskip - parskip;
98 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
99 y := y - baselineskip;
100 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
101
102 draw_filled_rectangle((-.667em, 1em), (-.333em, -3baselineskip - parskip), margin_color);
103 draw_filled_rectangle((linelength + .333em, 1em), (linelength + .667em, -3baselineskip - parskip),
104 margin_color);
105 endfig;
106
107 beginfig(4); % completely filled line -- opened right margin
108 y := 0;
109 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
110 y := y - baselineskip;
111 draw_filled_rectangle((0, y), (linelength - parindent, y + 1em), line_color);
112 y := y - baselineskip - parskip;
113 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
114 y := y - baselineskip;
115 draw_filled_rectangle((0, y), (linelength, y + 1em), line_color);
116
117 draw_filled_rectangle((-.667em, 1em), (-.333em, -3baselineskip - parskip), margin_color);
118 draw_filled_rectangle((linelength + .333em, 1em), (linelength + .667em, -3baselineskip - parskip),
119 margin_color);
120 endfig;
121 end