Debian Codegraph @

texmf-dist/doc/latex/scaletextbullet/scaletextbullet.tex

raw
1 \documentclass{beerydoc}
2
3
4 \RequirePackage { fontspec }
5 \newfontfamily \newfontfamilystixtwo { STIX Two Text }
6 \newfontfamily \newfontfamilysourceseriffour { Source Serif 4 }
7
8
9 \begin{document}
10
11
12 \section*{\stepfontsize{1}The \pkg{scaletextbullet} package}
13
14 Resize the \cs{textbullet} without changing its vertical center
15
16 Oliver Beery
17
18 Version 2.0.5\quad 18 February 2026
19
20
21 \section{Introduction}
22 \label{sec:intro}
23
24 \subsection{About}
25 \label{subsec:about}
26
27 The \pkg{scaletextbullet} package enables the user to resize the
28 \cs{textbullet} without moving its vertical center, unlike direct usage of the
29 \LaTeXe{} and \pkg{expl3} commands \cs{scalebox} and \cs{box_scale:}.
30 This process is not fully automated---the user must use
31 \cs{settextbulletfactor} to set the \cs{textbullet} factor to the correct value
32 to display the resized \cs{textbullet} at the correct height.
33 The \cs{textbullet} factor is the ratio of the width of the \cs{textbullet},
34 excluding its empty space, to its width, including its empty space.
35 One way of estimating the \cs{textbullet} factor is by using
36 \cs{scaletextbulletdebug}.
37
38 This package provides a solution that works only in text mode.
39 For a solution that works only in math mode, see the linked \TeX{} Stack
40 Exchange thread.%
41 \footnote{\url{https://tex.stackexchange.com/questions/119319/how-to-correctly-shrink-the-bullets-of-itemize}}
42
43 \subsection{Loading the package}
44 \label{subsec:loading}
45
46 \listheading{Requirements:}
47 \begin{itemize}
48 \item \LaTeXe{} version 2023-11-01 or newer
49 \item \pkg{l3kernel} version 2023-11-01 or newer
50 \end{itemize}
51
52 \subsection{Syntax}
53 \label{subsec:syntax}
54
55 This documentation uses the syntaxes \meta{number} and \meta{integer}.
56 These syntaxes have the same meaning as the arguments to \cs{fpeval} and
57 \cs{inteval}, respectively, which are documented in \pkg{usrguide}.
58
59
60 \section{Commands}
61 \label{sec:commands}
62
63 \begin{code}{\settextbulletfactor}
64 \begin{syntax}
65 \cs{settextbulletfactor} \marg{number}
66 \end{syntax}
67 Sets the \cs{textbullet} factor to \meta{number}.
68 This assignment is local to the current group.
69 The \cs{textbullet} factor is the ratio of the width of the \cs{textbullet},
70 excluding its empty space, to its width, including its empty space.
71 The initial \cs{textbullet} factor is \num{0.4}---this matches the
72 dimensions of the \cs{textbullet} of the Latin Modern font at size
73 \qty{10}{pt}.
74 \end{code}
75
76 \begin{code}{\scaletextbullet}
77 \begin{syntax}
78 \cs{scaletextbullet} \marg{number}
79 \end{syntax}
80 Prints a \cs{textbullet} with its size scaled by factor \meta{number}.
81 The new \cs{textbullet} will be printed with the same vertical center only if
82 the \cs{textbullet} factor is set to the correct value.
83
84 \listheading{Some exceptions:}
85 \begin{itemize}
86 \item
87 Issues an error if $\meta{number}<\num{0}$.
88 \item
89 Issues a warning if the new \cs{textbullet} would have zero dimensions.
90 \item
91 Cannot be used in math mode.
92 \end{itemize}
93 \end{code}
94
95 \begin{code}{\scaletextbullets}
96 \begin{syntax}
97 \cs{scaletextbullets} \oarg{number} \marg{integer}
98 \end{syntax}
99 Prints an \meta{integer} number of \cs{textbullet}s.
100 The size of each \cs{textbullet} is scaled by factor \meta{number} or, if the
101 optional argument is omitted, by a factor set such that the new
102 \cs{textbullet}s have the same total area as the original \cs{textbullet}.%
103 \footnote
104 {%
105 In calculating the total area, I have approximated each \cs{textbullet}
106 as a perfect circle, but, of course, the actual shape depends on the font
107 used.%
108 }
109 The new \cs{textbullet} will be printed with the same vertical center only if
110 the \cs{textbullet} factor is set to the correct value.
111
112 \listheading{Some exceptions:}
113 \begin{itemize}
114 \item
115 Issues an error if $\meta{integer}<\num{0}$ or $\meta{number}<\num{0}$.
116 \item
117 Issues a warning if $\meta{integer}=\num{0}$.
118 \item
119 Issues a warning if the new \cs{textbullet} would have zero dimensions.
120 \item
121 Cannot be used in math mode.
122 \end{itemize}
123 \end{code}
124
125 \begin{code}{\scaletextbulletdebug}
126 This command is provided only to help the user estimate the \cs{textbullet}
127 factor.
128 Prints \num{15} consecutive \cs{textbullet}s with decreasing sizes.
129 The \cs{textbullet}s are followed by the original \cs{textbullet} inside a
130 framed box.
131 The framed box has width equal to the \cs{textbullet} factor \texttimes{} the
132 total width of the \cs{textbullet} (this includes its empty space).
133 The \cs{textbullet} factor is set to the correct value when the \num{15}
134 consecutive \cs{textbullet}s have the same vertical center and the
135 \cs{textbullet} fits nicely inside the framed box.
136 Cannot be used in math mode.
137 \end{code}
138
139
140 \section{Application}
141 \label{sec:application}
142
143 I wrote this package primarily to create nicer-looking itemized lists.
144 The default list labels in \LaTeX{} (and other programs) fail to communicate
145 the list level within the list hierarchy:
146
147 \begin{multicols}{2}
148 \begin{itemize}[label=\textbullet]
149 \item List level 1
150 \begin{itemize}[label=\textbf{--}]
151 \item List level 2
152 \item List level 2
153 \begin{itemize}[label=\textasteriskcentered]
154 \item List level 3
155 \end{itemize}
156 \end{itemize}
157 \item List level 1
158 \begin{itemize}[label=\textbf{--}]
159 \item List level 2
160 \begin{itemize}[label=\textasteriskcentered]
161 \item List level 3
162 \item List level 3
163 \end{itemize}
164 \end{itemize}
165 \end{itemize}
166 \end{multicols}
167
168 This contrasts with traditional enumerated list structures where the list level
169 is obvious from the numbering of the list label:
170
171 \begin{multicols}{2}
172 \begin{enumerate}
173 \item List level 1
174 \begin{enumerate}
175 \item List level 2
176 \item List level 2
177 \begin{enumerate}
178 \item List level 3
179 \end{enumerate}
180 \end{enumerate}
181 \item List level 1
182 \begin{enumerate}
183 \item List level 2
184 \begin{enumerate}
185 \item List level 3
186 \item List level 3
187 \end{enumerate}
188 \end{enumerate}
189 \end{enumerate}
190 \end{multicols}
191
192 This package allows the user to create nice-looking itemized lists using
193 \cs{scaletextbullets} where the number of scaled \cs{textbullet}s in the list
194 label indicates the list level:
195
196 \begin{multicols}{2}
197 \begin{itemize}
198 \item List level 1
199 \begin{itemize}
200 \item List level 2
201 \item List level 2
202 \begin{itemize}
203 \item List level 3
204 \end{itemize}
205 \end{itemize}
206 \item List level 1
207 \begin{itemize}
208 \item List level 2
209 \begin{itemize}
210 \item List level 3
211 \item List level 3
212 \end{itemize}
213 \end{itemize}
214 \end{itemize}
215 \end{multicols}
216
217 The visual effect may be more clear with different fonts.
218 This example uses STIX Two Text (top) and Source Serif 4 (bottom).
219
220 \begingroup
221 \settextbulletfactor{0.54}
222 \newfontfamilystixtwo
223 \begin{multicols}{2}
224 \begin{itemize}
225 \item List level 1
226 \begin{itemize}
227 \item List level 2
228 \item List level 2
229 \begin{itemize}
230 \item List level 3
231 \end{itemize}
232 \end{itemize}
233 \item List level 1
234 \begin{itemize}
235 \item List level 2
236 \begin{itemize}
237 \item List level 3
238 \item List level 3
239 \end{itemize}
240 \end{itemize}
241 \end{itemize}
242 \end{multicols}
243 \endgroup
244
245 \begingroup
246 \settextbulletfactor{0.75}
247 \newfontfamilysourceseriffour
248 \begin{multicols}{2}
249 \begin{itemize}
250 \item List level 1
251 \begin{itemize}
252 \item List level 2
253 \item List level 2
254 \begin{itemize}
255 \item List level 3
256 \end{itemize}
257 \end{itemize}
258 \item List level 1
259 \begin{itemize}
260 \item List level 2
261 \begin{itemize}
262 \item List level 3
263 \item List level 3
264 \end{itemize}
265 \end{itemize}
266 \end{itemize}
267 \end{multicols}
268 \endgroup
269
270
271 \section{Implementation notes}
272 \label{sec:implementation}
273
274 The procedure of resizing the \cs{textbullet} without changing its vertical
275 center, including the definition of the \cs{textbullet} factor, makes an
276 important assumption:
277 That the \cs{textbullet} is a perfect circle.
278 Of course, this is not completely accurate and the actual shape depends on the
279 font used.
280 This means that the \cs{textbullet} factor may not be exactly the ratio of the
281 width of the \cs{textbullet}, excluding its empty space, to its width,
282 including its empty space.
283
284 In writing this package, I have referenced a comment on the \TeX{} Stack
285 Exchange by the user egreg.%
286 \footnote{\url{https://tex.stackexchange.com/questions/620507/how-to-resize-textbullet-without-the-bullet-moving-down}}
287 This package uses the same procedure for resizing the \cs{textbullet} without
288 changing its vertical center.
289
290
291 \end{document}