-
Notifications
You must be signed in to change notification settings - Fork 0
/
cablerobot-math.dtx
2201 lines (2201 loc) · 53.3 KB
/
cablerobot-math.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
% Copyright (C) 2019--2020 by Philipp Tempel <p.tempel@tudelft.nl>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{cablerobot-math.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{cablerobot-math}
%<*package>
[2020/05/01 v1.0.0 Cable Robots Math]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{hyperref}
\usepackage{cablerobot-math}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{cablerobot-math.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
%
% \changes{v1.0}{2020/05/01}{Initial version}
%
% \GetFileInfo{cablerobot-math.dtx}
%
% \DoNotIndex{%
% \!,%
% \,,%
% \:,%
% \adj,%
% \arg,%
% \ast,%
% \bm,%
% \bullet,%
% \cdot,%
% \cr,%
% \crossp@inner,%
% \crossp@ddot,%
% \ddot,%
% \DeclareMathOperator,%
% \DeclarePairedDelimiterX,%
% \def,%
% \Delta,%
% \delta,%
% \dfrac,%
% \dot,%
% \dotp@inner,%
% \dots,%
% \dotsc,%
% \else,%
% \epsilon,%
% \fi,%
% \frac,%
% \hat,%
% \ifblank,%
% \IfBooleanTF,%
% \ifdefined,%
% \IfValueT,%
% \IfValueTF,%
% \infty,%
% \innerp@inner,%
% \interval,%
% \langle,%
% \lbrace,%
% \lceil,%
% \left,%
% \let,%
% \lfloor,%
% \lparen,%
% \lVert,%
% \lvert,%
% \mathbb,%
% \mathcal,%
% \mathds,%
% \mathinner,%
% \mathop,%
% \mathrm,%
% \mathsf,%
% \mbox,%
% \min,%
% \mkern,%
% \nabla,%
% \newcommand,%
% \nl,%
% \numlist,%
% \ooalign,%
% \operatorname,%
% \otimes,%
% \outerp@inner,%
% \overline,%
% \partial,%
% \PassOptionsToPackage,%
% \phantom,%
% \prescript,%
% \prime,%
% \ProcessList,%
% \ProvideDocumentCommand,%
% \ProvideMathOperator,%
% \rangle,%
% \rbrace,%
% \rceil,%
% \renewcommand,%
% \RequirePackage,%
% \rfloor,%
% \right,%
% \rparen,%
% \rule,%
% \runner,%
% \rVert,%
% \rvert,%
% \SavedStyle,%
% \SI,%
% \si,%
% \SIlist,%
% \SIrange,%
% \smaller,%
% \SplitList,%
% \text,%
% \textscale,%
% \tfrac,%
% \Theta,%
% \ThisStyle,%
% \times,%
% \top,%
% \varepsilon,%
% \vectsetitem,%
% \vectsetitema,%
% }
% \expandafter\DoNotIndex\expandafter{\string\{}
% \expandafter\DoNotIndex\expandafter{\string\}}
%
%
% \title{The \textsf{cablerobot-math} package\thanks{This document
% corresponds to \textsf{cablerobot-math}~\fileversion, dated \filedate.}}
% \author{Philipp Tempel \\ \texttt{p.tempel@tudelft.nl}}
%
% \maketitle
%
% \section{Introduction}
%
% \section{Usage}
%
% \StopEventually{}
%
%
% \section{Implementation}
%
% \subsection{Package Dependencies}
%
% The package is a toolbox of programming facilities geared primarily towards
% LaTeX class and package authors. It provides LaTeX frontends to some of the
% new primitives provided by e-TeX as well as some generic tools which are not
% strictly related to e-TeX but match the profile of this package. Note that the
% initial versions of this package were released under the name elatex. The
% package provides functions that seem to offer alternative ways of implementing
% some LaTeX kernel commands; nevertheless, the package will not modify any part
% of the LaTeX kernel.
% \begin{macrocode}
\RequirePackage{etoolbox}
% \end{macrocode}
%
% xparse – A generic document command parser
% The package provides a high-level interface for producing document-level
% commands. In that way, it offers a replacement for LaTeX2e’s |\newcommand|
% macro, with significantly improved functionality.
% The package is distributed as part of the l3packages bundle.
% \begin{macrocode}
\RequirePackage{xparse}
% \end{macrocode}
%
% The pgfkeys package (part of the pgf distribution) is a well-designed way of
% defining and using large numbers of keys for key-value syntaxes. However,
% pgfkeys itself does not offer means of handling LaTeX class and package
% options. This package adds such option handling to pgfkeys, in the same way
% that kvoptions adds the same facility to the LaTeX standard keyval package.
% \begin{macrocode}
\RequirePackage{pgfkeys}
\RequirePackage{pgfopts}
% \end{macrocode}
%
% Set the font size relative to the current font size. The basic command of the
% package is |\relsize|, whose argument is a number of |\magsteps| to change
% size; from this are defined commands |\larger|, |\smaller|, |\textlarger|,
% etc.
% \begin{macrocode}
\RequirePackage{relsize}
% \end{macrocode}
%
% scalerel – Constrained scaling and stretching of objects\\
% The package provides four commands for vertically scaling and stretching
% objects. Its primary function is the ability to scale/stretch and shift one
% object to conform to the size of a specified second object. This feature can
% be useful in both equations and schematic diagrams.\\
% Additionally, the scaling and stretching commands offer constraints on maximum
% width and/or minimum aspect ratio, which are often used to preserve legibility
% or for the sake of general appearance.
% \begin{macrocode}
\RequirePackage{scalerel}
% \end{macrocode}
%
% Mathtools provides a series of packages designed to enhance the appearance of
% documents containing a lot of mathematics. The main backbone is amsmath, so
% those unfamiliar with this required part of the LaTeX system will probably not
% find the packages very useful. Mathtools provides many useful tools for
% mathematical typesetting. It is based on amsmath and fixes various
% deficiencies of amsmath and standard LaTeX. It provides:
% * Extensible symbols, such as brackets, arrows, harpoons, etc.;
% * Various symbols such as |\coloneqq| (:=);
% * Easy creation of new tag forms;
% * Showing equation numbers only for referenced equations;
% * Extensible arrows, harpoons and hookarrows;
% * Starred versions of the amsmath matrix environments for specifying the
% column alignment;
% * More building blocks: multlined, cases-like environments, new gathered
% environments;
% * Maths versions of |\makebox|, |\llap|, |\rlap| etc.;
% * Cramped math styles; and more...
% \begin{macrocode}
% \RequirePackage{mathtools}
% \end{macrocode}
%
% amsmath – AMS mathematical facilities for LaTeX
% The principal package in the AMS-LaTeX distribution. It adapts for use in
% LaTeX most of the mathematical features found in AMS-TeX; it is highly
% recommended as an adjunct to serious mathematical typesetting in LaTeX.
% When amsmath is loaded, AMS-LaTeX packages amsbsy (for bold symbols), amsopn
% (for operator names) and amstext (for text embedded in mathematics) are also
% loaded.
% amsmath is part of the LaTeX required distribution; however, several
% contributed packages add still further to its appeal; examples are empheq,
% which provides functions for decorating and highlighting mathematics, and
% ntheorem, for specifying theorem (and similar) definitions.
% \begin{macrocode}
\RequirePackage{amsmath}
% \end{macrocode}
%
% doublestroke – Typeset mathematical double stroke symbols
% A font based on Computer Modern Roman useful for typesetting the mathematical
% symbols for the natural numbers (N), whole numbers (Z), rational numbers (Q),
% real numbers (R) and complex numbers (C); coverage includes all Roman capital
% letters, ‘1’, ‘h’ and ‘k’. The font is available both as METAFONT source and
% in Adobe Type 1 format, and LaTeX macros for its use are provided.
% The fonts appear in the blackboard bold sampler.
% For a full list of additional math symbols, see
% \url{http://milde.users.sourceforge.net/LUCR/Math/mathpackages/dsfont-symbols.pdf}
% \begin{macrocode}
\RequirePackage{dsfont}
% \end{macrocode}
%
% The bm package defines a command |\bm| which makes its argument bold. The
% argument may be any maths object from a single symbol to an expression. This
% is closely related to the specification of the |\boldsymbol| command in
% AMS-LaTeX, but |\bm| is rather more careful in the way it does things.
% \begin{macrocode}
\RequirePackage{bm}
% \end{macrocode}
%
% A comprehensive (SI) units package. Typesetting values with units requires
% care to ensure that the combined mathematical meaning of the value plus unit
% combination is clear. In particular, the SI units system lays down a
% consistent set of units with rules on how they are to be used. However,
% different countries and publishers have differing conventions on the exact
% appearance of numbers (and units). A number of LaTeX packages have been
% developed to provide consistent application of the various rules: SIunits,
% sistyle, unitsdef and units are the leading examples. The numprint package
% provides a large number of number-related functions, while dcolumn and rccol
% provide tools for typesetting tabular numbers. The siunitx package takes the
% best from the existing packages, and adds new features and a consistent
% interface. A number of new ideas have been incorporated, to fill gaps in the
% existing provision. The package also provides backward-compatibility with
% SIunits, sistyle, unitsdef and units. The aim is to have one package to handle
% all of the possible unit-related needs of LaTeX users. The package relies on
% LaTeX 3 support from the l3kernel and l3packages bundles.
% \begin{macrocode}
\PassOptionsToPackage{%
% General styling
multi-part-units=brackets,%
zero-decimal-to-integer=false,%
add-decimal-zero=false,%
add-integer-zero=true,%
per-mode=reciprocal,%
% Rounding
round-mode=places,%
round-precision=3,%
round-half=even,%
% Products |\SI{1x2x3}|
product-units=power,%
% Ranges |\SIrange|
range-units=brackets,%
% Lists |\SIlist|
list-units=brackets,%
% Tables
table-unit-alignment=left,%
}{siunitx}
\RequirePackage{siunitx}
% \end{macrocode}
%
% The dcolumn package makes use of the array package to define a "D" column
% format for use in tabular environments. This package is part of the tools
% bundle in the LaTeX required distribution.
% \begin{macrocode}
\RequirePackage{dcolumn}
% \end{macrocode}
%
% Typeset in-line fractions in a "nice" way. The package typesets fractions
% "nicely" - in the form 'a/b' (i.e., staggered with a slash between them,
% rather than directly one over the other). The package is distributed as part
% of a bundle including the units package. Nicefrac's facilities are provided,
% in a cleaner way, by the (experimental) xfrac package, but see also the faktor
% package for quotient spaces and the like.
% \begin{macrocode}
\RequirePackage{nicefrac}
% \end{macrocode}
%
% fouridx - Left sub- and superscripts in maths mode The package enables left
% subscripts and superscripts in maths mode. The sub- and superscripts are
% raised for optimum fitting to the symbol indexed, in such a way that left
% and right sub- and superscripts are set on the same level, as appropriate.
% The package provides an alternative to the use of the |\sideset| command in
% the amsmath package.
% \begin{macrocode}
\RequirePackage{fouridx}
% \end{macrocode}
%
% Place lines through maths formulae. A package to draw diagonal lines
% ("cancelling" a term) and arrows with limits (cancelling a term "to a value")
% through parts of maths formulae.
% \begin{macrocode}
\RequirePackage{cancel}
% \end{macrocode}
%
% EMPHasizing EQuations. The empheq package is part of the mathtools bundle. The
% package provides a visual markup extension to amsmath. The user-friendly
% interface allows the user to put a set of equations inside a box thus
% enhancing the |\boxed| feature of amsmath. As a side effect it's also possible
% to add material on both sides of the equations thus providing (and surpassing)
% the functionality of the cases package. Users of ntheorem will probably want
% to have a look at it as well, since the problem with end-of-theorem marks in
% gather and other environments can be circumvented using empheq.
% \begin{macrocode}
\RequirePackage{empheq}
% \end{macrocode}
%
% Provides macros to typeset bra-ket notation, as well as set specifiers, with a
% single bar, a double bar, or vertical bar specifier in between two bracketed
% parts. Each macro comes in a fixed-size version and an expanding version. If
% the package finds itself operating under e-tex, it uses the extended primitive
% |\middle| for more reliable results
% \begin{macrocode}
\RequirePackage{braket}
% \end{macrocode}
%
% When typing an open interval as $]a,b[$, a closing bracket is being used in
% place of an opening fence and vice versa. This leads to the wrong spacing in,
% say, $]-a,b[$ or $A \in ]a,b[ = B$. The package attempts to solve this using
%
% |\interval{a}{b}| yields $\interval{a}{b}$
%
% |\interval[open]{a}{b}| yields $\interval[open]{a}{b}$
%
% |\interval[open left]{a}{b}| yields $\interval[open left]{a}{b}$
%
% The package also supports fence scaling and ensures that the enclosing fences
% will end up having the proper closing and opening types. TeX maths does not do
% this job properly.
% \begin{macrocode}
\RequirePackage{interval}
% \end{macrocode}
%
%
% \subsection{Package Options}
%
% Configure the |pgfopts|-package
% \begin{macrocode}
\pgfkeys{%
/cablerobot/math/.is family,%
/cablerobot/math/.cd,%
}
% \end{macrocode}
%
% By default, all undefined options will be passed as options to the
% |glossaries-extra| package only the options defined here are for the actual
% package.
% \begin{macrocode}
\newif\ifcablerobot@math@rotationbold
\cablerobot@math@rotationboldtrue
\pgfkeys{
/cablerobot/math/rotation/.cd,%
.is choice,%
bold/.code={\cablerobot@math@rotationboldtrue},%
regular/.code={\cablerobot@math@rotationboldfalse},%
normal/.code={\cablerobot@math@rotationboldfalse},%
}
% \end{macrocode}
%
% And now a callback for unknown options to be passed down to the
% |glossaries-extra| class
% \begin{macrocode}
\pgfkeys{%
/cablerobot/math/.cd,%
.unknown/.code={%
\let\currname\pgfkeyscurrentname%
\let\currval\pgfkeyscurrentvalue%
\ifx#1\pgfkeysnovalue%
\PassOptionsToPackage{\currname}{glossaries-extra}%
\else%
\PassOptionsToPackage{\expandafter\currname\expandafter=\currval}{glossaries-extra}%
\fi%
},%
}
% \end{macrocode}
%
% Setting default values for options
% \begin{macrocode}
\newcommand{\cablerobot@math@setdefaults}{%
\pgfkeys{/cablerobot/math/.cd,%
rotation=bold,%
}%
}%
% \end{macrocode}
%
% Process options passed to the class
% \begin{macrocode}
\cablerobot@math@setdefaults
\ProcessPgfPackageOptions{/cablerobot/math}
% \end{macrocode}
%
%
% \section{Macros}
%
%
% \begin{macro}{\ProvideMathOperator}
% \cmd{\ProvideMathOperator}\marg{opname}\marg{text}.\\
% \cmd{\ProvideMathOperator}*\marg{opname}\marg{text}.\\
% Maybe not the cleanest way, but we shall also provide a |\ProvideMathOperator|
% macro that allows to define math operators in a fail-safe way i.e., work like
% |\providecommand|. The starred version uses |\DeclareMathOperator*| instead
% of the unstarred version. This puts the limits underneath the operator.
% \begin{macrocode}
\ProvideDocumentCommand{\ProvideMathOperator}{ s m m }{%
\ifdefined#2\else%
\IfBooleanTF{#1}{%
\DeclareMathOperator*{#2}{#3}%
}{%
\DeclareMathOperator{#2}{#3}%
}%
\fi%
}%
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\parentheses}
% \cmd{\parentheses}\marg{content} wraps its |<content>| into curly
% parentheses. See the |mathtools| package for implementation details.
% \begin{macrocode}
\DeclarePairedDelimiterX{\parentheses}[1]{\lparen}{\rparen}{%
\ifblank{#1}{\cdot}{#1}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cparentheses}
% \cmd{\cparentheses}\marg{content} wraps its |<content>| into curly
% parentheses. See the |mathtools| package for implementation details.
% \begin{macrocode}
\DeclarePairedDelimiterX{\cparentheses}[1]{\lbrace}{\rbrace}{%
\ifblank{#1}{\cdot}{#1}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ceil}
% \cmd{\ceil}\marg{value} writes math operator for ceiling |<value>|. See the
% |mathtools| package for implementation details.
% \begin{macrocode}
\DeclarePairedDelimiterX{\ceil}[1]{\lceil}{\rceil}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\floor}
% \cmd{\floor}\marg{value} writes math operator for flooring |<value>|. See
% the |mathtools| package for implementation details.
% \begin{macrocode}
\DeclarePairedDelimiterX{\floor}[1]{\lfloor}{\rfloor}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\lerp}
% \cmd{\lerp}\oarg{var}\marg{start}\marg{end} writes linear interpolation
% of two functions |<start>| and |<end>| and running variable |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\lerp}{ O{t} m m }{%
\parentheses*{%
1%
-%
#1%
} \,%
#2%
+%
#1 \,%
#3%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\of}
% \cmd{\of}\marg{arguments} writes the ``function of ...'' argument with
% conventional parentheses.\\
% \cmd{\of}\oarg{<parens size>}\marg{arguments} sets the parentheses size to
% |<parens size>| e.g., |\bigg|.\\
% \cmd{\of}*\marg{arguments} auto-scales the size of the
% braces.
% \begin{macrocode}
\ProvideDocumentCommand{\of}{ s o m }{%
\mkern-1.0mu%
\IfBooleanTF{#1}{%
\IfValueTF{#2}{%
\parentheses*[#2]{#3}%
}{%
\parentheses*{#3}%
}%
}{%
\IfValueTF{#2}{%
\parentheses[#2]{#3}%
}{%
\parentheses{#3}%
}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cof}
% \cmd{\cof}\marg{arguments} writes the ``function of ...'' argument with
% curly parentheses.\\
% \cmd{\cof}\oarg{<parens size>}\marg{arguments} sets the parentheses size to
% |<parens size>| e.g., |\bigg|.\\
% \cmd{\cof}*\marg{arguments} auto-scales the size of the
% braces.
% \begin{macrocode}
\ProvideDocumentCommand{\cof}{ s o m }{%
\mkern-1.0mu%
\IfBooleanTF{#1}{%
\IfValueTF{#2}{%
\cparentheses*[#2]{#3}%
}{%
\cparentheses*{#3}%
}%
}{%
\IfValueTF{#2}{%
\cparentheses[#2]{#3}%
}{%
\cparentheses{#3}%
}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\overlinebm}
% \cmd{\overlinebm}\marg{var} writes an overlined bold font variable.
% \begin{macrocode}
\ProvideDocumentCommand{\overlinebm}{ m }{%
\ThisStyle{\ooalign{%
$\SavedStyle\mkern2.5mu\overline{\phantom{\mathrm{#1}}}$\cr$\SavedStyle\bm{{#1}}$%
}}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\overlinevect}
% \cmd{\overlinevect}\marg{content} writes an overlined bold font vector.
% \begin{macrocode}
\ProvideDocumentCommand{\overlinevect}{ m }{%
\overlinebm{#1}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\overlinematr}
% \cmd{\overlinematr}\marg{content} writes an overlined bold font matrix.
% \begin{macrocode}
\ProvideDocumentCommand{\overlinematr}{ m }{
\overlinebm{#1}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\vect}
% \cmd{\vect}\marg{var} writes the vector representation of |<var>|
% which defaults to |\bm{var}|.\\
% \cmd{\vect}\oarg{sub}\marg{var} prepends subscript |<sub>| to the
% vector.\\
% \cmd{\vect}\oarg{sub}\oarg{sup}\marg{var} also prepends
% superscript |<sup>| to the vector.
% \begin{macrocode}
\ProvideDocumentCommand{\vect}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\bm{#3}}%
}{%
\bm{#3}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\dotvect}
% \cmd{\dotvect}\marg{var} writes a proper single-dotted vector with the
% dot not written bold, only the vector component written as |\vect{var}|.\\
% \cmd{\dotvect}\oarg{sub}\marg{var} see |\vect[sub]{var}|.\\
% \cmd{\dotvect}\oarg{sub}\oarg{sup}\marg{var} see |\vect[sub][sup]{var}|
% \begin{macrocode}
\ProvideDocumentCommand{\dotvect}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\dot{\vect{#3}}}%
}{%
\dot{\vect{#3}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ddotvect}
% \cmd{\ddotvect}\marg{var} writes a proper double-dotted vector with the
% dot not written bold, only the vector component written as |\vect{var}|.\\
% \cmd{\ddotvect}\oarg{sub}\marg{var} see |\vect[sub]{var}|.\\
% \cmd{\ddotvect}\oarg{sub}\oarg{sup}\marg{var} see |\vect[sub][sup]{var}|
% \begin{macrocode}
\ProvideDocumentCommand{\ddotvect}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\ddot{\vect{#3}}}%
}{%
\ddot{\vect{#3}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ndot}
% \cmd{\ndot}\marg{num}\marg{var} writes the |<num>|-th derivative of
% |<var>|.\\
% \cmd{\ndot}*\marg{num}\marg{var} auto-scales the parentheses.
% \begin{macrocode}
\ProvideDocumentCommand{\ndot}{ s m m }{%
\IfBooleanTF{#1}{%
#3^{\parentheses*{#2}}%
}{%
#3^{\parentheses{#2}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pr}
% \cmd{\pr}\marg{var} writes the first prime-derivative of |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\pr}{ m }{%
#1^{\prime}\mkern-1.2mu%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ppr}
% \cmd{\ppr}\marg{var} writes the second prime-derivative of |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\ppr}{ m }{%
#1^{\prime\prime}\mkern-1.2mu%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pppr}
% \cmd{\pppr}\marg{var} writes the third prime-derivative of |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\pppr}{ m }{%
#1^{\prime\prime\prime}\mkern-1.2mu%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\jacobian}
% \cmd{\jacobian}\marg{var} applies the Jacobian operator to argument |<var>|.\\
% \cmd{\jacobian}\oarg{sub}\marg{var} prepends subscript |<var>| to the
% Jacobian operator.\\
% \cmd{\jacobian}\oarg{sub}\oarg{sup}\marg{var} also prepends superscript
% |<sup>| to the Jacobian operator.\\
% \cmd{\jacobian}*\oarg{sub}\oarg{sup}\marg{var} adds and auto-scales
% parentheses |<var>|
% \begin{macrocode}
\ProvideDocumentCommand{\jacobian}{ s o O{} m }{%
\jacobiansymbol%
\IfValueTF{#2}{%
_{\mkern-2.0mu\smaller[1] #2}^{\mkern-2.0mu\smaller[1] #3}%
\mkern-4.0mu
}{%
\mkern-5.0mu
}%
\IfBooleanTF{#1}{%
\parentheses*{#4}%
}{%
#4%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\dotjacobian}
% \cmd{\dotjacobian}\marg{var} first time-derivative of the jacobian of
% |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\dotjacobian}{ m }{%
\dot{\jacobiansymbol}\mkern-1.0mu#1%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ddotjacobian}
% \cmd{\ddotjacobian}\marg{var} second time-derivative of the jacobian of
% |<var>|.
% \begin{macrocode}
\ProvideDocumentCommand{\ddotjacobian}{ m }{%
\ddot{\jacobiansymbol}\mkern-1.0mu#1%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\eye}
% \cmd{\eye} unit-matrix.
% \begin{macrocode}
\ProvideDocumentCommand{\eye}{ }{%
\mathbb{I}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\zeros}
% \cmd{\zeros} zero-matrix.
% \begin{macrocode}
\ProvideDocumentCommand{\zeros}{ o }{%
\mathds{O}%\IfValueT{#1}{_{#1}}{}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ones}
% \cmd{\ones} ones-matrix.
% \begin{macrocode}
\ProvideDocumentCommand{\ones}{ o }{%
\IfValueTF{#1}{%
\mathbb{1}_{#1}%
}{%
\mathbb{1}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ndotvect}
% \cmd{\ndotvect}\marg{num}\marg{vect} |<num>|-th time-derivative of vector
% |<vect>|.\\
% \cmd{\ndotvect}\oarg{sub}\marg{num}\marg{vect} prepends subscript
% |<sub>|.\\
% \cmd{\ndotvect}\oarg{sub}\oarg{sup}\marg{num}\marg{vect} also prepends
% superscript |<sup>|.
% \begin{macrocode}
\ProvideDocumentCommand{\ndotvect}{ o O{} m m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\ndot{#3}{\vect{#4}}}%
}{%
\ndot{#3}{\vect{#4}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\matr}
% \cmd{\matr}\marg{matrix} writes |<matrix>| formatted as matrix.\\
% \cmd{\matr}\oarg{sub}\marg{matrix} prepends subscript |<sub>|.\\
% \cmd{\matr}\oarg{sub}\oarg{sup}\marg{matrix} also prepends superscript
% |<sup>|.
% \begin{macrocode}
\ProvideDocumentCommand{\matr}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\bm{#3}}%
}{%
\bm{#3}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\dotmatr}
% \cmd{\dotmatr}\marg{matrix} writes |<matrix>| formatted as matrix with its
% first time-derivative indiciator.\\
% \cmd{\dotmatr}\oarg{sub}\marg{matrix} prepends subscript |<sub>|.\\
% \cmd{\dotmatr}\oarg{sub}\oarg{sup}\marg{matrix} also prepends
% superscript |<sup>|.
% \begin{macrocode}
\ProvideDocumentCommand{\dotmatr}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\dot{\matr{#3}}}%
}{%
\dot{\matr{#3}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ddotmatr}
% \cmd{\ddotmatr}\marg{matrix} writes |<matrix>| formatted as matrix with its
% second time-derivative indiciator.\\
% \cmd{\ddotmatr}\oarg{sub}\marg{matrix} prepends subscript |<sub>|.\\
% \cmd{\ddotmatr}\oarg{sub}\oarg{sup}\marg{matrix} also prepends
% superscript |<sup>|.
% \begin{macrocode}
\ProvideDocumentCommand{\ddotmatr}{ o O{} m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\ddot{\matr{#3}}}%
}{%
\ddot{\matr{#3}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ndotmatr}
% \cmd{\ddotmatr}\marg{num}\marg{matrix} writes |<matrix>| formatted as
% matrix with its |<num>|-th time-derivative indiciator.\\
% \cmd{\ddotmatr}\oarg{sub}\marg{num}\marg{matrix} prepends subscript |<sub>|.\\
% \cmd{\ddotmatr}\oarg{sub}\oarg{sup}\marg{num}\marg{matrix} also prepends
% superscript |<sup>|.
% \begin{macrocode}
\ProvideDocumentCommand{\ndotmatr}{ o O{} m m }{%
\IfValueTF{#1}{%
\prescript{#1}{#2}{\ndot{#3}{\matr{#4}}}%
}{%
\ndot{#3}{\matr{#4}}%
}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\abs}
% \cmd{\abs}{value} wraps |<value>| in absolute-value bars.
% \begin{macrocode}
\ifdefined\abs\else%
\DeclarePairedDelimiterX{\abs}[1]{\lvert}{\rvert}{%
\ifblank{#1}{\:\cdot\:}{#1}
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\norm}
% \cmd{\norm}{value} wraps |<value>| inside of vector norm bars.
% \begin{macrocode}
\ifdefined\norm\else%
\DeclarePairedDelimiterX{\norm}[1]{\lVert}{\rVert}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pnorm}
% \cmd{\pnorm}{value} wraps |<value>| inside of vector $p$-norm bars.
% \begin{macrocode}
\ifdefined\pnorm\else%
\DeclarePairedDelimiterX{\pnorm}[1]{\lVert}{\rVert_{p}}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\twonorm}
% \cmd{\twonorm}{value} wraps |<value>| inside of vector $2$-norm bars.
% \begin{macrocode}
\ifdefined\twonorm\else%
\DeclarePairedDelimiterX{\twonorm}[1]{\lVert}{\rVert_{2}}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\onenorm}
% \cmd{\onenorm}{value} wraps |<value>| inside of vector $1$-norm bars.
% \begin{macrocode}
\ifdefined\onenorm\else%
\DeclarePairedDelimiterX{\onenorm}[1]{\lVert}{\rVert_{1}}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\maxnorm}
% \cmd{\maxnorm}{value} wraps |<value>| inside of vector $\infty$-norm bars.
% \begin{macrocode}
\ifdefined\maxnorm\else%
\DeclarePairedDelimiterX{\maxnorm}[1]{\lVert}{\rVert_{\infty}}{%
\ifblank{#1}{\:\cdot\:}{#1}%
}%
\fi%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\pow}
% \cmd{\pow}\marg{base} simple wrapper for $\langle base \rangle^{2}$.\\
% \cmd{\pow}*\marg{base} applies and auto-scales parentheses around |<base>|.\\
% \cmd{\pow}\oarg{power}\marg{base} uses |<power>| as exponent instead of
% the default $2$.
% \begin{macrocode}
\ProvideDocumentCommand{\pow}{ s O{2} m }{%
\IfBooleanTF{#1}{%
\parentheses*{#3
}^{#2}%
}{%
#3^{#2}%