Skip to content

Commit f0bbd8e

Browse files
wip
1 parent 448497f commit f0bbd8e

15 files changed

+572
-53
lines changed

latex-package/NOTE.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# How to progress
2+
3+
- Need to automate the process of adding symbols.
4+
- Need a database of symbols, together with providers.
5+
- For a given symbol, there may be multiple providers, such as `stix`, `amssymb`, etc.
6+
- Create a table with Unicode-chars, mapping to the providers.
7+
8+
## Header scheme for Database
9+
10+
Create a table with the following headers:
11+
12+
- `ID`: Unicode hexadecimal code.
13+
- `CHAR`: Unicode character.
14+
- `GROUP`: Group of the symbol.
15+
- `NAME`: Name of the symbol. (used to create...)
16+
- `canonical_command`: canonical command which will be assigned by `\newunicodechar`.
17+
- Example: `\hateq` for ``.
18+
- `canonical_type`: canonical type of the symbol (`mathbin`, `mathord`, etc.)
19+
- `providers`: mapping between latex packages and the command that produces the symbol.
20+
- Maybe just as regular columns...
21+
- Maybe synthesize from per package tables.
22+
- Example: `{stix: \hateq, fdsymbol: \wedgeq}`.
23+
- Default providers: `core`, `ams`, `stix`, `fdsymbol`, `MnSymbol`, etc.
24+
- `type`
25+
26+
## Automating tests
27+
28+
We need to test several things:
29+
30+
- Unicode chars work.
31+
- AutoKey-mappings align with the Unicode chars.
32+
- The symbols are correctly displayed in the pdf.
33+
- The symbols are searchable in the pdf.
34+
- Tests are automated.
+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
\documentclass{standalone}
2+
\usepackage{booktabs}
3+
\usepackage{multicol}
4+
5+
\usepackage[verbose]{newunicodechar}
6+
\usepackage{test_setup}
7+
%\usepackage[nostix]{unicode-symbols}
8+
\usepackage{amssymb}
9+
\usepackage{amsmath}
10+
11+
\NewDocumentCommand{\makerow}{s m O{}}{%
12+
\pgfkeys{/makerow, default, #3}% set defaults
13+
\umeaning{#2} & #2 & \rowTEXT & #2 & \rowMATH & $#2$ \\%
14+
}
15+
16+
\NewDocumentCommand{\maketext}{s m O{}}{%
17+
\pgfkeys{/makerow, default, #3}% set defaults
18+
\umeaning{#2} & #2 & \rowTEXT & #2 && \\%
19+
}
20+
21+
22+
\NewDocumentCommand{\makemath}{s m O{}}{%
23+
\pgfkeys{/makerow, default, #3}% set defaults
24+
\rowMATH \\
25+
% \umeaning{#2} & $#2$ &&& \rowMATH & $#2$ \\%
26+
}
27+
28+
\begin{document}
29+
\begin{tabular}{ll|ll|ll} % chktex 44
30+
\toprule
31+
meaning & symbol & \multicolumn{2}{c|}{\textbf{text}} & \multicolumn{2}{c}{\textbf{math}} \\
32+
\midrule% Text symbols ----------------------------------
33+
\makerow{}[text=\checkmark, math=$\checkmark$]
34+
\midrule% Table 54 (binary operations) -------------------------------------------------
35+
\makemath{⊼}[math=$\barwedge$ ]
36+
\makemath{⊡}[math=$\boxdot$ ]
37+
\makemath{⊟}[math=$\boxminus$ ]
38+
\makemath{⊞}[math=$\boxplus$ ]
39+
\makemath{⊠}[math=$\boxtimes$ ]
40+
\makemath{⋒}[math=$\Cap$ ]
41+
\makemath{}[math=$\centerdot$ ]
42+
\makemath{⊛}[math=$\circledast$ ]
43+
\makemath{⊚}[math=$\circledcirc$ ]
44+
\makemath{⊖}[math=$\circleddash$ ]
45+
\makemath{⋓}[math=$\Cup$ ]
46+
\makemath{⋎}[math=$\curlyvee$ ]
47+
\makemath{⋏}[math=$\curlywedge$ ]
48+
\makemath{⋇}[math=$\divideontimes$ ]
49+
\makemath{∔}[math=$\dotplus$ ]
50+
\makemath{⩞}[math=$\doublebarwedge$ ]
51+
\makemath{⊺}[math=$\intercal$ ]% *
52+
\makemath{⋋}[math=$\leftthreetimes$ ]
53+
\makemath{⋉}[math=$\ltimes$ ]
54+
\makemath{⋌}[math=$\rightthreetimes$]
55+
\makemath{⋊}[math=$\rtimes$ ]
56+
\makemath{}[math=$\smallsetminus$ ]
57+
\makemath{⊻}[math=$\veebar$ ]
58+
\midrule% Table 80 (Variable-sized Math Operators) -------------------------------------
59+
\makemath{∬}[math=$\iint$ ]
60+
\makemath{∭}[math=$\iiint$ ]
61+
\makemath{⨌}[math=$\iiiint$ ]
62+
\makemath{}[math=$\idotsint$ ]
63+
\midrule% Table 99 (binary relations) --------------------------------------------------
64+
\makemath{≊}[math=$\approxeq$ ]
65+
\makemath{϶}[math=$\backepsilon$ ]
66+
\makemath{∽}[math=$\backsim$ ]
67+
\makemath{⋍}[math=$\backsimeq$ ]
68+
\makemath{∵}[math=$\because$ ]
69+
\makemath{≬}[math=$\between$ ]
70+
\makemath{≎}[math=$\Bumpeq$ ]
71+
\makemath{≏}[math=$\bumpeq$ ]
72+
\makemath{⊜}[math=$\circeq$ ]
73+
\makemath{⋞}[math=$\curlyeqprec$ ]
74+
\makemath{⋟}[math=$\curlyeqsucc$ ]
75+
\makemath{≑}[math=$\doteqdot$ ]
76+
\makemath{≖}[math=$\eqcirc$ ]
77+
\makemath{≒}[math=$\fallingdotseq$ ]
78+
\makemath{⊸}[math=$\multimap$ ]
79+
\makemath{⋔}[math=$\pitchfork$ ]
80+
\makemath{⪷}[math=$\precapprox$ ]
81+
\makemath{≼}[math=$\preccurlyeq$ ]
82+
\makemath{≾}[math=$\precsim$ ]
83+
\makemath{≓}[math=$\risingdotseq$ ]
84+
\makemath{}[math=$\shortmid$ ]
85+
\makemath{}[math=$\shortparallel$ ]
86+
\makemath{}[math=$\smallfrown$ ]
87+
\makemath{}[math=$\smallsmile$ ]
88+
\makemath{⪸}[math=$\succapprox$ ]
89+
\makemath{≽}[math=$\succcurlyeq$ ]
90+
\makemath{≿}[math=$\succsim$ ]
91+
\makemath{∴}[math=$\therefore$ ]
92+
\makemath{}[math=$\thickapprox$ ]
93+
\makemath{}[math=$\thicksim$ ]
94+
\makemath{}[math=$\varpropto$ ]
95+
\makemath{⊩}[math=$\Vdash$ ]
96+
\makemath{⊨}[math=$\vDash$ ]
97+
\makemath{⊪}[math=$\Vvdash$ ]
98+
\midrule% Table 100 (negated binary relations) -----------------------------------------
99+
\makemath{≇}[math=$\ncong$ ]
100+
\makemath{∤}[math=$\nmid$ ]
101+
\makemath{∦}[math=$\nparallel$ ]
102+
\makemath{⊀}[math=$\nprec$ ]
103+
\makemath{}[math=$\npreceq$ ]
104+
\makemath{}[math=$\nshortmid$ ]
105+
\makemath{}[math=$\nshortparallel$ ]
106+
\makemath{≁}[math=$\nsim$ ]
107+
\makemath{⊁}[math=$\nsucc$ ]
108+
\makemath{}[math=$nsucceq$ ]
109+
\makemath{⊭}[math=$\nvDash$ ]
110+
\makemath{⊬}[math=$\nvdash$ ]
111+
\makemath{⊯}[math=$\nVDash$ ]
112+
\makemath{⪹}[math=$\precnapprox$ ]
113+
\makemath{⋨}[math=$\precnsim$ ]
114+
\makemath{⪺}[math=$\succnapprox$ ]
115+
\makemath{⋩}[math=$\succnsim$ ]
116+
\midrule% Table 125 (subset and superset relations) ------------------------------------
117+
\makemath{⊈}[math=$\nsubseteq$ ]
118+
\makemath{⊉}[math=$\nsupseteq$ ]
119+
\makemath{}[math=$\nsupseteqq$ ]
120+
\makemath{⊏}[math=$\sqsubset$ ]
121+
\makemath{⊐}[math=$\sqsupset$ ]
122+
\makemath{⋐}[math=$\Subset$ ]
123+
\makemath{⫅}[math=$\subseteqq$ ]
124+
\makemath{⊊}[math=$\subsetneq$ ]
125+
\makemath{⫋}[math=$\subsetneqq$ ]
126+
\makemath{⋑}[math=$\Supset$ ]
127+
\makemath{⫆}[math=$\supseteqq$ ]
128+
\makemath{⊋}[math=$\supsetneq$ ]
129+
\makemath{⫌}[math=$\supsetneqq$ ]
130+
\makemath{}[math=$\varsubsetneq$ ]
131+
\makemath{}[math=$\varsubsetneqq$ ]
132+
\makemath{}[math=$\varsupsetneq$ ]
133+
\makemath{}[math=$\varsupsetneqq$ ]
134+
\midrule% Table 156 (Arrows) -----------------------------------------------------------
135+
\makemath{⟲}[math=$\circlearrowleft$ ]
136+
\makemath{⟳}[math=$\circlearrowright$ ]
137+
\makemath{↶}[math=$\curvearrowleft$ ]
138+
\makemath{↷}[math=$\curvearrowright$ ]
139+
\makemath{⇠}[math=$\dashleftarrow$ ]
140+
\makemath{⇢}[math=$\dashrightarrow$ ]
141+
\makemath{⇊}[math=$\downdownarrows$ ]
142+
\makemath{↢}[math=$\leftarrowtail$ ]
143+
\makemath{⇇}[math=$\leftleftarrows$ ]
144+
\makemath{⇆}[math=$\leftrightarrows$ ]
145+
\makemath{↭}[math=$\leftrightsquigarrow$]
146+
\makemath{⇚}[math=$\Lleftarrow$ ]
147+
\makemath{↫}[math=$\looparrowleft$ ]
148+
\makemath{↬}[math=$\looparrowright$ ]
149+
\makemath{↰}[math=$\Lsh$ ]
150+
\makemath{↣}[math=$\rightarrowtail$ ]
151+
\makemath{⇄}[math=$\rightleftarrows$ ]
152+
\makemath{⇒}[math=$\rightrightarrows$ ]
153+
\makemath{⇝}[math=$\rightsquigarrow$ ]
154+
\makemath{↱}[math=$\Rsh$ ]
155+
\makemath{↞}[math=$\twoheadleftarrow$ ]
156+
\makemath{↠}[math=$\twoheadrightarrow$ ]
157+
\makemath{⇈}[math=$\upuparrows$ ]
158+
159+
160+
\bottomrule
161+
\end{tabular}
162+
\end{document}

latex-package/tests/test_textoids.tex

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
\documentclass{standalone}
1+
\documentclass{article}
22
\usepackage{booktabs}
33
\usepackage{multicol}
4-
\usepackage[nostix]{unicode-symbols}
4+
%\usepackage[nostix]{unicode-symbols}
5+
\usepackage{amsmath}
56
\def\repeat#1{(#1) (#1) (#1)}
6-
\begin{document}
7-
\begin{tabular}{ll}
8-
\repeat{$D^\textsc{\tiny obs}$} & \repeat{$D^\textsc{\tiny train}$} \\
9-
\repeat{$D^\text{obs}$} & \repeat{$D^\text{train}$} \\
10-
\repeat{$D^\textsc{obs}$} & \repeat{$D^\textsc{train}$} \\
11-
\hline
12-
\repeat{$D^\textsc{\tiny miss}$} & \repeat{$D^\textsc{\tiny val}$}\\
13-
\repeat{$D^\text{miss}$} & \repeat{$D^\text{val}$} \\
14-
\repeat{$D^\textsc{miss}$} & \repeat{$D^\textsc{val}$} \\
15-
\hline
16-
\repeat{$D^\textsc{\tiny emp}$} & \repeat{$D^\textsc{\tiny test}$} \\
17-
\repeat{$D^\text{emp}$} & \repeat{$D^\text{test}$} \\
18-
\repeat{$D^\textsc{emp}$} & \repeat{$D^\textsc{test}$} \\
19-
\end{tabular}
7+
\begin{document}^
8+
%\begin{tabular}{ll}
9+
%\repeat{$D^\textsc{\tiny obs}$} & \repeat{$D^\textsc{\tiny train}$} \\
10+
%\repeat{$D^\text{obs}$} & \repeat{$D^\text{train}$} \\
11+
%\repeat{$D^\textsc{obs}$} & \repeat{$D^\textsc{train}$} \\
12+
%\hline
13+
%\repeat{$D^\textsc{\tiny miss}$} & \repeat{$D^\textsc{\tiny val}$}\\
14+
%\repeat{$D^\text{miss}$} & \repeat{$D^\text{val}$} \\
15+
%\repeat{$D^\textsc{miss}$} & \repeat{$D^\textsc{val}$} \\
16+
%\hline
17+
%\repeat{$D^\textsc{\tiny emp}$} & \repeat{$D^\textsc{\tiny test}$} \\
18+
%\repeat{$D^\text{emp}$} & \repeat{$D^\text{test}$} \\
19+
%\repeat{$D^\textsc{emp}$} & \repeat{$D^\textsc{test}$} \\
20+
%\end{tabular}
2021
\end{document}
+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
% Subscript
2+
%
3+
% © Randolf Scholz
4+
%
5+
% This package simply contains a list of newunicodechar declarations,
6+
% which allows to use a reasonable subset of Unicode characters together
7+
% with pdflatex.
8+
9+
% This package provides the commands \subscript and \superscript, which, contrary to
10+
% the original implementations of ^{} and _{} can be combined: \subscript{x}\subscript{y}
11+
% is the same as \subscript{xy}. In particular, this package is used to facilitate unicode superscripts such as $Aᵢⱼ$.
12+
% However, we do not remove erros on $x^{1}^{2}$, since likely this is a user error.
13+
14+
15+
% Additionally, this package incorporates other patches to the subscript system
16+
%
17+
% 1. `subdepth`: We incorporate the subdepth patch, to ensure that the verical alignment of subscripts is ok.
18+
% 2.
19+
%
20+
21+
% chktex-file 18
22+
% chktex-file 41
23+
\NeedsTeXFormat{LaTeX2e}
24+
\ProvidesPackage{subscript}[2024/04/12 subscripts]
25+
26+
27+
% region subdepth patch ================================================================
28+
% REF: https://tex.stackexchange.com/q/51678
29+
% REF: https://ctan.org/pkg/subdepth
30+
\makeatletter
31+
\addto@hook\every@math@size{\dch@scr@hook}
32+
\newif\if@wspr@sup@low@
33+
34+
35+
\def\dch@scr@adjust{%
36+
\@ifundefined{dch@sizet\f@size}{%
37+
\expandafter\dch@set@script\csname dch@sizet\f@size\endcsname%
38+
}{%
39+
\csname dch@sizet\f@size\endcsname%
40+
}%
41+
}
42+
43+
\def\dch@set@script#1{%
44+
\begingroup % fontdimen settings are global anyway
45+
\frozen@everymath{}% Prevent recursion!
46+
\let#1\@empty%
47+
\let\dch@do@one\relax%
48+
\dch@set@one\scriptscriptstyle\scriptscriptfont#1\ssf@size%
49+
\dch@set@one\scriptstyle\scriptfont#1\sf@size%
50+
\dch@set@one\textstyle\textfont#1\f@size%
51+
\endgroup%
52+
#1%
53+
}
54+
55+
56+
\def\dch@set@one#1#2#3#4{%
57+
\@ifundefined{dch@size#4}{%
58+
\expandafter\xdef\csname dch@size#4\endcsname{%
59+
\unless\if@wspr@sup@low@%
60+
\fontdimen13\the#2\tw@=\the\fontdimen13#2\tw@%
61+
\fontdimen14\the#2\tw@=\the\fontdimen14#2\tw@%
62+
\fontdimen15\the#2\tw@=\the\fontdimen15#2\tw@%
63+
\fi%
64+
\fontdimen16\the#2\tw@=\the\fontdimen16#2\tw@%
65+
\fontdimen17\the#2\tw@=\the\fontdimen17#2\tw@%
66+
}%
67+
}{%
68+
\csname dch@size#4\endcsname%
69+
}%
70+
\setbox\z@\hbox{$#1H_2$}\@tempdima\dp\z@%
71+
\setbox\z@\hbox{$#1H_2^{+\vrule \@height 1em}$}%
72+
\ifdim\@tempdima<\dp\z@%
73+
\@tempdima\dimexpr (\@tempdima+\dp\z@)/2 \relax%
74+
\@tempdimb\dimexpr (\dp\z@-\@tempdima+\ht\z@-1em) \relax%
75+
\xdef#3{#3\dch@do@one#2{\the\@tempdimb}{\the\@tempdima}}%
76+
\fi%
77+
}
78+
79+
\def\dch@do@one#1#2#3{%
80+
\unless\if@wspr@sup@low@%
81+
\fontdimen13#1\tw@#2\relax%
82+
\fontdimen14#1\tw@\fontdimen13#1\tw@%
83+
\fontdimen15#1\tw@\fontdimen13#1\tw@%
84+
\fi%
85+
\fontdimen\sixt@@n#1\tw@#3%
86+
\fontdimen17#1\tw@%
87+
\fontdimen\sixt@@n#1\tw@%
88+
}%
89+
90+
91+
\let\dch@scr@hook\dch@scr@adjust%
92+
\ifx\glb@currsize\f@size\dch@scr@adjust\fi%
93+
\makeatother
94+
% endregion subdepth patch =============================================================
95+
96+
97+
% region subscript-braces patch ========================================================
98+
% NOTE: This patch allows to write subscripts without braces, e.g. x^\max instead of x^{\max}
99+
% REF: https://tex.stackexchange.com/q/655977
100+
\makeatletter
101+
\let\old@sup=^% save a copy of original ^ with catcode 7
102+
\catcode`\^=13% make ^ and activate character
103+
\def^#1{\old@sup{#1}}% change definition to call the original ^ with braces
104+
105+
% patch \pr@m@s using `^` with the new catcode.
106+
\def\pr@m@s{% copy of \@pr@m@s code from latex.ltx
107+
\ifx'\@let@token% <-- use U+0027
108+
\expandafter\pr@@@s%
109+
\else\ifx^\@let@token%
110+
\expandafter\expandafter\expandafter\pr@@@t%
111+
\else%
112+
\egroup%
113+
\fi\fi%
114+
}
115+
\makeatother
116+
% endregion subscript-braces patch =====================================================
117+
118+
119+
% endregion payload ====================================================================
120+
\PackageInfo{subscript}{finished}
121+
\endinput%

0 commit comments

Comments
 (0)