Debian Codegraph @

texmf-dist/source/latex/intexgral/intexgral-en.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2025 Valentin Dao
4 %
5 % This file may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either
7 % version 1.3 of this license or (at your option) any later
8 % version. The latest version of this license is in:
9 %
10 % http://www.latex-project.org/lppl.txt
11 %
12 % and version 1.3c or later is part of all distributions of
13 % LaTeX version 2008-05-04 or later.
14 %
15 % This work has the LPPL maintenance status 'maintained'
16 % and the current maintainer is Valentin Dao ([email protected]).
17 %
18 % This work consists of the files intexgral.ins, intexgral-fr.dtx and intexgral-en.dtx, along with the derived files intexgral.sty, intexgral-fr.pdf, and intexgral-en.pdf.
19 %
20 % The repository of this work can be found at:
21 %
22 % https://github.com/ankaa3908/intexgral
23 %
24 %<*driver>
25 % \fi
26 % \iffalse
27 \documentclass[11pt, a4paper]{l3doc}
28
29 \usepackage{amsmath}
30
31 \usepackage{fontspec}
32 \usepackage{unicode-math}
33
34 \setmainfont{ChronicleTextG3}[
35 Extension = .otf,
36 UprightFont = *-Roman-Pro,
37 ItalicFont = *-Italic-Pro,
38 BoldFont = *-Bold-Pro,
39 BoldItalicFont = *-BoldIta-Pro,
40 ]
41
42 \setsansfont{Whitney}[
43 Extension = .otf,
44 UprightFont = *-Medium,
45 ItalicFont = *-MediumItalic,
46 BoldFont = *-Bold,
47 BoldItalicFont = *-BoldItalic,
48 UprightFeatures =
49 {
50 StylisticSet = 1,
51 StylisticSet = 10,
52 StylisticSet = 11,
53 },
54 BoldFeatures =
55 {
56 StylisticSet = 1,
57 StylisticSet = 10,
58 StylisticSet = 11,
59 },
60 ItalicFeatures =
61 {
62 StylisticSet = 1,
63 StylisticSet = 10,
64 StylisticSet = 11,
65 StylisticSet = 8,
66 StylisticSet = 9
67 }
68 ]
69
70 \newfontface{\smbold}{Whitney-Semibold.otf}
71
72 \setmonofont{MonaspaceArgon}[
73 Scale = 0.8,
74 Extension = .otf,
75 UprightFont = *-Medium,
76 UprightFeatures =
77 {
78 CharacterVariant = {1:0,31:1},
79 Ligatures = Common,
80 Contextuals = Alternate
81 },
82 BoldFont = *-SemiBold,
83 ItalicFont = *-MediumItalic,
84 BoldItalicFont = *-SemiBoldItalic
85 ]
86
87 \setmathfont{NewCMMath-Regular.otf}
88
89 \usepackage{intexgral}
90 \RenewDifferential{\odif}{\symup{d}}
91
92 \usepackage[
93 a4paper,
94 marginparwidth = 30mm,
95 top = 3cm,
96 bottom = 2cm,
97 left = 44mm,
98 right = 30mm,
99 marginparsep = 2mm,
100 ]{geometry}
101
102 \usepackage{fancyhdr}
103 \fancyhf{}
104 \fancyfoot[C]{\small\sffamily\itshape---\space\thepage\space\kern0.4mm\/---}
105 \renewcommand{\headrulewidth}{0pt}
106 \pagestyle{fancy}
107
108 \usepackage{fontawesome5}
109 \usepackage{microtype}
110
111 \usepackage[addtotoc]{abstract}
112
113 \usepackage[silence, infograb]{codedescribe}
114 \PkgInfoSetAliases
115
116 \definecolor{RoyalBlue}{RGB}{0, 35, 102}
117 \definecolor{RoyalRed}{RGB}{157, 16, 45}
118 \definecolor{RoyalGreen}{HTML}{48845F}
119 \definecolor{urlcolour}{HTML}{B42F5E}
120
121 \definecolor{packagecolour}{HTML}{B86B00}
122 \definecolor{keycolour}{HTML}{004766}
123 \definecolor{macrocolour}{HTML}{047658}
124 \definecolor{optioncolour}{HTML}{630476}
125
126 \newlabelset{english}
127 {
128 new = \textsf{new},
129 update = \textsf{updated},
130 note = \textsf{N.B},
131 remark = \textsf{remark},
132 and = \textsf{and},
133 or = \textsf{or},
134 months =
135 {
136 January, February, March, April,
137 May, Juin, July, August,
138 September, October, November, December
139 }
140 }
141
142 \selectlabelset{english}
143
144 \lstset{
145 gobble=2,
146 alsoletter={*-}
147 }
148
149 \setnewcodekey{intexgral}{
150 ruleht = 0,
151 texcsstyle = \bfseries\color{RoyalBlue},
152 texcs2 =
153 {
154 integral,
155 IntegralSetup,
156 differentials,
157 intexgralsetup,
158 },
159 texcs2style = \color{macrocolour},
160 emph =
161 {
162 true,
163 false,
164 default,
165 nested,
166 product,
167 },
168 keywd =
169 {
170 equation,
171 limits,
172 limits*,
173 mode,
174 symbol,
175 nint,
176 llimit,
177 ulimit,
178 domain,
179 domain*,
180 boundary,
181 variables,
182 jacobian,
183 diff-vec,
184 diff-star,
185 diff-symb,
186 diff-options,
187 defaultvar,
188 defaultvar*,
189 vectorstyle,
190 domainstyle,
191 symbolskip,
192 hide-diff,
193 single,
194 double,
195 triple,
196 quadruple,
197 contour,
198 surface,
199 volume
200 },
201 codeprefix = {},
202 resultprefix = {}
203 }
204
205 \defgroupfmt{code}{color=macrocolour}
206 \defobjectfmt{pkg}{pkg}{color=packagecolour, font=\sffamily}
207 \defobjectfmt{option}{option}{color=optioncolour, shape preadj=thin, shape posadj=thin, noshape}
208 \defgroupfmt{keys}{color=keycolour, noshape}
209
210 \usepackage{luacode}
211
212 \begin{luacode}
213 function fontcopyright(fontname)
214 local font = fontloader.open(kpse.find_file(fontname, 'opentype fonts'))
215 if font then
216 local metrics = fontloader.to_table(font)
217 local copyright = metrics.copyright:gsub("https?://%S+$", "")
218 local copyright = copyright:gsub("Copyright%s%(C%)", "\\copyright\\")
219 local copyright = copyright:gsub("&", "\\&")
220 tex.print('\\textit{' .. metrics.fullname .. '}\\par')
221 if not string.find(copyright, "missing") then
222 tex.print(copyright)
223 end
224 end
225 end
226 \end{luacode}
227
228 \usepackage{changelog}
229 \usepackage{enumitem}
230 \renewenvironment{changelogitemize}
231 {\begin{itemize}[label=\raisebox{0.5ex}{$\scriptscriptstyle\blacktriangleright$}]}
232 {\end{itemize}}
233
234 \usepackage[normalem]{ulem}
235
236 \usepackage{polyglossia}
237 \setmainlanguage{english}
238
239 \usepackage{csquotes}
240 \usepackage[perpage]{footmisc}
241
242 \usepackage{titlesec}
243 \titleformat*{\section}{\sffamily\LARGE\bfseries}
244 \titleformat*{\subsection}{\sffamily\Large\bfseries}
245 \titleformat*{\subsubsection}{\smbold\large}
246
247 \setlength{\parindent}{0pt}
248
249 \usepackage[totoc=true, columnsep=25pt]{idxlayout}
250
251 \usepackage{hyperref}
252 \hypersetup{
253 pdfauthor = {Valentin Dao},
254 pdftitle = {The intexgral package},
255 pdfcreator = {LuaLaTeX with hyperref package},
256 colorlinks = true,
257 linkcolor = RoyalBlue,
258 urlcolor = urlcolour,
259 }
260
261 \usepackage{cleveref}
262
263 \EnableCrossrefs
264
265 \begin{document}
266 \DocInput{intexgral-en.dtx}
267 \end{document}
268 %</driver>
269 % \fi
270 %
271 % \PkgInfoGet{intexgral}{author}{\fileauthor}
272 % \PkgInfoGet{intexgral}{version}{\fileversion}
273 % \PkgInfoGet{intexgral}{date}{\filedate}
274 % \PkgInfoGet{intexgral}{creation}{\filecreationdate}
275 %
276 % \tstitle{^^A
277 % title = {{\huge The \href{https://ctan.org/pkg/intexgral}{\textsf{intexgral}} package}\medbreak {\Large v\fileversion}},
278 % author = {\fileauthor\footnote{E-mail: \href{mailto:[email protected]}{\ttfamily [email protected]}}},
279 % date = {\the\day\space\tsdate}
280 % }
281 %
282 % \begin{center}
283 % \rule{12.5cm}{0.6pt}
284 % \begin{abstract}
285 % While integral composition is prevalent in \LaTeX, it often proves to be impractical. When the expression becomes complex, it is then difficult to modify its various elements in an illegible source code. To address this problem, the \tsobj[pkg]{intexgral} package offers a central macro whose only argument is the integrand. Everything else (symbol, limits, variables\dots) can be modified using a \tsobj[meta]{key=value} interface. Unlike the traditional method, where the user chooses the limit order with the active characters \verb|_| and \verb|^|, the package had to establish a convention. Thus, for the two keys that will deal with limits, the assumed input will be \verb|_|\tsobj[meta]{lower limit}\verb|^|\tsobj[meta]{upper limit}. Since this package is written in \tsobj[pkg]{expl3}, it depends on the \LaTeX3 group of packages \tsobj[pkg]{l3kernel} and \tsobj[pkg]{l3package}. In addition, \tsobj[pkg]{intexgral} uses the \tsobj[pkg]{derivative}\footnote{Available on \textsc{ctan} under: \url{https://ctan.org/pkg/derivative}} package to facilitate the manipulation of differentials, as well as \tsobj[pkg]{pkginfograb}\footnote{Available on \textsc{ctan} under: \url{https://ctan.org/pkg/pkginfograb}}.
286 % \end{abstract}
287 % \rule{12.5cm}{0.6pt}
288 % \end{center}
289 %
290 % \newpage
291 % \tableofcontents
292 % \newpage
293 %
294 % \subsection*{License}
295 %
296 % \copyright\ 2025 Valentin Dao, published under the \LaTeX\ Project Public License (\textsc{lppl}) 1.3c
297 %
298 % \subsection*{Fonts}
299 %
300 % \directlua{fontcopyright('ChronicleTextG3-Roman-Pro.otf')}
301 %
302 % \vspace*{\baselineskip}
303 %
304 % \begingroup
305 % \sffamily
306 % \directlua{fontcopyright('Whitney-Medium.otf')}
307 % \endgroup
308 %
309 % \vspace*{\baselineskip}
310 %
311 % \begingroup
312 % \ttfamily
313 % \directlua{fontcopyright('MonaspaceArgon-Medium.otf')}
314 % \copyright\ 2023, GitHub \url{https://github.com/githubnext/monaspace}
315 % \endgroup
316 %
317 % \subsection*{Repository}
318 %
319 % \href{https://github.com/ankaa3908/intexgral/tree/main}{\faGithub\ See GitHub repository}.
320 %
321 % \subsection*{Acknowledgements}
322 %
323 % Many thanks to Plante and Slurpy for accompanying me on this adventure of learning \TeX, your pieces of advice were priceless. I’d also like to thank Anthony, who has always kindly reviewed the new versions and given me ideas for those to come.
324 %
325 % \newpage
326 %
327 % \section{Package options}
328 %
329 % \begin{codedescribe}[macro, new={v2.0.0}]{\intexgralsetup}
330 % \begin{codesyntax}
331 % \tsobj[macro]{\intexgralsetup}\tsargs[marg]{package options}
332 % \end{codesyntax}
333 % These options can be declared in a classic way with \tsobj[macro]{\usepackage} or with \tsobj[macro]{\intexgralsetup} in the preamble.
334 % \end{codedescribe}
335 %
336 % \begin{codedescribe}[key]{invert-limits}
337 % \begin{codesyntax}[key]
338 % \tsobj[key]{invert-limits}=\tsobj[option, meta or]{true,\uline{false}}
339 % \end{codesyntax}
340 % This key inverts the limit order convention. The entirety of the document can only follow one convention.
341 % \end{codedescribe}
342 %
343 % \begin{codedescribe}[key, update={v3.0.0}]{invert-diff}
344 % \begin{codesyntax}[key]
345 % \tsobj[key]{invert-diff}=\tsobj[option, meta or]{true,\uline{false}}
346 % \end{codesyntax}
347 % It is common to see the differentials placed before the integrand in physics papers. This key hence swaps their position.
348 % \end{codedescribe}
349 %
350 % \begin{codedescribe}[key, new={v3.0.0}]{limits-mode}
351 % \begin{codesyntax}[key]
352 % \tsobj[key]{limits-mode}=\tsobj[option, meta or]{limits,\uline{nolimits}}
353 % \end{codesyntax}
354 % Applies \tsobj[macro]{\limits} or \tsobj[macro]{\nolimits} to every single integral.
355 % \end{codedescribe}
356 %
357 % \begin{codedescribe}[key]{italic, upright}
358 % \begin{codesyntax}[key]
359 % \tsobj[key]{italic}=\tsobj[option, meta or]{true,\uline{false}}
360 % \tsobj[key]{upright}=\tsobj[option, meta or]{\uline{true},false}
361 % \end{codesyntax}
362 % These are the two keys of the \tsobj[pkg]{derivative} package.
363 % \end{codedescribe}
364 %
365 % \section{Presentation of the main macro}
366 %
367 % \begin{codedescribe}[macro, update={v3.0.0}]{\integral}
368 % \begin{codesyntax}
369 % \tsmacro{\integral}[list of keys]{integrand}
370 % \end{codesyntax}
371 % This macro is used to typeset integrals. It must, of course, be used in math mode only. Here is a first example in its simplest form:
372 % \end{codedescribe}
373 %
374 % \begin{codestore}[1]
375 % \begin{equation}
376 % \integral{x}
377 % \end{equation}
378 % \end{codestore}
379 %
380 % \tsdemo*[intexgral]{1}
381 %
382 % Since this macro focuses on the use of keys, the first part of this documentation will present them, grouping them by domain. The second part will introduce a few additional macros that complement the use of certain keys. The rest of this document will outline the other features of the package.
383 %
384 % \section{List of keys}
385 %
386 % \subsection{Integration limits}
387 %
388 % \subsubsection{Defining the limits}
389 %
390 % \begin{codedescribe}[key]{limits, limits*}
391 % \begin{codesyntax}[key]
392 % \tsobj[key]{limits}=\tsargs[marg]{mixed-list}, \tsargs[arg]{keyword}
393 % \tsobj[key]{limits*}=\tsargs[marg]{mixed-list}, \tsargs[arg]{keyword}
394 % \end{codesyntax}
395 % This key determines the integration limits to be used, following the convention explained in the abstract. In its simplest form, the value of the key takes as its argument a list of elements separated by commas (\emph{comma-separated values} or \tsobj[meta]{csv-list}\footnotemark[1]).
396 % \end{codedescribe}
397 %
398 % \begin{codestore}[2]
399 % \begin{equation}
400 % \integral[limits={1, 10}]{f(x)}
401 % \end{equation}
402 % \end{codestore}
403 %
404 % \tsdemo*[intexgral]{2}
405 %
406 % The notable advantage of the \tsobj[key]{limits} key is that you can specify the integration limits for several integrals, and the package automatically typesets the corresponding symbols. To separate pairs of limits, we use a semicolon (\emph{semicolon-separated values} or \tsobj[meta]{ssv-list}\footnotemark[1]).
407 %
408 % \footnotetext[1]{We therefore mean by \tsobj[meta]{mixed-list} that \tsobj[key]{limits} can accept a set of \tsobj[meta]{csv-list} in a more general \tsobj[meta]{ssv-list}.}
409 %
410 % \begin{codestore}[3]
411 % \begin{equation}
412 % \integral[limits={1, 2; 3, 4}, variables={x, y}]{f(x, y)}
413 % \end{equation}
414 % \end{codestore}
415 %
416 % \tsdemo*[intexgral]{3}
417 %
418 % It is also possible to specify predefined limits using keywords (see \cref{subsec:limits}). Finally, the starred variant allows the limits of the integral to be expressed as an interval. The direction of the brackets automatically adjusts itself to the presence of $\pm$\verb|\infty|.
419 %
420 % \begin{codestore}[4]
421 % \begin{equation}
422 % \integral[limits*={1, 10}]{f(x)}
423 % \end{equation}
424 % \end{codestore}
425 %
426 % \tsdemo*[intexgral]{4}
427 %
428 % \subsection{Display modes}
429 %
430 % \begin{codedescribe}[key, new={v3.0.0}]{mode}
431 % \begin{codesyntax}[key]
432 % \tsobj[key]{mode}=\tsobj[option, meta or]{\uline{default},nested,product}
433 % \end{codesyntax}
434 % \emph{Solely} when the \tsobj[key]{limits} key is used, it is possible to choose between three distinct display styles. Each of these is fully compatible with the \tsobj[key]{invert-diff} option.
435 % \begin{describelist*}{option}
436 % \describe{default}{Typesets all the symbols, then the integrand, then the variables. As the macro operates by default in this mode, it is not necessary to use the key with this value.}
437 % \describe{nested}{Typesets a nested integral where the symbol and integrand alternate before all the variables are written.}
438 % \describe{product}{Typesets a product of integrals where the symbol, integrand, and variables alternate.}
439 % \end{describelist*}
440 % Of course, nothing prevents you from using the \tsobj[macro]{\integral} macro several times in a row to produce the same result as in the example below. However, for those who would prefer to obtain the result with a single macro, this method is permitted.
441 % \begin{tsremark}[\textcolor{RoyalRed}{Important:}]
442 % for the last two modes, the integral will be \emph{cut off} in a certain way. In order to perform this action correctly, the same method must be used as with \tsobj[key]{limits}, i.e. by using a semicolon.
443 % \end{tsremark}
444 % \end{codedescribe}
445 %
446 % \begin{center}
447 % \textsc{mode}\kern1ex \tsobj[option]{default}
448 % \end{center}
449 %
450 % \begin{codestore}[5]
451 % \begin{equation}
452 % \integral[limits={1, 2; 3, 4; 5, 6}, variables={x, y, z}, mode=default]{xyz}
453 % \end{equation}
454 % \end{codestore}
455 %
456 % \tsdemo*[intexgral]{5}
457 %
458 % \begin{center}
459 % \textsc{mode}\kern1ex \tsobj[option]{nested}
460 % \end{center}
461 %
462 % \begin{codestore}[6]
463 % \begin{equation}
464 % \integral[limits={1, 2; 3, 4; 5, 6}, variables={z, y, x}, mode=nested]{x;y;z}
465 % \end{equation}
466 % \end{codestore}
467 %
468 % \tsdemo*[intexgral]{6}
469 %
470 % \begin{center}
471 % \textsc{mode}\kern1ex \tsobj[option]{product}
472 % \end{center}
473 %
474 % \begin{codestore}[7]
475 % \begin{equation}
476 % \integral[limits={1, 2; 3, 4; 5, 6}, variables={x, y, z}, mode=product]{x;y;z}
477 % \end{equation}
478 % \end{codestore}
479 %
480 % \tsdemo*[intexgral]{7}
481 %
482 % To function correctly, it is obvious that the keys \tsobj[key]{limits} and \tsobj[key]{variables} (see \ref{subsubsec:variables}), as well as the integrand, must have the same number of elements. If this is not the case, compilation will not fail, but the expression of the integral may no longer make sense. Numerous warning messages will be displayed to inform you of this.
483 %
484 % \subsection{Symbol (and more about limits)}
485 %
486 % The \tsobj[key]{limits(*)} keys are very useful when typesetting a definite integral. However, this only covers final expressions where the limits of each variable have been specified. For more general cases — indefinite integrals \nobreak — they are relatively inconvenient. To typeset a double integral over a surface $S$, one would have to write \verb|limits={,;S,}|. Needless to say, this is rather inconvenient for the user and not optimal for the package. Furthermore, the glyph would not be correct. The set of keys below therefore offers an easy way to modify both the symbol and the bounds.
487 %
488 % \subsubsection{Selecting a symbol}
489 %
490 % \begin{codedescribe}[key, update={v3.0.0}]{symbol}
491 % \begin{codesyntax}[key]
492 % \tsobj[key]{symbol}=\tsobj[meta]{control sequence}
493 % \end{codesyntax}
494 % This key accepts a macro designating an integral symbol. Any symbol previously defined by a control sequence is acceptable. If you attempt to use one that is not defined, it will be substituted with \tsobj[macro]{\int} and a warning message will be issued.
495 % \begin{tsremark}[\textcolor{RoyalGreen}{Remark:}]
496 % apart from verifying the existence of the macro, no specific checks are performed, and the value of the key is used as is to compose the symbol. This implies two things in particular. First, the symbol will depend on how it is defined. For instance, \tsobj[pkg]{amsmath} and \tsobj[pkg]{unicode-math} do not define \tsobj[macro]{\iint} in the same way. The result will naturally be different. Furthermore, if you assign a \emph{defined} macro as the key argument but it does not correspond to an integral symbol, the package will ignore it and still use the given symbol. In addition to the mathematical inconsistency that this may represent, it is likely to lead, under certain circumstances, to low-level errors.
497 % \end{tsremark}
498 % \end{codedescribe}
499 %
500 % \begin{codestore}[8]
501 % \begin{equation}
502 % \integral[symbol=\iint, llimit=S, variables={x, y}]{f(x, y)}
503 % \end{equation}
504 % \end{codestore}
505 %
506 % \tsdemo*[intexgral]{8}
507 %
508 % \subsubsection{Generating many integrals}
509 %
510 % \begin{codedescribe}[key]{nint}
511 % \begin{codesyntax}[key]
512 % \tsobj[key]{nint}=\tsobj[meta]{integer}
513 % \end{codesyntax}
514 % This key accepts an integer $n$ which allows $n$ integrals to be composed. It is advisable to use this key only if the number of symbols exceeds 4 to favour the glyphs defined by the mathematical font used.
515 % \end{codedescribe}
516 %
517 % \begin{codestore}[9]
518 % \begin{equation}
519 % \integral[nint=5, llimit=\Omega, variables={x_1, x_2, x_3, x_4, x_5}]{f(x_1, x_2, x_3, x_4, x_5)}
520 % \end{equation}
521 % \end{codestore}
522 %
523 % \tsdemo*[intexgral]{9}
524 %
525 % \subsubsection{Defining boundaries on an ad hoc basis}
526 %
527 % \begin{codedescribe}[key, update={v3.0.0}]{llimit, ulimit}
528 % \begin{codesyntax}[key]
529 % \tsobj[key]{llimit}=\tsobj[meta]{lower limit}
530 % \tsobj[key]{ulimit}=\tsobj[meta]{upper limit}
531 % \end{codesyntax}
532 % These two keys allow you to specify the lower and upper limits, respectively. They are only suitable if a single symbol is displayed. If you need to specify both limits, the \tsobj[key]{limits} key should be used instead.
533 % \end{codedescribe}
534 %
535 % \begin{codestore}[10]
536 % \begin{equation}
537 % \integral[llimit={x^2 + y^2 \leq 1}, variables={x, y}]{f(x, y)}
538 % \end{equation}
539 % \end{codestore}
540 %
541 % \tsdemo*[intexgral]{10}
542 %
543 % \subsubsection{Recurring limits motif}
544 %
545 % Lower limits sometimes follow common patterns that can be generalised with keys, thus avoiding overloading the argument of \tsobj[key]{llimit}.
546 %
547 % \begin{codedescribe}[key, update={v3.0.0}]{domain, domain*}
548 % \begin{codesyntax}[key]
549 % \tsobj[key]{domain}=\tsargs[marg]{*-list}
550 % \tsobj[key]{domain*}=\tsargs[marg]{*-list}
551 % \end{codesyntax}
552 % These keys accept a list delimited by an asterisk. Each element of the list is then parsed as follows:
553 % \begin{itemize}
554 % \item The first token of the item is passed \tsobj[macro]{\mathbb} (preceded by \tsobj[macro]{\uppercase} in case the \textsc{shift} key is too far away for your fingers).
555 % \item The remaining tokens --- which may be empty --- are placed as superscript (or subscript for the starred variant of the key).
556 % \end{itemize}
557 % \end{codedescribe}
558 %
559 % \begin{codestore}[11]
560 % \begin{equation}
561 % \integral[symbol=\iint, domain={r*r}, variables={x, y}]{xy}
562 % \end{equation}
563 % \end{codestore}
564 %
565 % \tsdemo*[intexgral]{11}
566 %
567 % \begin{codedescribe}[key]{boundary}
568 % \begin{codesyntax}[key]
569 % \tsobj[key]{boundary}=\tsargs[marg]{lower limit}
570 % \end{codesyntax}
571 % This key simply places the symbol $\partial\,$ before the lower bound.
572 % \end{codedescribe}
573 %
574 % \begin{codestore}[12]
575 % \begin{equation}
576 % \integral[symbol=\oint, boundary=S, diff-vec]{G(\vec r)}
577 % \end{equation}
578 % \end{codestore}
579 %
580 % \tsdemo*[intexgral]{12}
581 %
582 % \subsection{Differentials}
583 %
584 % \subsubsection{Specifying the integration variables}\label{subsubsec:variables}
585 %
586 % \begin{codedescribe}[key, update={v3.0.0}]{variables}
587 % \begin{codesyntax}[key]
588 % \tsobj[key]{variables}=\tsargs[marg]{csv-list}, \tsobj[meta]{keyword}, \tsobj[option]{none}
589 % \end{codesyntax}
590 % This key allows you to define the variables of the integral in the form of a \tsobj[meta]{csv-list}. Like \tsobj[key]{limits}, the key can accept a keyword as an argument. This behaviour is also explained later (see \cref{subsec:variablekey}).
591 % \begin{tsremark}[\textcolor{RoyalGreen}{Remark:}]
592 % if no variable is specified, i.e. \tsobj[key]{variables} is not called, the package automatically sets \enquote{$\odif{x}$} (or \enquote{$\odif{\vec{r}}$} if \tsobj[key]{diff-vec} is active). Furthermore, if \tsobj[option]{none} is passed as a value, no variable will be displayed.
593 % \end{tsremark}
594 % \end{codedescribe}
595 %
596 % \begin{codestore}[13]
597 % \begin{equation}
598 % \integral[variables=t]{t^2}
599 % \end{equation}
600 % \end{codestore}
601 %
602 % \tsdemo*[intexgral]{13}
603 %
604 % \subsubsection{Inlcuding the Jacobian}
605 %
606 % \begin{codedescribe}[key]{jacobian}
607 % \begin{codesyntax}[key]
608 % \tsobj[key]{jacobian}
609 % \end{codesyntax}
610 % This key enables the display of the Jacobian when defined by \tsobj[macro]{\NewVariableKeyword}.
611 % \end{codedescribe}
612 %
613 % \begin{codestore}[14]
614 % \begin{equation}
615 % \integral[limits={0, R; 0, 2\pi; 0, \pi}, variables=spherical, mode=product, jacobian]{;;}
616 % \end{equation}
617 % \end{codestore}
618 %
619 % \tsdemo*[intexgral]{14}
620 %
621 % As mentioned earlier, \tsobj[pkg]{derivative} is used by the package to compose differentials. The set of keys to follow, whose names will be prefixed with \enquote{\texttt{diff-}}\footnote{Although the key \tsobj[key]{diff-vec} is not linked to \tsobj[pkg]{derivative}.}, thus allows you to apply the features of the macro \tsobj[macro]{\odif}.
622 %
623 % \subsubsection{Modifying the differential symbol}
624 %
625 % \begin{codedescribe}[key]{diff-symb}
626 % \begin{codesyntax}[key]
627 % \tsobj[key]{diff-symb}=\tsargs[meta]{differential macro}
628 % \end{codesyntax}
629 % This key allows you to change the style of differentials among those defined by \tsobj[macro]{\NewDifferential}.
630 % \end{codedescribe}
631 %
632 % \begin{codestore}[15]
633 % \NewDifferential{\feynmandiff}{\mathcal{D}}
634 % \begin{equation}
635 % \integral[variables={q(t)}, diff-symb=\feynmandiff]{e^{+\dfrac{\imath S[q(t)]}{\hbar}}}
636 % \end{equation}
637 % \end{codestore}
638 %
639 % \tsdemo*[intexgral]{15}
640 %
641 % \subsubsection{Creating a path integral}
642 %
643 % \begin{codedescribe}[key]{diff-vec}
644 % \begin{codesyntax}[key]
645 % \tsobj[key]{diff-vec}
646 % \end{codesyntax}
647 % This key applies a vector to each variable in addition to a centred dot. It is only compatible with the \tsobj[option]{default} mode.
648 % \end{codedescribe}
649 %
650 % \begin{codestore}[16]
651 % \begin{equation}
652 % \integral[double=S, variables=S, diff-vec]{\vec F}
653 % \end{equation}
654 % \end{codestore}
655 %
656 % \tsdemo*[intexgral]{16}
657 %
658 % \subsubsection{Opting for the starred variant}
659 %
660 % \begin{codedescribe}[key]{diff-star}
661 % \begin{codesyntax}[key]
662 % \tsobj[key]{diff-star}
663 % \end{codesyntax}
664 % Activating this key is equivalent to using \tsobj[macro]{\odif*} or its variants.
665 % \end{codedescribe}
666 %
667 % \begin{codestore}[17]
668 % \begin{equation}
669 % \integral[double, variables={x, y}, diff-star]{x^2 \exp(y)}
670 % \end{equation}
671 % \end{codestore}
672 %
673 % \tsdemo*[intexgral]{17}
674 %
675 % \subsubsection{Designating options}
676 %
677 % \begin{codedescribe}[key]{diff-options}
678 % \begin{codesyntax}[key]
679 % \tsobj[key]{diff-options}=\tsargs[marg]{keyval list}
680 % \end{codesyntax}
681 % This key accepts a list of keys as it would have been written as an optional argument of \tsobj[macro]{\odif} or its variants. For example, \verb|diff-options={order={2, 3}, var=all}| will be interpreted as \verb|\odif[order={2, 3}, var=all]{...}|.
682 % \end{codedescribe}
683 %
684 % \begin{codestore}[18]
685 % \begin{equation}
686 % \integral[diff-options={order=4}]{\bar\psi(x)(\imath\gamma^\mu\partial_\mu-m)\psi(x)}
687 % \end{equation}
688 % \end{codestore}
689 %
690 % \tsdemo*[intexgral]{18}
691 %
692 % \section{Additional macros}
693 %
694 % In addition to the wide range of keys defined by the package, a few macros also enhance their uses.
695 %
696 % \subsection{Custom differentials placement}
697 %
698 % \begin{codedescribe}[macro]{\differentials}
699 % \begin{codesyntax}[macro]
700 % \tsobj[macro]{\differentials}
701 % \end{codesyntax}
702 % Although the \tsobj[key]{invert-diff} option exists, it is often desirable to be able to place differentials wherever one wishes. For example, they are frequently seen in the numerator of a fraction when the numerator is 1. To meet this need, the package provides the macro \tsobj[macro]{\differentials}. For the \tsobj[option]{default} and \tsobj[option]{nested} modes, the macro typesets all differentials at once. With \tsobj[option]{product}, the macro must be repeated between each semicolon.
703
704 % \end{codedescribe}
705 %
706 % \begin{codestore}[19]
707 % \begin{equation}
708 % \integral{\frac{\differentials}{x}}
709 % \end{equation}
710 % \end{codestore}
711 %
712 % \tsdemo*[intexgral]{19}
713 %
714 % \subsection{Looking back at the \emph{limits} key}\label{subsec:limits}
715 %
716 % \begin{codedescribe}[macro]{\NewLimitsKeyword, \RenewLimitsKeyword, \ProvideLimitsKeyword, \DeclareLimitsKeyword}
717 % \begin{codesyntax}[macro]
718 % \tsobj[macro]{\NewLimitsKeyword}\tsargs[marg]{keyword}\tsargs[marg]{limits}
719 % \end{codesyntax}
720 % It is common to have to specify the same limits in an integral. To make them easier to write, the \tsobj[key]{limits(*)} keys accept, in addition to explicit limits, a keyword designating a pair of them predefined by one of these four macros:
721 % \begin{describelist*} {macro}
722 % \describe{\NewLimitsKeyword}{Creates a new keyword and issues an error if it already exists.}
723 % \describe{\RenewLimitsKeyword}{Redefines a keyword and issues an error if it does not already exist.}
724 % \describe{\ProvideLimitsKeyword}{Only creates a new keyword if it does not already exist. No message will be issued if this is the case.}
725 % \describe{\DeclareLimitsKeyword}{Creates a new keyword regardless, overwriting any previous definition.}
726 % \end{describelist*}
727 % Here is the list of keywords already defined by the package and the limits they contain:
728 % \begin{describelist*}{option}
729 % \describe{ab}{$a, b$}
730 % \describe{unit}{$0, 1$}
731 % \describe{real}{$-\infty, +\infty$}
732 % \describe{positive}{$0, +\infty$}
733 % \describe{negative}{$-\infty, 0$}
734 % \describe{circle}{$0, 2\pi$}
735 % \describe{sircle}{$0, \pi$}
736 % \describe{qcircle}{$0, \frac\pi 2$}
737 % \describe{height}{$0, H$}
738 % \describe{radius}{$0, R$}
739 % \describe{length}{$0, L$}
740 % \describe{time}{$0, T$}
741 % \end{describelist*}
742 % \begin{tsremark}[\textcolor{RoyalGreen}{Remark:}]
743 % keywords contain both limits of an integral at the same time. They must therefore be preceded and/or followed by semicolons.
744 % \end{tsremark}
745 % \begin{tsremark}[\textcolor{RoyalRed}{Important:}]
746 % due to the implementation of \tsobj[macro]{\NewLimitsKeyword} and its variants, the user \emph{must} follow the package's limit order convention, even if \tsobj[key]{invert-limits} is set to \tsobj[option]{true}
747 % \end{tsremark}
748 % We could therefore modify the expression of an integral as follows:
749 % \end{codedescribe}
750 %
751 % \begin{codestore}[20]
752 % \begin{equation}
753 % \integral[limits={radius;circle;scircle}, variables={\rho, z, \phi}]{\rho z \phi}
754 % \end{equation}
755 % \end{codestore}
756 %
757 % \tsdemo*[intexgral]{20}
758 %
759 % It is entirely possible to combine these keywords with the more explicit syntax of \tsobj[key]{limits}.
760 %
761 % \begin{codestore}[21]
762 % \begin{equation}
763 % \integral[limits={time; 34, 40; height}, variables={h, \omega, t}]{h \omega t}
764 % \end{equation}
765 % \end{codestore}
766 %
767 % \tsdemo*[intexgral]{21}
768 %
769 % \subsection{Looking back at the \emph{variables} key}\label{subsec:variablekey}
770 %
771 % \begin{codedescribe}[macro]{\NewVariableKeyword, \RenewVariableKeyword, \ProvideVariableKeyword, \DeclareVariableKeyword}
772 % \begin{codesyntax}[macro]
773 % \tsobj[macro]{\NewVariableKeyword}\tsargs[marg]{keyword}\tsargs[marg]{variables}\tsargs[oarg]{jacobian}
774 % \end{codesyntax}
775 % Similarly, the same groups of variables often reappear. We can therefore also define keywords containing a set of pre-registered variables. The variants of this macro behave in the same way as for \tsobj[macro]{\NewLimitsKeyword}. The only difference is that here it is possible to define a Jacobian, in the form of a \tsobj[meta]{csv-list} if necessary. Its display is then controlled by the \tsobj[key]{jacobian} key as explained above. Here is the list of variable keywords already defined by the package, with the Jacobian for some of them:
776 % \begin{describelist*}{option}
777 % \describe{cartesian}{$x, y, z$}
778 % \describe{planar}{$x, y$}
779 % \describe{polar}{$r, \theta \: (r)$}
780 % \describe{cylindrical}{$r, \theta, z \: (r)$}
781 % \describe{spherical}{$r, \theta, \phi \: (r^2, \sin\theta)$}
782 % \end{describelist*}
783 % \end{codedescribe}
784 %
785 % \begin{codestore}[22]
786 % \begin{equation}
787 % \integral[triple=V, variables=spherical]{f(x, y, z)}
788 % \end{equation}
789 % \end{codestore}
790 %
791 % \tsdemo*[intexgral]{22}
792 %
793 % \subsection{Looking back at the \emph{symbol} key}
794 %
795 % \begin{codedescribe}[macro, new={v3.0.0}]{\NewSymbolKeyword, \RenewSymbolKeyword, \ProvideSymbolKeyword, \DeclareSymbolKeyword}
796 % \begin{codesyntax}[macro]
797 % \tsobj[macro]{\NewSymbolKeyword}\tsargs[marg]{key}\tsargs[marg]{symbol}
798 % \end{codesyntax}
799 % In order to typeset indefinite integrals, the package essentially offers two keys: \tsobj[key]{symbol} and \tsobj[key]{llimit}. Although they are simple to use, it is still laborious to write both of them with their values. This is why \tsobj[pkg]{intexgral} provides so-called \emph{shortcut} keys, whose purpose is to combine the selection of the symbol and the limits. Unlike the two previous macros, this involves creating entirely new keys, rather than simply specific values assigned to \tsobj[key]{symbol}. On their own, these keys modify the integral symbol. The value of these keys corresponds to the lower bound. Here is the list of all \emph{symbol-key} defined by the package:
800 % \begin{describelist*}{key}
801 % \describe{single}{used symbol = \tsobj[macro]{\int}}
802 % \describe{double}{used symbol = \tsobj[macro]{\iint}}
803 % \describe{triple}{used symbol = \tsobj[macro]{\iiint}}
804 % \describe{quadruple}{used symbol = \tsobj[macro]{\iiiint}}
805 % \describe{contour}{used symbol = \tsobj[macro]{\oint}}
806 % \describe{surface}{used symbol = \tsobj[macro]{\oiint}}
807 % \describe{volume}{used symbol = \tsobj[macro]{\oiiint}}
808 % \end{describelist*}
809 % \begin{tsremark}[\textcolor{RoyalRed}{Important:}]
810 % allowing users to create their own keys for the \tsobj[macro]{\integral} macro poses a risk that will be explained in more detail in the next section. For now, just remember that all these macros\footnote{With the exception of \tsobj[macro]{\DeclareSymbolKeyword}, which assumes that the user knows what they are doing.} will issue a warning message if you attempt to create a new \emph{symbol-key} with the same name as a group of defined limits.
811 % \end{tsremark}
812 % \end{codedescribe}
813 %
814 % \begin{codestore}[23]
815 % \begin{equation}
816 % \integral[contour=\mathcal{C}, diff-vec]{f(\vec r)}
817 % \end{equation}
818 % \end{codestore}
819 %
820 % \tsdemo*[intexgral]{23}
821 %
822 % \section{\emph{Special} syntax}
823 %
824 % \subsection{Presentation of the syntax}
825 %
826 % \begin{codedescribe}[macro, new={v3.0.0}]{\integral}
827 % \begin{codesyntax}
828 % \tsmacro{\integral}[limits:variables(+j):mode]{integrand}
829 % \end{codesyntax}
830 % With regard to definite integrals, the user will be required to use a maximum of four keys to compose them: \tsobj[key]{limits}, \tsobj[key]{variables}, \tsobj[key]{mode} and \tsobj[key]{jacobian}. However, they can be criticised for the same reason as before; writing these four keys, which can take quite long arguments, runs counter to the main objective of this package. Thus, the user can designate as an optional argument of \tsobj[macro]{\integral} a syntax called \emph{special} that is unique to \tsobj[pkg]{intexgral}. The logic is as follows:
831 % \begin{itemize}
832 % \item You specify a \emph{valid} argument for the \tsobj[key]{limits} key.
833 % \item You specify a \emph{valid} argument for the \tsobj[key] {variables}
834 % \item You specify a \emph{valid} argument for the \tsobj[key]{mode} key
835 % \end{itemize}
836 % And you separate everything with a colon. Let's look at an example to better understand.
837 % \end{codedescribe}
838 %
839 % \begin{codestore}[24]
840 % \begin{equation}
841 % \integral[1, 2; 4, 5:y, x:nested]{x; y}
842 % \end{equation}
843 % \end{codestore}
844 %
845 % \tsdemo*[intexgral]{24}
846 %
847 % We mean by \emph{valid argument} that all forms of values accepted by the four keys can also be likewise adopted by the special syntax. This hence includes keywords.
848 %
849 % \begin{codestore}[25]
850 % \begin{equation}
851 % \integral[radius;circle;scircle:spherical:product]{r;\theta;\phi}
852 % \end{equation}
853 % \end{codestore}
854 %
855 % \tsdemo*[intexgral]{25}
856 %
857 % To include the Jacobian, simply write \texttt{+j} after the argument of \tsobj[key]{variables}. The mode can also be indicated using only an initial.
858 %
859 % \begin{codestore}[26]
860 % \begin{equation}
861 % \integral[radius;circle;scircle:spherical+j:p]{;;}
862 % \end{equation}
863 % \end{codestore}
864 %
865 % \tsdemo*[intexgral]{26}
866 %
867 % It is important to reiterate that in the classic configuration of the optional argument, it is of course not mandatory to specify the four keys mentioned. The same applies to this syntax. Since the key \tsobj[key]{mode} is not necessary for \tsobj[option]{default}, this part can be omitted.
868 %
869 % \begin{codestore}[27]
870 % \begin{equation}
871 % \integral[1, 2; 3, 4:x, y]{xy}
872 % \end{equation}
873 % \end{codestore}
874 %
875 % \tsdemo*[intexgral]{27}
876 %
877 % You can also take advantage of the automatic placement of \enquote{$\odif{x}$} with this syntax, ignoring \tsobj[key]{variables}.
878 %
879 % \begin{codestore}[28]
880 % \begin{equation}
881 % \integral[1, 10]{x}
882 % \end{equation}
883 % \end{codestore}
884 %
885 % \tsdemo*[intexgral]{28}
886 %
887 % \subsection{Functioning of the syntax}
888 %
889 % From the user's point of view, it is relatively simple to choose which syntax to adopt. However, the package must be able to distinguish between the two. Without going into too much detail\footnote{The more courageous among you are still invited to read the source code.} about the implementation, it is brought to your attention that the package attempts to extract the first key from the optional argument\footnote{Or at least, the group of tokens that it thinks corresponds to a key.} and checks whether it exists. This is why, if you create a key with \tsobj[macro]{\NewSymbolKeyword} whose name can probably be used as integration limits, \tsobj[pkg]{intexrgal} may incorrectly evaluate the nature of the optional argument.
890 %
891 % \section{Additional parameters}
892 %
893 % \begin{codedescribe}[macro, new={v3.0.0}]{\IntegralSetup}
894 % \begin{codesyntax}[macro]
895 % \tsmacro{\IntegralSetup}{parameter list}
896 % \end{codesyntax}
897 % This macro allows you to modify parameters related to certain keys using the syntax \tsobj[meta]{key=value}. All assignments made are local, so the macro can be placed in a group if necessary. Here is an example of the macro with the package's default assignments:
898 % \end{codedescribe}
899 %
900 % \begin{codestore}[defaultparam]
901 % \IntegralSetup
902 % {
903 % defaultvar = {x},
904 % defaultvar* = {r},
905 % vectorstyle = \vec,
906 % domainstyle = \mathbb,
907 % symbolskip = {-6mu},
908 % hide-diff = false
909 % }
910 % \end{codestore}
911 %
912 % \tscode*[intexgral]{defaultparam}
913 %
914 % \begin{codedescribe}[key]{defaultvar, defaultvar*}
915 % \begin{codesyntax}[key]
916 % \tsobj[key]{defaultvar}=\tsargs[marg]{variables}
917 % \end{codesyntax}
918 % This key modifies the variable automatically inserted when \tsobj[key]{variables} is not used. The argument may correspond to a keyword defined by \tsobj[macro]{\NewVariableKeyword}. The starred variant of the key controls the integration parameter to be typeset with \tsobj[key]{diff-vec}.
919 % \end{codedescribe}
920 %
921 % \begin{codedescribe}[key]{vectorstyle}
922 % \begin{codesyntax}[key]
923 % \tsobj[key]{vectorstyle}=\tsobj[meta]{control sequence}
924 % \end{codesyntax}
925 % This key modifies the macro to be applied to variables when \tsobj[key]{diff-vec} is in action. It is therefore possible to alter the style of the vector: bold, underlined, or even another style from a particular package, \tsobj[pkg]{esvect} for example.
926 % \end{codedescribe}
927 %
928 % \begin{codedescribe}[key]{domainstyle}
929 % \begin{codesyntax}[key]
930 % \tsobj[key]{domainstyle}=\tsobj[meta]{control sequence}
931 % \end{codesyntax}
932 % Similarly, you can change the macro to be applied for keys \tsobj[key]{domain(*)}.
933 % \end{codedescribe}
934 %
935 % \begin{codedescribe}[key]{symbolskip}
936 % \begin{codesyntax}[key]
937 % \tsobj[key]{symbolskip}=\tsobj[meta]{muexpr}
938 % \end{codesyntax}
939 % When the \tsobj[option]{default} mode is in effect, the package inserts kerning between symbols to bring them slightly closer together. The default dimension ($-6$mu) can thus be adjusted according to the mathematical font in use.
940 % \end{codedescribe}
941 %
942 % \begin{codedescribe}[key]{hide-diff}
943 % \begin{codesyntax}[key]
944 % \tsobj[key]{hide-diff}=\tsobj[option, meta or]{true,\uline{false}}
945 % \end{codesyntax}
946 % When a large part of the document requires differentials not to be included, it is possible to extend the more specific action of \tsobj[key]{variables}\texttt{=}\tsobj[option]{none} over time.
947 % \end{codedescribe}
948 %
949 % \newpage
950 %
951 % \phantomsection
952 % \addcontentsline{toc}{section}{Changelog}
953 % \begin{changelog}[sectioncmd=\section*]
954
955 % \begin{version}[v=3.0.1, date=02-01-2026]
956 % \fixed
957 % \item Bug with jacobian in special syntax (\href{https://github.com/ankaa3908/intexgral/issues/3}{issue \#3}).
958 % \item French and English documentations (\href{https://github.com/ankaa3908/intexgral/issues/4}{issue \#4}, \href{https://github.com/ankaa3908/intexgral/issues/6}{issue \#6} and \href{https://github.com/ankaa3908/intexgral/issues/7}{issue \#7}).
959 % \changed
960 % \item Limits keywords \tsobj[option]{positive} and \tsobj[option]{real} now contain a $+$ sign (\href{https://github.com/ankaa3908/intexgral/issues/5}{issue \#5}).
961 % \end{version}
962 %
963 % \begin{version}[v=3.0.0, date=24-12-2025]
964 % \added
965 % \item Special syntax.
966 % \item Keys \tsobj[key]{domain*} and \tsobj[key]{mode}.
967 % \item Macros \tsobj[macro]{\IntegralSetup} and \tsobj[macro]{\NewSymbolKeyword}.
968 % \removed
969 % \item Macros \tsobj[macro]{\defaultdiff}, \tsobj[macro]{\defaultdiff}, \tsobj[macro]{\defaultvdiff} et \tsobj[macro]{\vdiffstyle} in favour of \tsobj[macro]{\IntegralSetup}.
970 % \item Keys controlling both symbol and limit, now managed at a higher level by \tsobj[macro]{\NewSymbolKeyword}.
971 % \item \tsobj[key]{int-split} key, in favour of \tsobj[key]{mode}.
972 % \item \tsobj[macro]{\NewInegralSymbol} macro.
973 % \changed
974 % \item The names of some keys (\tsobj[key]{variable} in \tsobj[key]{variables}, \tsobj[key]{lower-lim} and \tsobj[key]{upper-lim} in \tsobj[key]{llimit} and \tsobj[key]{ulimit}, \tsobj[key]{int-symb} in \tsobj[key]{symbol}, \tsobj[key]{invert-differintials} and \tsobj[key]{hide-differentials} in \tsobj[key]{invert-diff} and \tsobj[key]{hide-diff}).
975 % \item \tsobj[key]{jacobian} and \tsobj[key]{diff-star} no longer require a boolean value. Simply writing them will now enable their features.
976 % \item \tsobj[key]{hide-diff} assigned to a local option rather than a package one.
977 % \item \tsobj[key]{limits-mode} assigned to a package option rather than a macro key
978 % \end{version}
979 %
980 % \begin{version}[v=v2.0.1, date=13-09-2025]
981 % \fixed
982 % \item Compatibiliy issue between unicode-math and amssyb depending on the loading order (\href{https://github.com/ankaa3908/intexgral/issues/2}{problem \#2}).
983 % \end{version}
984 %
985 % \begin{version}[v=2.0.0, date=09-09-2025]
986 % \added
987 % \item Macros \tsobj[macro]{\intexgralsetup}, \tsobj[macro]{\defaultdiff},\tsobj[macro]{\defaultvdiff} and \tsobj[macro]{\vdiffstyle}.
988 % \changed
989 % \item Warning messages related to non-existing symbols. They are now only triggered when the integral is typeset.
990 % \removed
991 % \item \tsobj[key]{diff-vec-style} key in favour of \tsobj[macro]{\vdiffstyle}.
992 % \item Warning message about misuse of semi-colon in conjunction with the \tsobj[key]{int-split} key.
993 % \fixed
994 % \item Bug where the integrand was not reset when \tsobj[macro]{\integral} was used successively in the same \TeX\ group (\href{https://tex.stackexchange.com/questions/749990/issue-with-integral-command-from-intexgral-package-in-math-mode}{details here}).
995 % \item \tsobj[pkg]{expl3} log leftovers that shouldn't have been there.
996 % \end{version}
997 %
998 % \begin{version}[v=1.1.0, date=29-07-2025]
999 % \added
1000 % \item Starred variatn for the keys controlling both symbol and limit (keys \tsobj[key]{single}, \tsobj[key]{contour} etc).
1001 % \end{version}
1002 %
1003 % \shortversion{v=1.0.0, date=26-07-2025, changes=Initial version.}
1004 %
1005 % \end{changelog}
1006 %
1007 % \newpage
1008 %
1009 % \phantomsection
1010 % \PrintIndex
1011 %
1012 % \newpage
1013 %
1014 % \section*{Implementation}
1015 % \phantomsection
1016 % \addcontentsline{toc}{section}{Implementation}
1017 % \CodelineNumbered
1018 %
1019 % The implementation will be explained in more detail in a later version\dots
1020 %
1021 % \begin{macrocode}
1022 %<*package>
1023 %<@@=intexgral>
1024 \NeedsTeXFormat{LaTeX2e}
1025 \RequirePackage{expl3}[2025-05-14]
1026 \RequirePackage{pkginfograb}
1027
1028 % Package declaration
1029
1030 \pkginfograbProvidesExplPackage{intexgral}
1031 {
1032 name = {intexgral} ,
1033 author = {Valentin Dao},
1034 date = {2026-01-02} ,
1035 creation = {2025-07-26} ,
1036 version = {3.0.1} ,
1037 description = {A LaTeX package for typesetting integrals.}
1038 }
1039
1040 \msg_new:nnn { intexgral } { expl3-too-old }
1041 {
1042 Your~expl3~installation~is~too~old,~
1043 "intexgral"~requires~expl3~dated~2025-05-14~or~later.\iow_newline:
1044 Package~loading~has~been~aborted.\iow_newline:
1045 \msg_see_documentation_text:n { intexgral }
1046 }
1047
1048 % expl3 version verification
1049
1050 \@ifpackagelater{expl3}{2025-05-14}{}
1051 { \msg_critical:nn { intexgral } { expl3-too-old } }
1052
1053 % Verifies is \mathbb is defined (default domain style)
1054
1055 \hook_gput_code:nnn { begindocument/before } { . }
1056 { \cs_if_exist:NF \mathbb { \RequirePackage{amsfonts} } }
1057
1058 % Definition of data types for package options
1059
1060 \bool_new:N \l_@@_invert_limits_bool
1061 \bool_new:N \l_@@_deactivate_differentials_bool
1062 \bool_new:N \l_@@_invert_differentials_bool
1063 \tl_new:N \l_@@_limits_style_tl
1064
1065 % Package options
1066
1067 \keys_define:nn { intexgral }
1068 {
1069 invert-limits .bool_set:N = \l_@@_invert_limits_bool,
1070 invert-limits .usage:n = { preamble },
1071 invert-limits .initial:n = { false },
1072
1073 invert-diff .bool_set:N = \l_@@_invert_differentials_bool,
1074 invert-diff .usage:n = { preamble },
1075 invert-diff .initial:n = { false },
1076
1077 limits-mode .choice:,
1078 limits-mode / limits .code:n =
1079 { \tl_set_eq:NN \l_@@_limits_style_tl \tex_limits:D },
1080 limits-mode / nolimits .code:n =
1081 { \tl_set_eq:NN \l_@@_limits_style_tl \tex_nolimits:D },
1082
1083 limits-mode .usage:n = { preamble },
1084 limits-mode .initial:n = { nolimits },
1085
1086 italic .choice:,
1087 italic / true .code:n =
1088 { \PassOptionsToPackage{italic=true}{derivative} },
1089 italic / false .code:n =
1090 { \PassOptionsToPackage{italic=false}{derivative} },
1091
1092 upright .choice:,
1093 upright / true .code:n =
1094 { \PassOptionsToPackage{upright=true}{derivative} },
1095 upright / false .code:n =
1096 { \PassOptionsToPackage{upright=false}{derivative} },
1097 }
1098
1099 % Loads the package options and "derivative" package
1100
1101 \ProcessKeyOptions[intexgral]
1102
1103 \RequirePackage{derivative}
1104
1105 % Warning/Error/Info messages
1106
1107 \cs_new:Nn \@@_warning_msg_header: {
1108 (
1109 integral~no.~
1110 \int_use:N\g_@@_integral_number_int\c_space_tl
1111 \msg_line_context:
1112 )
1113 \iow_newline:
1114 }
1115
1116 \msg_new:nnnn { intexgral } { symb-key-alr-def }
1117 { Symbol~key~"\tl_trim_spaces:n{#1}"~is~already~defined. }
1118 { Use~\token_to_str:N \RenewSymbolKeyword\ instead. }
1119
1120 \msg_new:nnnn { intexgral } { symb-key-not-def }
1121 { Symbol~key~"\tl_trim_spaces:n{#1}"~is~not~defined. }
1122 { Use~\token_to_str:N \NewSymbolKeyword\ instead. }
1123
1124 \msg_new:nnnn { intexgral } { diff-group-alr-def }
1125 { Differential~group~"\tl_trim_spaces:n{#1}"~is~already~defined. }
1126 { Use~\token_to_str:N \RenewVarKeyword\ instead. }
1127
1128 \msg_new:nnnn { intexgral } { diff-group-not-def }
1129 { Differential~group~"\tl_trim_spaces:n{#1}"~is~not~defined. }
1130 { Use~\token_to_str:N \NewVarKeyword\ instead. }
1131
1132 \msg_new:nnnn { intexgral } { lim-group-alr-def }
1133 { Limits~group~"\tl_trim_spaces:n{#1}"~is~already~defined. }
1134 { Use~\token_to_str:N \RenewLimitsKeyword\ instead. }
1135
1136 \msg_new:nnnn { intexgral } { lim-group-not-def }
1137 { Limits~group~"\tl_trim_spaces:n{#1}"~is~not~defined. }
1138 { Use~\NewLimitsKeyword\ instead. }
1139
1140 \msg_new:nnn { intexgral } { key-exists-for-lim }
1141 {
1142 Symbol~key~already~defined~with~
1143 \token_to_str:N \NewLimitsKeyword\ \@@_warning_msg_header:
1144 Key~"#1"~already~exists~for~predefined~limits.~
1145 This~can~disrupt~the~functioning~of~the~special~syntax.
1146 }
1147
1148 \msg_new:nnn { intexgral } { unknown-symb }
1149 {
1150 Unknown~integral~symbol~\@@_warning_msg_header:
1151 The~symbol~\tl_trim_spaces:n{#1}~has~been~replaced~with~
1152 \token_to_str:N\int.
1153 }
1154
1155 \msg_new:nnn { intexgral } { unequal-dim }
1156 {
1157 Inconsistent~structure~\@@_warning_msg_header:
1158 The~number~of~integrals~(#1),~integrands~(#2),~and~
1159 differentials~(#3)~does~not~match.
1160 }
1161
1162 \msg_new:nnn { intexgral } { no-jacobian }
1163 {
1164 Jacobian~unavailable~\@@_warning_msg_header:
1165 A~Jacobian~was~requested~for~the~"#1"~keyword,
1166 ~but~none~was~declared~for~the~latter.
1167 }
1168
1169 \msg_new:nnn { intexgral } { diff-not-sup }
1170 {
1171 Macro~\token_to_str:N\differentials\
1172 not~supported~\@@_warning_msg_header:
1173 You~can't~use~\token_to_str:N\differentials\
1174 with~"nested"~mode~alongside~inverted~differentials.~
1175 I~will~simply~ignore~them.
1176 }
1177
1178 \msg_new:nnn { intexgral } { diff-vec-not-supp }
1179 {
1180 Key~"diff-vec"~not~supported~\@@_warning_msg_header:
1181 You~can't~use~"diff-vec"~with~"#1"~mode.~I~will~simply~ignore~this~key.
1182 }
1183
1184 \msg_new:nnn { intexgral } { use-glyph-instead }
1185 {
1186 Consider~using~the~dedicated~glyph~\@@_warning_msg_header:
1187 The~key~"nint"~was~used~with~fewer~than~
1188 5~regular~integral~signs.
1189 }
1190
1191 % Argument specifiers variants
1192
1193 \cs_generate_variant:Nn \regex_if_match:nnTF { nVTF }
1194 \cs_generate_variant:Nn \@@_new_limits_group:nn { nV }
1195 \cs_generate_variant:Nn \str_if_eq:nnTF { neTF }
1196 \cs_generate_variant:Nn \str_if_eq:nnF { neF }
1197 \cs_generate_variant:Nn \keys_if_exist:nnTF { nVTF }
1198 \cs_generate_variant:Nn \seq_use:Nn { Ne }
1199 \cs_generate_variant:Nn \str_if_eq_p:nn { en }
1200
1201 % DATA TYPES
1202
1203 \tl_new:N \l_@@_key_name_tl
1204 \tl_new:N \l_@@_integrand_tl
1205 \tl_new:N \l_@@_domain_style_tl
1206 \tl_new:N \l_@@_lower_limit_tl
1207 \tl_new:N \l_@@_upper_limit_tl
1208 \tl_new:N \l_@@_integral_symbol_tl
1209 \tl_new:N \l_@@_differential_options_i_tl
1210 \tl_new:N \l_@@_differential_options_ii_tl
1211 \tl_new:N \l_@@_vectorial_differential_style_tl
1212 \tl_new:N \l_@@_independent_differential_options_tl
1213 \tl_new:N \l_@@_domain_char_tl
1214 \tl_new:N \l_@@_domain_dimension_tl
1215 \tl_new:N \l_@@_default_differential_tl
1216 \tl_new:N \l_@@_default_vector_differential_tl
1217 \tl_const:Nn \c_@@_left_bracket_tl { [ }
1218 \tl_const:Nn \c_@@_right_bracket_tl { ] }
1219
1220 \tl_set_eq:NN \l_@@_integral_symbol_tl \int
1221
1222 \bool_new:N \l_@@_manual_differentials_bool
1223 \bool_new:N \l_@@_custom_variables_bool
1224 \bool_new:N \l_@@_separate_integral_bool
1225 \bool_new:N \l_@@_vectorial_differential_bool
1226 \bool_new:N \l_@@_jacobian_bool
1227 \bool_new:N \l_@@_starred_differential_bool
1228 \bool_new:N \l_@@_has_order_bool
1229 \bool_new:N \l_@@_has_var_bool
1230
1231 \bool_set_false:N \l_@@_vectorial_differential_bool
1232 \bool_set_false:N \l_@@_manual_differentials_bool
1233 \bool_set_false:N \l_@@_custom_variables_bool
1234 \bool_set_false:N \l_@@_separate_integral_bool
1235 \bool_set_false:N \l_@@_has_order_bool
1236 \bool_set_false:N \l_@@_has_var_bool
1237
1238 \clist_new:N \l_@@_variable_i_clist
1239 \clist_new:N \l_@@_variable_ii_clist
1240
1241 \seq_new:N \l_@@_integrand_seq
1242 \seq_new:N \l_@@_integral_symbol_seq
1243 \seq_new:N \l_@@_jacobian_seq
1244 \seq_new:N \l_@@_differential_seq
1245 \seq_new:N \l_@@_limits_seq
1246 \seq_new:N \l_@@_upper_limits_seq
1247 \seq_new:N \l_@@_lower_limits_seq
1248 \seq_new:N \l_@@_differential_var_i_seq
1249 \seq_new:N \l_@@_differential_var_ii_seq
1250 \seq_new:N \l_@@_differential_order_i_seq
1251 \seq_new:N \l_@@_differential_order_ii_seq
1252 \seq_new:N \l_@@_domain_seq
1253
1254 \str_new:N \l_@@_display_mode_str
1255
1256 \muskip_new:N \l_@@_inline_symbol_muskip
1257
1258 \prop_new:N \g_@@_limits_keyword_prop
1259 \prop_new:N \g_@@_differential_group_keyword_prop
1260
1261 \int_new:N \l_@@_integral_sequence_int
1262 \int_gzero_new:N \g_@@_integral_number_int
1263
1264 % TeX macros adapted to expl3 syntax
1265
1266 \cs_new_protected:Npn \@@_mkern:N #1
1267 { \tex_mkern:D #1 \scan_stop: }
1268
1269 \cs_new_protected:Npn \@@_mathchoice:nnnn #1#2#3#4
1270 { \mathchoice{#1}{#2}{#3}{#4} }
1271
1272 % SYMBOL
1273
1274 % General form of the symbol (glyph, limits mode, lower limit, upper limit)
1275
1276 \cs_new_protected:Npn \@@_parse_integral_symbol:
1277 {
1278 \tl_use:N \l_@@_integral_symbol_tl
1279 \tl_use:N \l_@@_limits_style_tl
1280 \c_math_subscript_token
1281 { \l_@@_lower_limit_tl }
1282 \c_math_superscript_token
1283 { \l_@@_upper_limit_tl }
1284 }
1285
1286 % Generates the symbols after <limits> is executed
1287
1288 \cs_new_protected:Nn \@@_generate_integral_sequence:
1289 {
1290 \int_set:Nn \l_@@_integral_sequence_int
1291 {
1292 \seq_if_empty:NTF \l_@@_lower_limits_seq
1293 { \seq_count:N \l_@@_upper_limits_seq }
1294 { \seq_count:N \l_@@_lower_limits_seq }
1295 }
1296 \exp_args:NV
1297 \int_step_inline:nn \l_@@_integral_sequence_int
1298 {
1299 \seq_put_right:Nn \l_@@_integral_symbol_seq
1300 {
1301 \@@_set_limits:nn
1302 { \seq_item:Nn \l_@@_lower_limits_seq { ##1 } }
1303 { \seq_item:Nn \l_@@_upper_limits_seq { ##1 } }
1304 \@@_parse_integral_symbol:
1305 }
1306 }
1307 }
1308
1309 % LIMITS
1310
1311 % Inverts the limit order convention
1312
1313 \cs_new_protected:Npn \@@_set_limits:nn #1#2
1314 {
1315 \bool_if:NTF \l_@@_invert_limits_bool
1316 {
1317 \tl_set:Nn \l_@@_lower_limit_tl { #2 }
1318 \tl_set:Nn \l_@@_upper_limit_tl { #1 }
1319 }
1320 {
1321 \tl_set:Nn \l_@@_lower_limit_tl { #1 }
1322 \tl_set:Nn \l_@@_upper_limit_tl { #2 }
1323 }
1324 }
1325
1326 % Creates a keyword containing predefined limits
1327
1328 \cs_new_protected:Npn \@@_new_limits_group:nn #1#2
1329 { \prop_put:Nnn \g_@@_limits_keyword_prop { #1 } { #2 } }
1330
1331 % Verifies if the argument corresponds to a valid keyword
1332
1333 \cs_new:Npn \@@_parse_integral_limit:n #1
1334 {
1335 \prop_if_in:NnTF \g_@@_limits_keyword_prop { #1 }
1336 { \prop_item:Nn \g_@@_limits_keyword_prop { #1 } }
1337 { #1 }
1338 }
1339
1340 % Splits the argument of the key to prepare for parsing
1341
1342 \cs_new_protected:Npn \@@_parse_limits:n #1
1343 {
1344 \tl_set:Nn \l_tmpa_tl { #1 }
1345 \seq_clear:N \l_@@_lower_limits_seq
1346 \seq_clear:N \l_@@_upper_limits_seq
1347 \seq_set_split:NnV \l_@@_limits_seq { ; } \l_tmpa_tl
1348 }
1349
1350 % Limits under regular form
1351
1352 \cs_new_protected:Nn \@@_set_limits_regular:
1353 {
1354 \seq_map_inline:Nn \l_@@_limits_seq
1355 {
1356 \clist_set:Ne \l_tmpa_clist
1357 { \@@_parse_integral_limit:n { ##1 } }
1358 \seq_put_right:Ne \l_@@_lower_limits_seq
1359 { \clist_item:Nn \l_tmpa_clist { 1 } }
1360 \seq_put_right:Ne \l_@@_upper_limits_seq
1361 { \clist_item:Nn \l_tmpa_clist { 2 } }
1362 }
1363 }
1364
1365 % Limits under interval form
1366
1367 \cs_new_protected:Npn \@@_set_limits_starred:
1368 {
1369 \seq_map_indexed_inline:Nn \l_@@_limits_seq
1370 {
1371 \clist_set:Ne \l_tmpa_clist
1372 { \@@_parse_integral_limit:n { ##2 } }
1373 \bool_if:NTF \l_@@_invert_limits_bool
1374 {
1375 \tl_set:Ne \l_@@_lower_limit_tl
1376 {
1377 \clist_item:Nn \l_tmpa_clist { 2 }
1378 \tex_mathpunct:D,
1379 \clist_item:Nn \l_tmpa_clist { 1 }
1380 }
1381 }
1382 {
1383 \tl_set:Ne \l_@@_lower_limit_tl
1384 {
1385 \clist_item:Nn \l_tmpa_clist { 1 }
1386 \tex_mathpunct:D,
1387 \clist_item:Nn \l_tmpa_clist { 2 }
1388 }
1389 }
1390 \bool_if:NTF \l_@@_invert_limits_bool
1391 { \seq_put_right:Ne \l_@@_upper_limits_seq }
1392 { \seq_put_right:Ne \l_@@_lower_limits_seq }
1393 {
1394 \str_case_e:nnF { \clist_item:Nn \l_tmpa_clist { 1 } }
1395 {
1396 { -\infty } { \tex_left:D \c_@@_right_bracket_tl }
1397 }
1398 { \tex_left:D \c_@@_left_bracket_tl }
1399 \tl_use:N \l_@@_lower_limit_tl
1400 \str_case_e:nnF { \clist_item:Nn \l_tmpa_clist { 2 } }
1401 {
1402 { +\infty } { \tex_right:D \c_@@_left_bracket_tl }
1403 }
1404 { \tex_right:D \c_@@_right_bracket_tl }
1405 }
1406 }
1407 }
1408
1409 % VARIABLES
1410
1411 % Creates a keyword containing predefined variables
1412
1413 \cs_new_protected:Npn \@@_new_differential_group:nnn #1#2#3
1414 {
1415 \prop_put:Nnn \g_@@_differential_group_keyword_prop
1416 { #1 } { #2 }
1417 \tl_if_blank:nF { #3 }
1418 {
1419 \clist_set:Nn \l_tmpa_clist { #3 }
1420 \seq_set_from_clist:cN
1421 { g_@@_#1_jacobian_seq }
1422 \l_tmpa_clist
1423 }
1424 }
1425
1426 % expl3 equivalent of \odif(*)
1427
1428 \cs_new:Npn \@@_differentials:nn #1#2
1429 {
1430 \bool_if:NTF \l_@@_starred_differential_bool
1431 { \odif*[#1]{#2} }
1432 { \odif[#1]{#2} }
1433 }
1434
1435 % Extracts the whole "order" <keyval>
1436
1437 \cs_new_protected:Npn \@@_extract_differential_order:n #1
1438 {
1439 \regex_extract_once:nnNT
1440 { order\s*=\s*\{?\s*(\d+(?:\s*,\s*\d+)*)\s*\}? }
1441 { #1 } \l_@@_differential_order_i_seq
1442 { \bool_set_true:N \l_@@_has_order_bool }
1443 \clist_set:Ne \l_tmpa_clist
1444 { \seq_item:Nn \l_@@_differential_order_i_seq { 2 } }
1445 \seq_set_from_clist:NN
1446 \l_@@_differential_order_ii_seq
1447 \l_tmpa_clist
1448 }
1449
1450 % Extracts the whole "var" <keyval>
1451
1452 \cs_new_protected:Npn \@@_extract_differential_var:n #1
1453 {
1454 \regex_extract_once:nnNTF
1455 { var\s*=\s*(none|all|\{\s*(\d+(?:\s*,\s*\d+)*\s*)\}) }
1456 { #1 }
1457 \l_@@_differential_var_i_seq
1458 { \bool_set_true:N \l_@@_has_var_bool }
1459 {
1460 \str_if_in:nnT { #1 } { var }
1461 {
1462 \seq_put_left:Nn \l_@@_differential_var_i_seq { var }
1463 \bool_set_true:N \l_@@_has_var_bool
1464 }
1465 }
1466 \clist_set:Ne \l_tmpa_clist
1467 { \seq_item:Nn \l_@@_differential_var_i_seq { 3 } }
1468 \seq_set_from_clist:NN
1469 \l_@@_differential_var_ii_seq
1470 \l_tmpa_clist
1471 }
1472
1473 % Extracts all keys other than "order" and "var"
1474
1475 \cs_new_protected:Npn \@@_remove_differential_order_and_var:n #1
1476 {
1477 \tl_set:Nn \l_@@_independent_differential_options_tl { #1 }
1478 \regex_replace_all:nnN
1479 {
1480 order\s*=\s*\{?\s*\d+(\s*,\s*\d+)*\s*\}?\s*,?
1481 |
1482 [^-]var(?:\s*=\s*(?:none|all|\{\s*\d+(?:\s*,\s*\d+)*\s*\}))?,?
1483 }
1484 { }
1485 \l_@@_independent_differential_options_tl
1486 }
1487
1488 % Reassembles the variables
1489
1490 \cs_new_protected:Npn \@@_parse_variable:nn #1#2
1491 {
1492 \clist_set:Nn \l_tmpa_clist { #2 }
1493 \seq_set_from_clist:NN \l_tmpa_seq \l_tmpa_clist
1494 \tl_if_empty:nF { #1 }
1495 {
1496 \@@_extract_differential_order:n { #1 }
1497 \@@_extract_differential_var:n { #1 }
1498 \@@_remove_differential_order_and_var:n { #1 }
1499 }
1500 \seq_map_indexed_inline:Nn \l_tmpa_seq {
1501 \tl_if_empty:nF { #1 }
1502 {
1503 \tl_put_right:NV
1504 \l_@@_differential_options_ii_tl
1505 \l_@@_independent_differential_options_tl
1506 \bool_if:NT \l_@@_has_order_bool
1507 {
1508 \tl_put_right:Ne \l_@@_differential_options_ii_tl
1509 {
1510 ,order=
1511 \seq_item:Nn \l_@@_differential_order_ii_seq { ##1 }
1512 }
1513 }
1514 \bool_if:NT \l_@@_has_var_bool
1515 {
1516 \int_compare:nNnTF
1517 { \seq_count:N \l_@@_differential_var_i_seq }
1518 =
1519 { 1 }
1520 {
1521 \tl_put_right:Nn
1522 \l_@@_differential_options_ii_tl
1523 { var }
1524 }
1525 {
1526 \str_if_eq:neF { none }
1527 { \seq_item:Nn \l_@@_differential_var_i_seq { 2 } }
1528 {
1529 \str_if_eq:neTF { all }
1530 { \seq_item:Nn
1531 \l_@@_differential_var_i_seq
1532 { 2 }
1533 }
1534 {
1535 \tl_put_right:Nn
1536 \l_@@_differential_options_ii_tl
1537 { var }
1538 }
1539 {
1540 \seq_if_in:NnT
1541 \l_@@_differential_var_ii_seq
1542 { ##1 }
1543 {
1544 \seq_pop_left:NN
1545 \l_@@_differential_var_ii_seq
1546 \l_tmpa_tl
1547 \tl_put_right:Nn
1548 \l_@@_differential_options_ii_tl
1549 { ,var }
1550 }
1551 }
1552 }
1553 }
1554 }
1555 }
1556 \seq_put_right:Ne \l_@@_differential_seq
1557 {
1558 \@@_differentials:nn
1559 { \exp_not:V \l_@@_differential_options_ii_tl }
1560 { \seq_item:Nn \l_tmpa_seq { ##1 } }
1561 }
1562 \tl_clear:N \l_@@_differential_options_ii_tl
1563 }
1564 }
1565
1566 % Executes all previous macros to push tokens into the variable sequence
1567
1568 \cs_new_protected:Npn \@@_parse_differentials:
1569 {
1570 \bool_if:NTF \l_@@_vectorial_differential_bool
1571 {
1572 \clist_map_inline:Nn \l_@@_variable_i_clist
1573 {
1574 \clist_put_right:Nn \l_@@_variable_ii_clist
1575 { \l_@@_vectorial_differential_style_tl{##1} }
1576 }
1577 \bool_if:NTF \l_@@_custom_variables_bool
1578 {
1579 \exp_args:NVV \@@_parse_variable:nn
1580 \l_@@_differential_options_i_tl
1581 \l_@@_variable_ii_clist
1582 }
1583 {
1584 \exp_args:NV \@@_parse_variable:nn
1585 \l_@@_differential_options_i_tl
1586 {
1587 \l_@@_vectorial_differential_style_tl
1588 { \l_@@_default_vector_differential_tl }
1589 }
1590 }
1591 }
1592 {
1593 \bool_if:NTF \l_@@_custom_variables_bool
1594 {
1595 \exp_args:NVV \@@_parse_variable:nn
1596 \l_@@_differential_options_i_tl
1597 \l_@@_variable_i_clist
1598 }
1599 {
1600 \exp_args:NV \@@_parse_variable:nn
1601 \l_@@_differential_options_i_tl
1602 { \l_@@_default_differential_tl }
1603 }
1604 }
1605 }
1606
1607 % SPECIAL SYNTAX
1608
1609 % Cuts off the value of a key
1610
1611 \cs_new:Npn \@@_retrieve_key_name:w #1=#2\q_stop { #1 }
1612
1613 % Extracts first key name of optional argument
1614
1615 \cs_new_protected:Npn \@@_extract_first_key_name:n #1
1616 {
1617 \clist_set:Nn \l_tmpa_clist { #1 }
1618 \tl_set:Ne \l_tmpa_tl { \clist_item:Nn \l_tmpa_clist { 1 } }
1619 \tl_if_in:NnTF \l_tmpa_tl { = }
1620 {
1621 \tl_set:Ne \l_@@_key_name_tl
1622 {
1623 \exp_last_unbraced:NV
1624 \@@_retrieve_key_name:w \l_tmpa_tl \q_stop
1625 }
1626 }
1627 { \tl_set_eq:NN \l_@@_key_name_tl \l_tmpa_tl }
1628 }
1629
1630 % Sets the keys as usual, or sets them up manually if special syntax is in use
1631
1632 \cs_new_protected:Npn \@@_parse_macro_keys:n #1
1633 {
1634 \keys_if_exist:nVTF { integral } \l_@@_key_name_tl
1635 { \keys_set:nn { integral } { #1 } }
1636 {
1637 \regex_split:nnN { : } { #1 } \l_tmpa_seq
1638 \str_if_eq:eeTF
1639 { \seq_item:Nn \l_tmpa_seq { 2 } }
1640 { +j }
1641 {
1642 \exp_args:NNne \seq_set_item:Nnn \l_tmpa_seq { 2 }
1643 { \l_@@_default_differential_tl+j }
1644 }
1645 {
1646 \int_compare:nNnT { \seq_count:N \l_tmpa_seq } < { 2 }
1647 {
1648 \seq_put_right:NV
1649 \l_tmpa_seq
1650 \l_@@_default_differential_tl
1651 }
1652 }
1653 \int_compare:nNnT { \seq_count:N \l_tmpa_seq } < { 3 }
1654 { \seq_put_right:Nn \l_tmpa_seq { d } }
1655 \seq_set_split:Nne \l_tmpb_seq
1656 { + }
1657 { \seq_item:Nn \l_tmpa_seq { 2 } }
1658 \keys_set:ne { integral }
1659 {
1660 limits = { \seq_item:Nn \l_tmpa_seq { 1 } },
1661 variables = { \seq_item:Nn \l_tmpb_seq { 1 } },
1662 mode =
1663 {
1664 \str_case:enF { \seq_item:Nn \l_tmpa_seq { 3 } }
1665 {
1666 { d } { default }
1667 { n } { nested }
1668 { p } { product }
1669 { default } { default }
1670 { nested } { nested }
1671 { product } { product }
1672 }
1673 { default }
1674 },
1675 \bool_if:nT
1676 {
1677 \int_compare_p:nNn { \seq_count:N \l_tmpb_seq } > { 1 }
1678 &&
1679 \str_if_eq_p:en { \seq_item:Nn \l_tmpb_seq { 2 } } { j }
1680 }
1681 { jacobian }
1682 }
1683 }
1684 }
1685
1686 % PRELIMINARY CONFIGURATIONS
1687
1688 % Verifies that <limits> and <variables> (and <integrand>) have the same size
1689
1690 \cs_new_protected:Nn \@@_check_sequence_size:
1691 {
1692 \int_compare:nNnTF
1693 { \seq_count:N \l_@@_integral_symbol_seq }
1694 =
1695 { \seq_count:N \l_@@_integrand_seq }
1696 {
1697 \int_compare:nNnF
1698 { \seq_count:N \l_@@_integrand_seq }
1699 =
1700 { \seq_count:N \l_@@_differential_seq }
1701 {
1702 \msg_warning:nneee { intexgral } { unequal-dim }
1703 { \seq_count:N \l_@@_integral_symbol_seq }
1704 { \seq_count:N \l_@@_integrand_seq }
1705 { \seq_count:N \l_@@_differential_seq }
1706 }
1707 }
1708 {
1709 \msg_warning:nneee { intexgral } { unequal-dim }
1710 { \seq_count:N \l_@@_integral_symbol_seq }
1711 { \seq_count:N \l_@@_integrand_seq }
1712 { \seq_count:N \l_@@_differential_seq }
1713 }
1714 }
1715
1716 % Performs preparatory actions before executing the main macro
1717
1718 \cs_new_protected:Nn \@@_integral_preconfiguration:
1719 {
1720 \int_gincr:N \g_@@_integral_number_int
1721
1722 \bool_if:NT \l_@@_separate_integral_bool
1723 {
1724 \seq_set_split:NnV
1725 \l_@@_integrand_seq
1726 { ; }
1727 \l_@@_integrand_tl
1728 }
1729
1730 \seq_if_empty:NT \l_@@_integral_symbol_seq
1731 {
1732 \seq_put_right:Nn \l_@@_integral_symbol_seq
1733 { \@@_parse_integral_symbol: }
1734 }
1735
1736 \seq_if_empty:NT \l_@@_integrand_seq
1737 {
1738 \seq_put_right:NV
1739 \l_@@_integrand_seq
1740 \l_@@_integrand_tl
1741 }
1742
1743 \bool_if:NF \l_@@_deactivate_differentials_bool
1744 { \@@_parse_differentials: }
1745
1746 \regex_if_match:nVTF { \c{differentials} } \l_@@_integrand_tl
1747 { \bool_set_true:N \l_@@_manual_differentials_bool }
1748 { \bool_set_false:N \l_@@_manual_differentials_bool }
1749
1750 \bool_if:NT \l_@@_separate_integral_bool
1751 { \@@_check_sequence_size: }
1752 }
1753
1754 % Default mode
1755
1756 \cs_new_protected:Nn \@@_print_default_integral:
1757 {
1758 \bool_if:NT \l_@@_manual_differentials_bool
1759 {
1760 \cs_set_protected:Npn \differentials
1761 { \seq_use:Nn \l_@@_differential_seq { } }
1762 }
1763 \seq_use:Nn \l_@@_integral_symbol_seq
1764 { \@@_mkern:N \l_@@_inline_symbol_muskip }
1765 \bool_if:nT
1766 {
1767 \l_@@_invert_differentials_bool
1768 &&
1769 !\l_@@_manual_differentials_bool
1770 }
1771 {
1772 \seq_use:Nn \l_@@_differential_seq { } \tex_mathop:D{} \!
1773 \bool_if:NT \l_@@_vectorial_differential_bool { \cdot \: }
1774 }
1775 \seq_use:Nn \l_@@_integrand_seq { }
1776 \bool_if:NT \l_@@_jacobian_bool
1777 { \seq_use:Nn \l_@@_jacobian_seq { } }
1778 \bool_if:nT
1779 {
1780 !\l_@@_invert_differentials_bool
1781 &&
1782 !\l_@@_manual_differentials_bool
1783 }
1784 {
1785 \bool_if:NT \l_@@_vectorial_differential_bool { \cdot }
1786 \seq_use:Nn \l_@@_differential_seq { }
1787 }
1788 }
1789
1790 % Nested mode
1791
1792 \cs_new_protected:Nn \@@_print_nested_integral:
1793 {
1794 \bool_if:NT \l_@@_manual_differentials_bool
1795 {
1796 \cs_set_protected:Npn \differentials
1797 { \seq_use:Nn \l_@@_differential_seq { } }
1798 }
1799 \bool_if:NT \l_@@_vectorial_differential_bool
1800 { \msg_warning:nnn { intexgral } { diff-vec-not-supp } { nested } }
1801 \int_step_inline:nn { \seq_count:N \l_@@_integral_symbol_seq }
1802 {
1803 \seq_item:Nn \l_@@_integral_symbol_seq { ##1 }
1804 \bool_if:NTF \l_@@_invert_differentials_bool
1805 {
1806 \bool_if:NT \l_@@_manual_differentials_bool
1807 {
1808 \msg_warning:nn { intexgral } { diff-not-sup }
1809 \cs_set_eq:NN \differentials \scan_stop:
1810 }
1811 \seq_item:Nn \l_@@_differential_seq { ##1 }
1812 \tex_mathop:D{} \!
1813 }
1814 {
1815 \seq_item:Nn \l_@@_integrand_seq { ##1 }
1816 \bool_if:NT \l_@@_jacobian_bool
1817 { \seq_item:Nn \l_@@_jacobian_seq { ##1 } }
1818 }
1819 }
1820 \bool_if:NTF \l_@@_invert_differentials_bool
1821 {
1822 \seq_use:Nn \l_@@_integrand_seq {}
1823 \bool_if:NT \l_@@_jacobian_bool
1824 { \seq_use:Nn \l_@@_jacobian_seq { } }
1825 }
1826 {
1827 \bool_if:NF \l_@@_manual_differentials_bool
1828 {
1829 \seq_use:Nn \l_@@_differential_seq {}
1830 }
1831 }
1832 }
1833
1834 % Product mode
1835
1836 \cs_new_protected:Nn \@@_print_product_integral:
1837 {
1838 \bool_if:NT \l_@@_manual_differentials_bool
1839 {
1840 \cs_set_protected:Npn \differentials
1841 {
1842 \seq_gpop_left:NN \l_tmpa_tl
1843 \tl_use:N \l_tmpa_tl
1844 }
1845 }
1846 \bool_if:NT \l_@@_vectorial_differential_bool
1847 { \msg_warning:nnn { intexgral } { diff-vec-not-supp } { product } }
1848 \int_step_inline:nn { \seq_count:N \l_@@_integral_symbol_seq }
1849 {
1850 \seq_item:Nn \l_@@_integral_symbol_seq { ##1 }
1851 \bool_if:nT
1852 {
1853 \l_@@_invert_differentials_bool
1854 &&
1855 !\l_@@_manual_differentials_bool
1856 }
1857 {
1858 \seq_item:Nn
1859 \l_@@_differential_seq { ##1 }
1860 \tex_mathop:D{} \!
1861 }
1862 \seq_item:Nn \l_@@_integrand_seq { ##1 }
1863 \bool_if:NT \l_@@_jacobian_bool
1864 { \seq_item:Nn \l_@@_jacobian_seq { ##1 } }
1865 \bool_if:nT
1866 {
1867 !\l_@@_invert_differentials_bool
1868 &&
1869 !\l_@@_manual_differentials_bool
1870 }
1871 { \seq_item:Nn \l_@@_differential_seq { ##1 } }
1872 }
1873 }
1874
1875 % General macro for typesetting
1876
1877 \cs_new_protected:Nn \@@_print_integral:
1878 {
1879 \@@_integral_preconfiguration:
1880 \str_case:VnF \l_@@_display_mode_str
1881 {
1882 { default } { \@@_print_default_integral: }
1883 { nested } { \@@_print_nested_integral: }
1884 { product } { \@@_print_product_integral: }
1885 }
1886 { \@@_print_default_integral: }
1887 \seq_gclear:N \l_@@_differential_seq
1888 }
1889
1890 % KEYS
1891
1892 \keys_define:nn { integral } {
1893
1894 % LIMITS
1895
1896 mode .choice:,
1897 mode / default .code:n =
1898 {
1899 \bool_set_false:N \l_@@_separate_integral_bool
1900 \str_set:Nn \l_@@_display_mode_str { default }
1901 },
1902 mode / nested .code:n =
1903 {
1904 \bool_set_true:N \l_@@_separate_integral_bool
1905 \str_set:Nn \l_@@_display_mode_str { nested }
1906 },
1907 mode / product .code:n =
1908 {
1909 \bool_set_true:N \l_@@_separate_integral_bool
1910 \str_set:Nn \l_@@_display_mode_str { product }
1911 },
1912 mode .default:n = { default },
1913
1914 limits .code:n =
1915 {
1916 \@@_parse_limits:n { #1 }
1917 \@@_set_limits_regular:
1918 \@@_generate_integral_sequence:
1919 },
1920
1921 limits* .code:n =
1922 {
1923 \@@_parse_limits:n { #1 }
1924 \@@_set_limits_starred:
1925 \@@_generate_integral_sequence:
1926 },
1927
1928 llimit .tl_set:N = \l_@@_lower_limit_tl,
1929
1930 ulimit .tl_set:N = \l_@@_upper_limit_tl,
1931
1932 symbol .code:n =
1933 {
1934 \cs_if_exist:NTF #1
1935 { \tl_set_eq:NN \l_@@_integral_symbol_tl #1 }
1936 {
1937 \msg_warning:nnn { intexgral } { unknown-symb } { #1 }
1938 \tl_set_eq:NN \l_@@_integral_symbol_tl \int
1939 }
1940 },
1941
1942 % SYMBOL SHORTCUT
1943
1944 nint .code:n =
1945 {
1946 \int_compare:nNnT { #1 } < { 5 }
1947 { \msg_warning:nn { intexgral } { use-glyph-instead } }
1948
1949 \tl_clear:N \l_@@_integral_symbol_tl
1950
1951 \int_step_inline:nn { #1 }
1952 {
1953 \tl_put_right:Nn \l_@@_integral_symbol_tl
1954 { \int }
1955 \int_compare:nNnT { ##1 } < { #1 }
1956 {
1957 \tl_put_right:Nn \l_@@_integral_symbol_tl
1958 {
1959 \@@_mathchoice:nnnn
1960 { \tex_mkern:D -12mu \scan_stop: }
1961 { \tex_mkern:D -8mu \scan_stop: }
1962 { \tex_mkern:D -4mu \scan_stop: }
1963 { \tex_mkern:D -2mu \scan_stop: }
1964 }
1965 }
1966 }
1967 },
1968
1969 % LIMITS SHORTCUTS
1970
1971 domain .code:n =
1972 {
1973 \tl_set:Nn \l_tmpa_tl { #1 }
1974 \seq_set_split:NnV \l_@@_domain_seq { * } \l_tmpa_tl
1975 \seq_map_inline:Nn \l_@@_domain_seq
1976 {
1977 \tl_if_empty:NF \l_@@_lower_limit_tl
1978 { \tl_put_right:Nn \l_@@_lower_limit_tl { \times } }
1979 \tl_set:Ne \l_@@_domain_char_tl
1980 { \exp_args:Ne \str_uppercase:n { \tl_head:n { ##1 } } }
1981 \tl_set:Ne \l_@@_domain_dimension_tl
1982 { \tl_tail:n { ##1 } }
1983 \tl_put_right:Ne \l_@@_lower_limit_tl
1984 {
1985 \exp_not:N \l_@@_domain_style_tl
1986 { \l_@@_domain_char_tl }
1987 \c_math_superscript_token { \l_@@_domain_dimension_tl }
1988 }
1989 }
1990 },
1991
1992 domain* .code:n =
1993 {
1994 \tl_set:Nn \l_tmpa_tl { #1 }
1995 \seq_set_split:NnV \l_@@_domain_seq { * } \l_tmpa_tl
1996 \seq_map_inline:Nn \l_@@_domain_seq
1997 {
1998 \tl_if_empty:NF \l_@@_lower_limit_tl
1999 { \tl_put_right:Nn \l_@@_lower_limit_tl { \times } }
2000 \tl_set:Ne \l_@@_domain_char_tl
2001 { \exp_args:Ne \str_uppercase:n { \tl_head:n { ##1 } } }
2002 \tl_set:Ne \l_@@_domain_dimension_tl
2003 { \tl_tail:n { ##1 } }
2004 \tl_put_right:Ne \l_@@_lower_limit_tl
2005 {
2006 \exp_not:N \l_@@_domain_style_tl
2007 { \l_@@_domain_char_tl }
2008 \c_math_subscript_token { \l_@@_domain_dimension_tl }
2009 }
2010 }
2011 },
2012
2013 boundary .code:n =
2014 { \tl_set:Nn \l_@@_lower_limit_tl { \partial #1 } },
2015
2016 % VARIABLES
2017
2018 variables .code:n =
2019 {
2020 \bool_set_true:N \l_@@_custom_variables_bool
2021 \str_if_eq:nnTF { #1 } { none }
2022 { \bool_set_true:N \l_@@_deactivate_differentials_bool }
2023 {
2024 \prop_get:NnNTF
2025 \g_@@_differential_group_keyword_prop { #1 } \l_tmpa_tl
2026 {
2027 \clist_set:NV \l_@@_variable_i_clist \l_tmpa_tl
2028 \seq_if_exist:cTF { g_@@_#1_jacobian_seq }
2029 {
2030 \seq_set_eq:Nc
2031 \l_@@_jacobian_seq
2032 { g_@@_#1_jacobian_seq }
2033 }
2034 { \msg_warning:nnn { intexgral } { no-jacobian } { #1 } }
2035 }
2036 { \clist_set:Nn \l_@@_variable_i_clist { #1 } }
2037 }
2038 },
2039
2040 jacobian .code:n =
2041 { \bool_set_true:N \l_@@_jacobian_bool },
2042 diff-vec .code:n =
2043 { \bool_set_true:N \l_@@_vectorial_differential_bool },
2044 diff-star .code:n =
2045 { \bool_set_true:N \l_@@_starred_differential_bool },
2046
2047 diff-symb .code:n =
2048 {
2049 \cs_set:Npn \@@_differentials:nn ##1##2 {
2050 \bool_if:NTF \l_@@_starred_differential_bool
2051 { #1*[##1]{##2} }
2052 { #1[##1]{##2} }
2053 }
2054 },
2055
2056 diff-options .tl_set:N = \l_@@_differential_options_i_tl,
2057 }
2058
2059 \keys_define:nn { IntegralSetup }
2060 {
2061 defaultvar .tl_set:N = \l_@@_default_differential_tl,
2062 defaultvar* .tl_set:N = \l_@@_default_vector_differential_tl,
2063 vectorstyle .tl_set:N = \l_@@_vectorial_differential_style_tl,
2064 domainstyle .tl_set:N = \l_@@_domain_style_tl,
2065 symbolskip .tl_set:N = \l_@@_inline_symbol_muskip,
2066 hide-diff .bool_set:N = \l_@@_deactivate_differentials_bool,
2067 }
2068
2069 % END USER MACROS
2070
2071 % Limits keywords
2072
2073 \NewDocumentCommand\NewLimitsKeyword{ m m }
2074 {
2075 \prop_get:NnNTF \g_@@_limits_keyword_prop { #1 } \l_tmpa_tl
2076 { \msg_error:nnn { intexgral } { lim-group-alr-def } { #1 } }
2077 {
2078 \bool_if:NTF \l_@@_invert_limits_bool
2079 {
2080 \clist_set:Nn \l_tmpa_clist { #2 }
2081 \clist_reverse:N \l_tmpa_clist
2082 \@@_new_limits_group:nV { #1 } \l_tmpa_clist
2083 }
2084 { \@@_new_limits_group:nn { #1 } { #2 } }
2085 }
2086 }
2087
2088 \NewDocumentCommand\RenewLimitsKeyword{ m m }
2089 {
2090 \prop_pop:NnNTF \g_@@_limits_keyword_prop { #1 } \l_tmpa_tl
2091 {
2092 \bool_if:NTF \l_@@_invert_limits_bool
2093 {
2094 \clist_set:Nn \l_tmpa_clist { #2 }
2095 \clist_reverse:N \l_tmpa_clist
2096 \@@_new_limits_group:nV { #1 } \l_tmpa_clist
2097 }
2098 { \@@_new_limits_group:nn { #1 } { #2 } }
2099 }
2100 { \msg_error:nnn { intexgral } { lim-group-not-def } }
2101 }
2102
2103 \NewDocumentCommand\ProvideLimitsKeyword{ m m }
2104 {
2105 \prop_get:NnNF \g_@@_limits_keyword_prop { #1 } \l_tmpa_tl
2106 {
2107 \bool_if:NTF \l_@@_invert_limits_bool
2108 {
2109 \clist_set:Nn \l_tmpa_clist { #2 }
2110 \clist_reverse:N \l_tmpa_clist
2111 \@@_new_limits_group:nV { #1 } \l_tmpa_clist
2112 }
2113 { \@@_new_limits_group:nn { #1 } { #2 } }
2114 }
2115 }
2116
2117 \NewDocumentCommand\DeclareLimitsKeyword{ m m }
2118 {
2119 \prop_pop:NnNT \g_@@_limits_keyword_prop { #1 } \l_tmpa_tl
2120 {
2121 \bool_if:NTF \l_@@_invert_limits_bool
2122 {
2123 \clist_set:Nn \l_tmpa_clist { #2 }
2124 \clist_reverse:N \l_tmpa_clist
2125 \@@_new_limits_group:nV { #1 } \l_tmpa_clist
2126 }
2127 { \@@_new_limits_group:nn { #1 } { #2 } }
2128 }
2129 }
2130
2131 % Variable keywords
2132
2133 \NewDocumentCommand\NewVariableKeyword{ m m o }
2134 {
2135 \prop_get:NnNTF \g_@@_differential_group_keyword_prop { #1 }
2136 \l_tmpa_tl
2137 { \msg_error:nnn { intexgral } { diff-group-alr-def } { #1 } }
2138 { \@@_new_differential_group:nnn { #1 } { #2 } { #3 } }
2139 }
2140
2141 \NewDocumentCommand\RenewVariableKeyword{ m m o }
2142 {
2143 \prop_pop:NnNTF \g_@@_differential_group_keyword_prop { #1 }
2144 \l_tmpa_tl
2145 {
2146 \seq_clear:c { g_@@_#1_jacobian_seq }
2147 \@@_new_differential_group:nnn { #1 } { #2 } { #3 }
2148 }
2149 { \msg_error:nnn { intexgral } { diff-group-not-def } { #1 } }
2150 }
2151
2152 \NewDocumentCommand\ProvideVariableKeyword{ m m o }
2153 {
2154 \prop_get:NnNF \g_@@_differential_group_keyword_prop { #1 }
2155 \l_tmpa_tl
2156 { \@@_new_differential_group:nnn { #1 } { #2 } { #3 } }
2157 }
2158
2159 \NewDocumentCommand\DeclareVariableKeyword{ m m o }
2160 {
2161 \prop_pop:NnNT \g_@@_differential_group_keyword_prop { #1 }
2162 \l_tmpa_tl
2163 {
2164 \seq_clear:c { g_@@_#1_jacobian_seq }
2165 \@@_new_differential_group:nnn { #1 } { #2 } { #3 }
2166 }
2167 }
2168
2169 % Symbol keys
2170
2171 \NewDocumentCommand\NewSymbolKeyword{ m m }
2172 {
2173 \prop_if_in:NnT \g_@@_limits_keyword_prop { #1 }
2174 { \msg_warning:nnn { intexgral } { key-exists-for-lim } { #1 } }
2175 \keys_if_exist:nnTF { integral } { #1 }
2176 { \msg_error:nnn { intexgral } { symb-key-alr-def } { #1 } }
2177 {
2178 \keys_define:nn { integral }
2179 {
2180 #1 .meta:n =
2181 {
2182 symbol=#2,
2183 llimit=##1
2184 },
2185 }
2186 }
2187 }
2188
2189 \NewDocumentCommand\RenewSymbolKeyword{ m m }
2190 {
2191 \prop_if_in:NnT \g_@@_limits_keyword_prop { #1 }
2192 { \msg_warning:nnn { intexgral } { key-exists-for-lim } { #1 } }
2193 \keys_if_exist:nnTF { integral } { #1 }
2194 {
2195 \keys_define:nn { integral }
2196 {
2197 #1 .undefine:
2198 #1 .meta:n =
2199 {
2200 symbol=#2,
2201 llimit=##1
2202 }
2203 }
2204 }
2205 { \msg_error:nnn { intexgral } { symb-key-not-def } }
2206 }
2207
2208 \NewDocumentCommand\ProvideSymbolKeyword{ m m }
2209 {
2210 \prop_if_in:NnT \g_@@_limits_keyword_prop { #1 }
2211 { \msg_warning:nnn { intexgral } { key-exists-for-lim } { #1 } }
2212 \keys_if_exist:nnF { integral } { #1 }
2213 {
2214 \keys_define:nn { integral }
2215 {
2216 #1 .meta:n =
2217 {
2218 symbol=#2,
2219 llimit=##1
2220 },
2221 }
2222 }
2223 }
2224
2225 \NewDocumentCommand\DeclareSymbolKeyword{ m m }
2226 {
2227 \keys_define:nn { integral }
2228 {
2229 #1 .undefine:
2230 #1 .meta:n =
2231 {
2232 symbol=#2,
2233 llimit=##1
2234 },
2235 }
2236 }
2237
2238 \NewDocumentCommand\IntegralSetup{ m }
2239 { \keys_set:nn { IntegralSetup } { #1 } }
2240
2241 \NewDocumentCommand\integral{ O{} m }
2242 {
2243 \group_begin:
2244 \tl_if_empty:nF { #1 }
2245 {
2246 \@@_extract_first_key_name:n { #1 }
2247 \@@_parse_macro_keys:n { #1 }
2248 }
2249 \tl_set:Nn \l_@@_integrand_tl { #2 }
2250 \@@_print_integral:
2251 \group_end:
2252 }
2253
2254 % Preamble only
2255
2256 \@onlypreamble\intexgralsetup
2257
2258 % Included keywords
2259
2260 % Symbol keywords
2261 \NewSymbolKeyword{single} {\int}
2262 \NewSymbolKeyword{double} {\iint}
2263 \NewSymbolKeyword{triple} {\iiint}
2264 \NewSymbolKeyword{quadruple} {\iiiint}
2265 \NewSymbolKeyword{contour} {\oint}
2266 \NewSymbolKeyword{surface} {\oiint}
2267 \NewSymbolKeyword{volume} {\oiiint}
2268
2269 % Limits keywords
2270 \NewLimitsKeyword{ab} {a, b}
2271 \NewLimitsKeyword{real} {-\infty, +\infty}
2272 \NewLimitsKeyword{positive} {0, +\infty}
2273 \NewLimitsKeyword{negative} {-\infty, 0}
2274 \NewLimitsKeyword{unit} {0, 1}
2275 \NewLimitsKeyword{circle} {0, 2\pi}
2276 \NewLimitsKeyword{scircle} {0, \pi}
2277 \NewLimitsKeyword{qcircle} {0, \frac{\pi}{2}}
2278 \NewLimitsKeyword{height} {0, H}
2279 \NewLimitsKeyword{radius} {0, R}
2280 \NewLimitsKeyword{length} {0, L}
2281 \NewLimitsKeyword{time} {0, T}
2282
2283 % Variable keywords
2284 \NewVariableKeyword{cartesian} {x, y, z}
2285 \NewVariableKeyword{planar} {x, y}
2286 \NewVariableKeyword{polar} {r, \theta} [r]
2287 \NewVariableKeyword{cylindrical} {r, \theta, z} [r]
2288 \NewVariableKeyword{spherical} {r, \theta, \phi} [r^2, \sin\theta]
2289
2290 % Default parameters
2291
2292 \IntegralSetup
2293 {
2294 defaultvar = {x},
2295 defaultvar* = {r},
2296 vectorstyle = \vec,
2297 domainstyle = \mathbb,
2298 symbolskip = {-6mu},
2299 hide-diff = false
2300 }
2301
2302 \ExplSyntaxOff
2303 % \end{macrocode}