Debian Codegraph @

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

raw
1 % configuration for llmk
2 % +++
3 % sequence = [ "latex", "makeindex", "latex", "latex" ]
4 % latex = "lualatex"
5 % makeindex = "mendex"
6 % [programs.makeindex]
7 % args = ["%B.idx", "-sgind.ist"]
8 % +++
9
10 \documentclass{l3doc}
11
12 \usepackage{makeidx}
13
14 % Documentation target
15 \usepackage{numbersets}
16
17 \usepackage{booktabs}
18 \usepackage{bxtexlogo}
19 \usepackage{listings}
20 \lstset{basicstyle=\ttfamily, escapeinside=||, tabsize=4, columns=fullflexible}
21 \usepackage{unicode-math}
22 \setmainfont{TeX Gyre Pagella}
23 \setsansfont{TeX Gyre Heros}
24 \setmonofont{Latin Modern Mono}
25 \setmathfont{TeX Gyre Pagella Math}
26 \usepackage{changelog}
27
28 \NewDocumentCommand{\ThisPackageName}{}{\pkg{numbersets}}
29 \NewDocumentCommand{\sourcecode}{m}{\texttt{#1}}
30
31 \title{The \ThisPackageName{} Package (v0.2.0)}
32 \author{Takumi Noguchi (enunun)}
33 \date{2024-10-15}
34
35 \begin{document}
36
37 \maketitle
38
39 \tableofcontents
40
41 \section{Overview}
42
43 The \ThisPackageName{} package provides an easy way to implement the common preference for using commands
44 that represent the \emph{meaning} of concepts to be expressed,
45 rather than focusing solely on their visual appearance.
46 For example, using a command like ``\cs[no-index]{RealNumbers}'' to denote the set of all real numbers \(\RealNumbers[style=bb]\) is preferable
47 to using a purely visual representation like ``\cs[no-index]{mathbb\{R\}}''.
48
49 This package provides the following key features:
50 \begin{itemize}
51 \item A command to apply the desired typeface for representing sets of numbers.
52 \item An interface for defining rules that specify the typefaces for these sets.
53 \item An interface for defining commands that represent sets of numbers.
54 \item Several predefined presets for common number sets.
55 \end{itemize}
56
57 Although the default configuration assumes the use of the \pkg{unicode-math} package for handling mathematical typefaces,
58 the \ThisPackageName{} package itself does not load the \pkg{unicode-math} package.
59 To use the package with default settings,
60 it is required to import the \pkg{unicode-math} package \emph{explicitly} in your document.
61 However, since the \pkg{unicode-math} package is not loaded automatically by the \ThisPackageName{} package,
62 users can modify their configuration even if the \pkg{unicode-math} package cannot be used.
63 See the section \ref{sec:withoutunicode-math} for more details.
64
65
66 \section{Package Options}
67 \label{sec:packageoptions}
68
69 \DescribeOption{style}
70 The \ThisPackageName{} package provides a single option for customization:
71 the \sourcecode{style} option.
72 This option allows users to specify the typeface to be used when displaying number sets,
73 and it is defined using a key-value format.
74
75 \begin{itemize}
76 \item \sourcecode{bb}: BlackBoard Bold (default), like \(\NumberSet[style = bb]{N}\).
77 \item \sourcecode{bfup}: Bold Upright, like \(\NumberSet[style = bfup]{N}\).
78 \item \sourcecode{bfit}: Bold Italic, like \(\NumberSet[style = bfit]{N}\)
79 \end{itemize}
80
81
82 \begin{function}{\SetupNumberSetsOptions}
83 \begin{syntax}
84 \cs[no-index]{SetupNumberSetsOptions}\marg{options}
85 \end{syntax}
86 Changes the global options for the \ThisPackageName{} package,
87 which can be applied after the package import or at any point in the document.
88 \end{function}
89
90 For example, to set the default style to Bold Upright, you would write:
91 \begin{lstlisting}
92 \SetupNumberSetsOptions{style=bfup}
93 \end{lstlisting}
94
95
96 \section{Basic Usage}
97
98 The \cs{NumberSet} command allows users to display number sets using the desired typeface.
99 The command can be customized by passing an optional \sourcecode{style} argument to specify the typeface locally for the number set.
100 While the \sourcecode{style} option of this command affects only the local instance, the values
101 it accepts are the same as those used for the package-level \sourcecode{style} option in the Section \ref{sec:packageoptions}.
102
103
104 \begin{function}{\NumberSet}
105 \begin{syntax}
106 \cs{NumberSet}\oarg{options}\marg{symbol}
107 \end{syntax}
108 This command displays the specified number set
109 with the typeface defined by the \sourcecode{style} option. If no style is specified, the default style is applied.
110
111 It should be noted that the \cs[no-index]{NumberSet} command is primarily intended for use within math mode,
112 similar to how the \cs[no-index]{mathbb} command is typically used in math mode to display sets like \cs[no-index]{mathbb\{N\}}.
113 \end{function}
114
115 In the above examples:
116 \begin{itemize}
117 \item \cs[no-index]{NumberSet\{N\}}: will be displayed like $\NumberSet{N}$ in the default style.
118 \item \cs[no-index]{NumberSet[style=bb]\{Z\}}: will be displayed like $\NumberSet[style=bb]{Z}$ in the BlackBoard Bold style.
119 \item \cs[no-index]{NumberSet[style=bfup]\{R\}}: will be displayed like $\NumberSet[style=bfup]{R}$ in the Bold Upright style.
120 \item \cs[no-index]{NumberSet[style=bfit]\{C\}}: will be displayed like $\NumberSet[style=bfit]{C}$ in the Bold Italic style.
121 \end{itemize}
122
123 It is important to note that the \cs[no-index]{NumberSet} command,
124 while versatile, is a more generic and less descriptive command.
125 For clarity and better readability in the main text,
126 it is recommended to use more descriptive commands such as \cs[no-index]{NaturalNumbers} for representing the set of natural numbers.
127 These commands provide more context and meaning, making the content easier to understand.
128 See the section \ref{sec:customcommand} for defining custom commands for sets of numbers,
129 and some presets described in the section \ref{sec:predefinedpresets} are provided by this package.
130
131
132 \section{Defining Custom Number Set Commands}
133 \label{sec:customcommand}
134
135 The \cs{DeclareNumberSetCommand} allows users to define new commands for representing number sets with specific names,
136 enhancing readability and semantic clarity in documents. This command can be particularly useful
137 when you want to create descriptive names for commonly used number sets.
138
139 \begin{function}{\DeclareNumberSetCommand}
140 \begin{syntax}
141 \cs{DeclareNumberSetCommand}\marg{cs}\marg{symbol}
142 \end{syntax}
143 This command defines a new number set command. The first argument \meta{cs} specifies the control sequence for the new command,
144 while the second argument \meta{symbol} represents the symbol that will be displayed.
145 \end{function}
146
147 For example, to define a command for the set of all quaternions by \(\NumberSet{H}\), you would write:
148 \begin{lstlisting}
149 \DeclareNumberSetCommand{\Quaternions}{H}
150 \end{lstlisting}
151
152 Once defined, you can use the new command \cs[no-index]{Quaternions} in your document to display the symbol for the set of all quaternions.
153 In addition, you can use the optional argument \sourcecode{style} to specify the typeface locally,
154 similar to the \cs[no-index]{NumberSet} command.
155 To display the set of all quaternions that you just defined above, you would write:
156 \begin{lstlisting}
157 \Quaternions[style=bfup]
158 \end{lstlisting}
159
160 Internally, the definition using \cs[no-index]{DeclareNumberSetCommand}\marg{cs}\marg{symbol}
161 is equivalent to the following definition:
162 \begin{lstlisting}
163 \NewDocumentCommand{|\meta{cs}|}
164 {o}
165 {
166 \IfValueTF{#1}
167 {
168 \NumberSet[#1]{|\meta{symbol}|}
169 }
170 {
171 \NumberSet{|\meta{symbol}|}
172 }
173 }
174 \end{lstlisting}
175
176 \section{Defining Custom Number Set Styles}
177
178 The \cs{DeclareNumberSetStyle} command allows users to define (or overwrite)
179 new styles (or registered styles) for displaying number sets,
180 giving users greater control over the typeface used.
181 This command can be useful when the built-in styles are insufficient for specific design needs.
182
183 \begin{function}{\DeclareNumberSetStyle}
184 \begin{syntax}
185 \cs{DeclareNumberSetStyle}\marg{style}\marg{command}
186 \end{syntax}
187 This command defines a new style for number sets. The first argument \meta{style} specifies the name of the style,
188 and the second argument \meta{command} indicates the typeface command that will be applied when this style is selected.
189 \end{function}
190
191 For example, to define a new style using a bold sans-serif font, you would write:
192 \begin{lstlisting}
193 \DeclareNumberSetStyle{boldsans}{\symbfsfup}
194 \end{lstlisting}
195 Once defined, you can use the identifier ``\sourcecode{boldsans}'' for the value of \sourcecode{style} option
196 in the following commands:
197 \begin{itemize}
198 \item \cs[no-index]{NumberSet} command
199 \item \cs[no-index]{SetupNumberSetsOptions} command
200 \item Custom command defined by the \cs[no-index]{DeclareNumberSetCommand} command
201 \end{itemize}
202
203 It should be noted that the \meta{command} argument of the \cs[no-index]{DeclareNumberSetStyle} command
204 can accept \emph{only} a single control sequence.
205 Namely, combinations of multiple commands (e.g., \cs[no-index]{overline\cs[no-index]{symbb}}) are not supported.
206 To avoid this limitation, you should define a single control sequence as an abbreviation for the combinations.
207 In this case, you should define an abbreviation like ``\cs[no-index]{bbline}'';
208 after that, you can define the style identifier using this single control sequence:
209 \begin{lstlisting}
210 \NewDocumentCommand\bbline{m}{\overline{\symbb{#1}}}
211 \DeclareNumberSetStyle{bbline}{\bbline}
212 \end{lstlisting}
213
214 The values (\sourcecode{bb}, \sourcecode{bfup}, \sourcecode{bfit}) provided by default for the style option
215 can be considered as pre-defined identifiers that the \cs[no-index]{DeclareNumberSetStyle} command declares.
216 The Table \ref{tab:predefinedidentifier} shows
217 the list of predefined identifiers and the commands corresponding to each identifier.
218 \begin{table}[h]
219 \centering
220 \caption{Predefined identifiers for the values of the \sourcecode{style} option}
221 \label{tab:predefinedidentifier}
222 \begin{tabular}{cc}
223 \toprule
224 Identifer & Command \\
225 \midrule
226 \sourcecode{bb} & \cs[no-index]{symbb} \\
227 \sourcecode{bfup} & \cs[no-index]{symbfup} \\
228 \sourcecode{bfit} & \cs[no-index]{symbfit} \\
229 \bottomrule
230 \end{tabular}
231 \end{table}
232
233
234 \section{Using Without the \pkg{unicode-math} Package}
235 \label{sec:withoutunicode-math}
236
237 Although the default configuration of this package assumes the use of \pkg{unicode-math} package for handling mathematical typefaces,
238 the \ThisPackageName{} package itself does not load the \pkg{unicode-math} package.
239 Therefore, you can use the \ThisPackageName{} package without the \pkg{unicode-math} package by overriding the default configuration.
240
241 Here is an example to use the \ThisPackageName{} package with \pkg{amssymb} package for blackboard bold symbols and \pkg{bm} package for bold italic symbols:
242 \begin{lstlisting}
243 \usepackage{amssymb}
244 \usepackage{bm}
245 \usepackage{numbersets}
246 \DeclareNumberSetStyle{bb}{\mathbb}
247 \DeclareNumberSetStyle{bfup}{\mathbf}
248 \DeclareNumberSetStyle{bfit}{\bm}
249 ...
250 % in the document
251 % equivalent to \mathbb{P}
252 \NumberSet[style=bb]{P}
253 % equivalent to \mathbf{A}
254 \NumberSet[style=bfup]{A}
255 % equivalent to \bm{H}
256 \NumberSet[style=bfit]{H}
257 \end{lstlisting}
258
259 Note that you only need to reconfigure the styles that you actually use in your document.
260 For example, if you only use the \sourcecode{bb} style, there is no need to reconfigure the unused \sourcecode{bfup} and \sourcecode{bfit} styles.
261
262 \section{Predefined Presets for Common Number Sets}
263 \label{sec:predefinedpresets}
264
265 \begin{function}{\NaturalNumbers, \Integers, \RationalNumbers, \RealNumbers, \ComplexNumbers}
266 Several predefined presets are available in the \ThisPackageName{} package for commonly used number sets.
267 These presets are designed to help you clearly express the intended mathematical meaning,
268 rather than just applying a specific format.
269 The table \ref{tab:predefinednumberset} shows the list
270 of predefined commands for common sets of numbers.
271 \end{function}
272
273 \begin{table}[h]
274 \centering
275 \caption{Predefined commands for common sets of numbers}
276 \label{tab:predefinednumberset}
277 \begin{tabular}{cc}
278 \toprule
279 Command name & Output by default \\
280 \midrule
281 \cs{NaturalNumbers} & \(\NaturalNumbers\) \\
282 \cs{Integers} & \(\Integers\) \\
283 \cs{RationalNumbers} & \(\RationalNumbers\) \\
284 \cs{RealNumbers} & \(\RealNumbers\) \\
285 \cs{ComplexNumbers} & \(\ComplexNumbers\) \\
286 \bottomrule
287 \end{tabular}
288 \end{table}
289
290 \section{Contributing, Issue Reporting, and Repository Access}
291
292 The source code for the \ThisPackageName{} package is hosted on GitHub at the following repository:
293 \begin{quote}
294 \url{https://github.com/enunun/numbersets}
295 \end{quote}
296
297 If you have any suggestions, feature requests, or bug reports,
298 we encourage you to submit them via the repository's issue tracker.
299 This ensures that improvements and fixes are addressed efficiently. You can visit the ``Issues'' tab in the repository to create a new issue.
300
301 \section{Changelog}
302
303 The first is the version 0.1.0. The changelog of this package is shown in this seciton.
304
305 \begin{changelog}[section=false]
306 \begin{version}[v=0.2.0, date=2024-10-15]
307 \changed
308 \item Modified the \cs[no-index]{DeclareNumberSetCommand} to accept the control sequence directly
309 \end{version}
310 \begin{version}[v=0.1.0, date=2024-10-13]
311 \added
312 \item Provided the \cs[no-index]{NumberSet} command
313 \item Provided the \cs[no-index]{DeclareNumberSetCommand} command
314 \item Provided the \cs[no-index]{DeclareNumberSetStyle} command
315 \item Provided the commands \cs[no-index]{NaturalNumbers}, \cs[no-index]{Integers}, \cs[no-index]{RationalNumbers}, \cs[no-index]{RealNumbers}, \cs[no-index]{ComplexNumbers}
316 \end{version}
317 \end{changelog}
318
319 \printindex
320
321 \end{document}