Debian Codegraph @

texmf-dist/doc/pdftex/tests/38-interword-space-at-font-switch/test-plain.tex

raw
1 \input plain % Load Plain TeX macros
2 \font\tt=cmtt10 % Define a monospace font
3
4 % Title
5 \centerline{\bf Extended Plain TeX Testing Document}
6 \bigskip
7 \centerline{\it Test User}
8 \bigskip
9 \centerline{Date: \the\year-\the\month-\the\day}
10 \bigskip
11
12 % Table of Contents (simulated with simple text alignment)
13 \centerline{\bf Contents}
14 \vskip 10pt
15 \halign{\hskip 2em #\hfill & \hskip 1em #\hfil\cr
16 1. Introduction & \dotfill\ Page 2\cr
17 2. Text Formatting & \dotfill\ Page 2\cr
18 3. Mathematics & \dotfill\ Page 3\cr
19 4. Tables & \dotfill\ Page 3\cr
20 5. Figures & \dotfill\ Page 4\cr
21 6. Conclusion & \dotfill\ Page 5\cr
22 }
23 \eject
24
25 % ---------------------- SECTIONS BEGIN -------------------------
26
27 \section Introduction
28 This is an extended test file written in Plain TeX. The intention is to test fundamental typesetting capabilities like text formatting, math equations, tables, and figures in a lightweight and basic TeX environment.
29
30 \medskip
31
32 \section Text Formatting
33 You can apply different text styles:
34
35 \smallskip
36 {\bf Bold text}: Produced with {\tt\char`\\bf}. For example, {\bf This is bold text.}\\
37 {\it Italic text}: Produced with {\tt\char`\\it}. For example, {\it This is italic text.}\\
38 {\tt Monospaced text}: Produced with {\tt\char`\\tt}. For example, {\tt This is monospaced text.}\\
39
40 \medskip
41 \centerline{\bf Example of Aligning Text:}
42 \smallskip
43 \halign{#\hfill\quad&#\cr
44 Left-aligned text: & This text is aligned to the left.\cr
45 Center-aligned text: &\hfil This text is centered.\hfil\cr
46 Right-aligned text: &\hfil This text is aligned to the right.\cr}
47
48 \section Mathematics
49 Inline expressions: \( E = mc^2 \)\\
50 Displayed equations:
51 $$
52 \int_{a}^{b} x^2 \, dx = \frac{b^3}{3} - \frac{a^3}{3}
53 $$
54
55 You can also write matrices and arrays:
56 $$
57 \pmatrix{
58 a & b \cr
59 c & d \cr
60 }
61 $$
62
63 Mathematical operators look like this:
64 $$
65 \sum_{i=1}^n i = \frac{n(n+1)}{2}, \quad
66 \sqrt{x+y}, \quad
67 x^2 + y^2 = z^2
68 $$
69
70 \section Tables
71 Tables are implemented manually in Plain TeX. For example:
72
73 \smallskip
74 \hbox{\vbox{
75 \hrule
76 \halign{
77 \vrule#\quad & #\hfill\quad & \hfil#\quad\vrule\cr
78 \noalign{\hrule}
79 \bf Item & \bf Quantity & \bf Price (\$)\cr
80 \noalign{\hrule}
81 Apple & 5 & 3.50\cr
82 Orange & 3 & 2.25\cr
83 Banana & 6 & 4.10\cr
84 \noalign{\hrule}
85 }
86 \hrule
87 }}
88
89 \smallskip
90
91 For more advanced tables, use external tools or macros.
92
93 \section Figures
94 Including figures in Plain TeX requires external tools like `epsf` or `pdftex` for direct image embedding.
95
96 Here’s how you might include an image with a caption:
97
98 % \centerline{\hbox{\epsfbox{example-image.eps}}} \centerline{\it Figure 1: Example placeholder image.}
99
100 To test without images, you can use placeholders instead:
101 \medskip
102 \hbox to \hsize{\hfil \vrule height 2in width 3in \hfil}
103 \centerline{\it Placeholder for a figure.}
104
105 \section Conclusion
106 This Plain TeX test file demonstrates basic text formatting, math typesetting, tables, and figures. Unlike LaTeX, Plain TeX doesn’t include higher-level structures like environments, so everything is done manually or with custom macros.
107
108 % End of test document
109 \bye