-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathphysics2-code.dtx
More file actions
273 lines (246 loc) · 9.23 KB
/
physics2-code.dtx
File metadata and controls
273 lines (246 loc) · 9.23 KB
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
% \iffalse meta-comment
%
% Copyright (C) 2022-2024 by Zhang Tingxuan <alphaztx@163.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c 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.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Zhang Tingxuan.
%
% This work consists of the files physics2-code.dtx,
% physics2-code-*.dtx,
% the derived files physics2.ins,
% physics2.sty,
% phys.*.sty,
% the documentation files physics2.pdf,
% physics2-code.pdf,
% and README.md.
%
%<*internal>
\iffalse
%</internal>
%
%<*readme>
# The `physics2` package
This package defines commands for typesetting math formulae faster and
more simply. `physics2` is a modularized package, each module provides its
own function while the package itself only provides very few functions.
You can load modules of `physics2` after loading the `physics2` package.
## Functions and usages
See `physics2.pdf`.
## Build
Run
```
./build.sh
```
## For developers and advanced users
If you want to contribute to this repository, you can
- pull requests [here](https://github.com/AlphaZTX/physics2/pulls);
- report bugs or request enhancement [here](https://github.com/AlphaZTX/physics2/issues).
Before committing, please read `physics2-code.pdf` first.
## License
This work may be distributed and/or modified under the conditions of the
[LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
either version 1.3c of this license or (at your option) any later version.
This work has the LPPL maintenance status `maintained`.
The Current Maintainer of this work is
[Zhang Tingxuan](https://www.ctan.org/author/zhang-tx).
%</readme>
%
%<*internal>
\fi
\begingroup
\def\NameOfLaTeXe{LaTeX2e}
\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else
\csname fi\endcsname
%</internal>
%
%<*install>
\input docstrip.tex
\keepsilent
\preamble
Copyright (C) 2022-2024 by Zhang Tingxuan <alphaztx@163.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3c 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.
This work has the LPPL maintenance status `maintained'.
The Current Maintainer of this work is Zhang Tingxuan.
This work consists of the files physics2-code.dtx,
physics2-code-<collection>.dtx,
and the derived files physics2.ins,
physics2.sty,
phys.<module>.sty,
physics2-code.pdf,
and README.md.
\endpreamble
\usedir{tex/latex/physics2}
\generate{
\file{physics2.sty} {\from{physics2-code-base.dtx}{package}}
\file{phys.patch.amsmath.sty} {\from{physics2-code-utility.dtx}{patch.amsmath}}
}
\generate{
\file{phys.helper.sty} {\from{physics2-code-utility.dtx}{helper-begin}
\from{physics2-code-ab.dtx}{helper}
\from{physics2-code-braket.dtx}{helper}
\from{physics2-code-matrix.dtx}{helper}
\from{physics2-code-operator.dtx}{helper}
\from{physics2-code-misc.dtx}{helper}
\from{physics2-code-utility.dtx}{helper-end}}
}
\generate{
\file{phys.ab.sty} {\from{physics2-code-ab.dtx}{ab}}
\file{phys.xab.sty} {\from{physics2-code-ab.dtx}{xab}}
\file{phys.ab.legacy.sty} {\from{physics2-code-ab.dtx}{ab.legacy}}
\file{phys.ab.braket.sty} {\from{physics2-code-braket.dtx}{ab.braket}}
\file{phys.braket.sty} {\from{physics2-code-braket.dtx}{braket}}
\file{phys.xmat.sty} {\from{physics2-code-matrix.dtx}{xmat}}
\file{phys.diagmat.sty} {\from{physics2-code-matrix.dtx}{diagmat}}
\file{phys.doubleprod.sty} {\from{physics2-code-operator.dtx}{doubleprod}}
\file{phys.diffop.sty} {\from{physics2-code-operator.dtx}{diffop}}
\file{phys.nabla.legacy.sty} {\from{physics2-code-operator.dtx}{nabla.legacy}}
\file{phys.op.legacy.sty} {\from{physics2-code-operator.dtx}{op.legacy}}
\file{phys.bm-um.legacy.sty} {\from{physics2-code-misc.dtx}{bm-um.legacy}}
\file{phys.qtext.legacy.sty} {\from{physics2-code-misc.dtx}{qtext.legacy}}
}
%</install>
%<*internal>
\usedir{source/latex/physics2}
\generate{
\file{physics2.ins} {\from{physics2-code.dtx}{install}}
}
%</internal>
%<*install>
\usedir{doc/latex/physics2}
\generate{
\nopreamble\nopostamble
\file{README.md} {\from{physics2-code.dtx}{readme}}
}
\obeyspaces
\Msg{******************************************************}
\Msg{* *}
\Msg{* To finish the installation you have to move the *}
\Msg{* following files into a directory searched by TeX: *}
\Msg{* physics2.sty, *}
\Msg{* phys.<module>.sty (for all modules). *}
\Msg{* *}
\Msg{* The recommended directory is *}
\Msg{* TEXMFDIST/tex/latex/physics2 *}
\Msg{* *}
\Msg{* To produce the documentation, run the file *}
\Msg{* physics2-code.dtx through XeLaTeX or LuaLaTeX. *}
\Msg{* *}
\Msg{* Happy TeXing! *}
\Msg{* *}
\Msg{******************************************************}
\endbatchfile
%</install>
%
%<*internal>
\fi
%</internal>
%
%<*driver>
\ProvidesFile{physics2-code.dtx}[2024/01/22 (c) Copyright 2022-2024 by Zhang Tingxuan]
\documentclass{l3doc}
\setlist{noitemsep}
\definecolor{pkg}{RGB}{0,120,80}
\definecolor{mod}{RGB}{0,0,150}
\definecolor{gray}{rgb}{.5,.5,.5}
\definecolor{lnk}{RGB}{232,0,0}
\hypersetup{linktocpage,colorlinks=true,linkcolor=lnk}
\usepackage{amsmath,fontspec,physics2}
\setmonofont{cmunbtl}[Extension=.otf,ItalicFont=cmunbto,BoldFont=cmuntt,BoldItalicFont=cmunst]
\fvset{gobble=2,fontsize=\small,numbers=left,numbersep=0pt,vspace=\MacrocodeTopsep,xleftmargin=\MacroIndent}
\usepackage{hologo}
\makeatletter
\protected\def\pkg#1{\texorpdfstring{\textcolor{pkg}{\textsf{#1}}}{“#1”}}
\protected\def\modu#1{\texorpdfstring{\textcolor{mod}{\textsf{#1}}}{“#1”}}
\def\first@token#1#2\@nil{#1}
\renewcommand\theFancyVerbLine{{\color{gray}\sffamily\tiny\ifnum\c@FancyVerbLine=1
EXAMPLE\quad\fi\arabic{FancyVerbLine}}\ }
\def\@getver#1/#2/#3 #4 #5\@nil{#1-#2-#3\quad#4}
\xdef\@date{\expandafter\expandafter\expandafter\@getver\csname ver@physics2.sty\endcsname\@nil}
\@addtoreset{CodelineNo}{section}
\def\DeclareSourceFile#1{%
\markright{Source file: \texttt{physics2-code-#1.dtx}}%
\part{physics2-code-#1.dtx}%
\markright{Source file: \texttt{physics2-code-#1.dtx}}%
}
\def\ps@phy{%
\def\@oddfoot{\rightmark\hfil\thepage}%
\let\@oddhead\relax%
\let\@mkboth\markboth
}
\ExplSyntaxOn
\seq_new:N \l__phydoc_tmpa_seq
\seq_new:N \l__phydoc_tmpb_seq
\tl_new:N \l__phydoc_tmpa_tl
\tl_new:N \l__phydoc_tmpb_tl
\cs_new:Npn \guard #1
{
\tl_if_head_eq_charcode:nNTF {#1} @
{ \ensuremath{\langle}\texttt{#1}\ensuremath{\rangle} }
{ \Module{#1} }
}
\prg_set_conditional:Npnn \__codedoc_if_macro_internal:n #1 { p , T , F , TF }
{
\bool_if:NTF \l__codedoc_macro_internal_bool
{ \prg_return_true: }
{ \prg_return_false: }
}
\cs_new_protected:Npn \relatedint #1
{
\par
{ \small\textbf{Related~internal~command(s):}~ \relatedint_auxi:n {#1} . }
\par
}
\cs_new:Npn \relatedint_auxi:n #1
{
\seq_set_from_clist:Nn \l__phydoc_tmpa_seq {#1}
\seq_set_map:NNn \l__phydoc_tmpb_seq \l__phydoc_tmpa_seq
{ \csref {##1} }
\seq_use:Nnnn \l__phydoc_tmpb_seq { ~and~ } { ,~ } { ,~and~ }
}
\cs_new_protected:Npn \csref #1
{
\tl_set:No \l__phydoc_tmpa_tl { #1 }
\__codedoc_replace_at_at:N \l__phydoc_tmpa_tl
\__codedoc_get_hyper_target:oN { \l__phydoc_tmpa_tl } \l__phydoc_tmpa_tl
\hyperref [ \l__phydoc_tmpa_tl ] { \cs {#1} }
}
\ExplSyntaxOff
\makeatother
\title{Code documentation to the \pkg{physics2} package}
\author{Zhang Tingxuan\\\url{https://www.github.com/AlphaZTX/physics2}}
\parskip 2pt plus 1pt minus 0.5pt
\begin{document}
\maketitle
\tableofcontents\newpage
\pagestyle{phy}
\DocInput{physics2-code-doc-intro.dtx}
\DocInput{physics2-code-base.dtx}
\DocInput{physics2-code-utility.dtx}
\DocInput{physics2-code-ab.dtx}
\DocInput{physics2-code-braket.dtx}
\DocInput{physics2-code-matrix.dtx}
\DocInput{physics2-code-operator.dtx}
\DocInput{physics2-code-misc.dtx}
\clearpage
\PrintIndex
\end{document}
%</driver>
% \fi
%