Skip to content

Commit

Permalink
Merge pull request #13 from randolf-scholz/dev
Browse files Browse the repository at this point in the history
Added transpose and hermitian.
  • Loading branch information
randolf-scholz authored Apr 4, 2024
2 parents 95b5779 + 321479b commit 8db6cad
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ repos:
types_or: [python, pyi]
# pyright
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.356
rev: v1.1.357
hooks:
- id: pyright
# markdownlint
Expand All @@ -86,7 +86,7 @@ repos:
args: ["-x", "--shell=bash", "--color=always", "--format=gcc", "--"]
# custom
- repo: https://github.com/randolf-scholz/assorted-hooks.git
rev: v0.1.63
rev: v0.1.64
hooks:
- id: chktex
- id: lacheck
Expand Down
77 changes: 45 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,81 @@
# CHANGELOG

## 2024-04-04

Added transpose and hermitian transpose: `A𞁀` and `Aᵸ`.

Key combinations: `\transpose`/`\hermitian` or provisional `\tp`/`\htp`

We abuse the two Cyrillic characters:

- `𞁀`: U+1E040 Modifier Letter Cyrillic Small Te
- ``: U+0480 U+1D78 Modifier Letter Cyrillic En

In `unicode-symbols.sty` we define these as `\superscript{\mkern-1.5mu\mathsf{T}\mkern-1.5mu}}` and `\superscript{\mkern-1.5mu\mathsf{H}\mkern-1.5mu}}` respectively. We remove half a thinspace (`\!`=-3.0mu) on each side of the letter to improve spacing.

## 2024-04-02

- Added missing letter-like symbols (now complete)

## 2024-03-08

- Revamped the installation script, now with argparse.
- Revamped the installation script, now with `argparse`.
- Refactored the installation procedure. Now expects folders with `.tsv` files as input.
- Split custom icons into separate files, according to unicode block.
- Split custom icons into separate files, according to Unicode block.

## 2024-02-27

- Added italic and bold italic greek variants to `unicode-symbols.sty`.
- Added missing "variant" greek symbols such as `𝛡` (`\bfvarpi`)
- Added italic and bold italic Greek variants to `unicode-symbols.sty`.
- Added missing "variant" Greek symbols such as `𝛡` (`\bfvarpi`)

## 2024-02-26

Main work was refactoring the `unicode-symbols` package. It is now located in the `latex-package` directory.
Additionally a main achievement is the novel code for sub- and superscripts which automatically combines multiple sub- and superscripts into a single command.
Additionally, a main achievement is the novel code for sub- and superscripts which automatically combines multiple sub- and superscripts into a single command.

For example, `$xᵢⱼ$` will render identically to `$x_{ij}$` ($x_{ij}$).
For example, `$xᵢⱼ$` will render identically to `$x_{ij}$` ($x_{ij}$).

## 2024-01-23

Finally merged a dev branch into main.
Finally, merged a dev branch into main.

⚠️ Added `unicode-symbols.sty` which provides a subset of the unicode symbols for usage with `pdflatex`. ⚠️
⚠️ Added `unicode-symbols.sty` which provides a subset of the Unicode symbols for usage with `pdflatex`. ⚠️

- Revamped the generation script
- renamed `.csv` files to `.tsv`, since we use tabs as separators
- added `custom_icons.tsv` with additional unicode icons
- added `custom_symbols.tsv` with additional unicode symbols
- added `custom_icons.tsv` with additional Unicode icons
- added `custom_symbols.tsv` with additional Unicode symbols
- DIGIT variants
- circled numbers ①,②,③,… (`\o1`, `\o2`, `\o20`)
- bold digits 𝟎,𝟏,𝟐,… (`\bf0`, `\bf1`, … `\bf9`)
- double-struck digits 𝟘,𝟙,𝟚,… (`\bb0`, `\bb1`, … `\bb9`)
- sans-serif digits 𝟢,𝟣,𝟤,… (`\sans0`, `\sans01`, … `\sans9`)
- bold sans-serif digits 𝟬,𝟭,𝟮,… (`\bsans0`, `\bsans1`, … `\bsans9`)
- typewriter (monospace) digits 𝟶,𝟷,𝟸,… (`\tt0`, `\tt1`, … `\tt9`)
- digits with stop ⒈,⒉,⒊,… (`\1.`, `\2.`, … `\20.`)
- circled numbers ①, ②, ③, … (`\o1`, `\o2`, … `\o20`)
- bold digits 𝟎, 𝟏, 𝟐, … (`\bf0`, `\bf1`, … `\bf9`)
- double-struck digits 𝟘, 𝟙, 𝟚, … (`\bb0`, `\bb1`, … `\bb9`)
- sans-serif digits 𝟢, 𝟣, 𝟤, … (`\sans0`, `\sans01`, … `\sans9`)
- bold sans-serif digits 𝟬, 𝟭, 𝟮, … (`\bsans0`, `\bsans1`, … `\bsans9`)
- typewriter (monospaced) digits 𝟶, 𝟷, 𝟸, … (`\tt0`, `\tt1`, … `\tt9`)
- digits with stop ⒈, ⒉, ⒊, … (`\1.`, `\2.`, … `\20.`)
- parenthesized digits ⑴, ⑵, ⑶… (`\(1)`, `\(2)`, … `\(20)`)
- LETTER variants
- small capital letters ᴀ,ʙ,ᴄ,… (`\scA`, `\scB`, … `\scZ`)
- circled uppercase letters Ⓐ,Ⓑ,Ⓒ,… (`\oA`, `\oB`, … `\oZ`)
- circled lowercase letters ⓐ,ⓑ,ⓒ,… (`\oa`, `\ob`, … `\oz`)
- parenthesized latin letters ⒜, ⒝, ⒞, … (`\a`, `\b`, … `\z`)
- Roman Numerals
- uppercase roman numerals Ⅰ, Ⅱ, Ⅲ,… (`\RM1`, `\RM2`, … `\RM1000`)
- lowercase roman numerals ⅰ, ⅱ, ⅲ, … (`\rm1`, `\rm2`, … `\rm1000`)
- Additional Aliases from existing unicode characters
- small capital letters ᴀ, ʙ, ᴄ, … (`\scA`, `\scB`, … `\scZ`)
- circled uppercase letters Ⓐ, Ⓑ, Ⓒ, … (`\oA`, `\oB`, … `\oZ`)
- circled lowercase letters ⓐ, ⓑ, ⓒ, … (`\oa`, `\ob`, … `\oz`)
- parenthesized Latin letters ⒜, ⒝, ⒞, … (`\a`, `\b`, … `\z`)
- Roman numerals
- uppercase Roman numerals Ⅰ, Ⅱ, Ⅲ, … (`\RM1`, `\RM2`, … `\RM1000`)
- lowercase Roman numerals ⅰ, ⅱ, ⅲ, … (`\rm1`, `\rm2`, … `\rm1000`)
- Additional Aliases from existing Unicode characters
- ✅ (`\CMARK`), ❌ (`\XMARK`)
- ‖ (`\|`)
- ﹢ (`\+`), ﹣ (`\-`), (unary plus/minus)
- Small Form Variants
- Fullwidth variants: `` (`\,`, replace `$,\,$`), `` (`\:`, replaces `$\colon$`), `` (`\;`, replaces `$;\,$`)
- Full width variants: `` (`\,`, replace `$,\,$`), `` (`\:`, replaces `$\colon$`), `` (`\;`, replaces `$;\,$`)
- etc.
- Added extraction code for complete unicode database for future work.
- Added extraction code for complete Unicode database for future work.

Ideas for future work:

- support an autokey alternative that works with wayland.
- It would be really nice to have something similar to language server protocol for these unicode expansion,
- Support an AutoKey alternative that works with Wayland.
- It would be really nice to have something similar to language server protocol for these Unicode expansion,
facilitating auto-completion and discovery.
- autogenerate the `unicode-symbols.sty` file from the unicode database.
- Allow installing subset of unicode symbols, e.g. only math symbols, or only arrows, etc.
- in particular "basic plane" symbols, since overleaf.com only supports those.
- Auto-generate the `unicode-symbols.sty` file from the Unicode database.
- Allow installing subset of Unicode symbols, e.g. only math symbols, or only arrows, etc.
- In particular "basic plane" symbols, since overleaf.com only supports those.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ Note: Generally here not all characters are available:
- Doesn't support multiple sub/super-scripts like Julia does (e.g. in REPL, `a\^(k)+[TAB]`) gives `a⁽ᵏ⁾`. With `AutoKey` we need to add the superscripts one at a time.
- Seems like it doesn't work with a German keyboard because `AutoKey` interprets `\` and `[AltGr]+?` (what you type on a German keyboard to get backslash) as different things.

## [CHANGELOG](CHANGELOG.md)
## [Changelog](CHANGELOG.md)

- 2024-04-04: Added transpose and hermitian transpose: `A𞁀` and `Aᵸ`. (use `\transpose`/`\hermitian` or provisional `\tp`/`\htp`)
- 2024-04-02: Added missing letter-like symbols
- 2024-03-08: Revamped the installation script, refactored the installation procedure.
- 2024-02-27: Added italic and bold italic Greek variants to `unicode-symbols.sty`.
Expand Down
2 changes: 2 additions & 0 deletions icons/custom_unicode/icons.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ U+2984 ⦄ \bb}, \rBrace Right White Curly Bracket
U+2985 \bb(, \lParen Left White Parenthesis
U+2986 \bb), \rParen Right White Parenthesis
U+00B5 µ \micro Micro Sign
U+1E040 𞁀 \transpose, \tp Modifier Letter Cyrillic Small Te (transpose)
U+1D78 \hermitian, \htp Modifier Letter Cyrillic En (Hermitian transpose)
11 changes: 11 additions & 0 deletions latex-package/tests/test_mainfile.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
\documentclass[a4paper, 10pt, oneside]{book}

\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc} % use 8-bit T1 fonts
\usepackage{unicode-symbols}
\usepackage{subfiles}

\begin{document}
Hello World
\subfile{test_subfile}
\end{document}
2 changes: 1 addition & 1 deletion latex-package/tests/test_sans.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\usepackage[stix]{unicode-symbols}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{times}
%\usepackage{times}

\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{\mddefault}{\sldefault}
\SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}
Expand Down
5 changes: 5 additions & 0 deletions latex-package/tests/test_subfile.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
\documentclass[test_mainfile]{subfiles}

\begin{document}
$$\textsc{foo}$$
\end{document}
35 changes: 35 additions & 0 deletions latex-package/tests/test_transpose.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
% !TeX document-id = {041f6962-aebb-46f8-8d1e-425e88689d38}
% !TeX TXS-program:compile = txs:///pdflatex
\documentclass[10pt]{standalone}
\usepackage[verbose]{newunicodechar}
\usepackage[stix]{unicode-symbols}
\usepackage{booktabs}
\usepackage{multicol}

% NOTE: We want to test which is the best way to do a tranpose

\newcommand{\T}{{\scriptscriptstyle\mathsf{T}}}
\newunicodechar{⊺}{\intercal}
\newcommand{\tp}{^{\mkern-1.5mu\mathsf{T}}}
\newcommand{\tx}{^{\!\mathsf{T}}}
\newcommand{\ty}{^{\mkern-1.5mu\mathsf{T}\mkern-1.5mu}}

\def\test#1{(#1)(#1)(#1)}

\begin{document}
\begin{tabular}{llll}\toprule
\verb|T| & $\test{u^T v}$ & $\test{A^T B}$ & $\test{𝐇^T 𝐗}$
\\ \verb|\intercal| & $\test{u^⊺ v}$ & $\test{A^⊺ B}$ & $\test{𝐇^⊺ 𝐗}$
\\ \verb|\top| & $\test{u^⊤ v}$ & $\test{A^⊤ B}$ & $\test{𝐇^⊤ 𝐗}$
\\ \verb|\mathsf| & $\test{u^𝖳 v}$ & $\test{A^𝖳 B}$ & $\test{𝐇^𝖳 𝐗}$
\\ \verb|sf+small| & $\test{u^\T v}$ & $\test{A^\T B}$ & $\test{𝐇^\T 𝐗}$
\\ \verb|!sf| & $\test{u\tp v}$ & $\test{A\tp B}$ & $\test{𝐇\tp 𝐗}$
\\ \verb|!!sf| & $\test{u\tx v}$ & $\test{A\tx B}$ & $\test{𝐇\tx 𝐗}$
\\ \verb|!sf!| & $\test{u\ty v}$ & $\test{A\ty B}$ & $\test{𝐇\ty 𝐗}$
\\ \midrule
\verb|ours| & $\test{u𞁀v}$ & $\test{A𞁀B}$ & $\test{𝐇𞁀𝐗}$
\\ \verb|ours| & $\test{u⁻𞁀v}$ & $\test{A⁻𞁀B}$ & $\test{𝐇⁻𞁀𝐗}$
\\ \bottomrule
\end{tabular}

\end{document}
97 changes: 97 additions & 0 deletions latex-package/tests/test_vanilla.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

\RequirePackage{iftex}
\NeedsTeXFormat{LaTeX2e}
\documentclass{standalone}

\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc} % use 8-bit T1 fonts
\usepackage{unicode-symbols}


% region subfiles ----------------------------------------------------------------------
\usepackage{refcount}
\usepackage{standalone}
\usepackage{import}
\usepackage{subfiles}
\usepackage{xr} % cross-referencing between files
% endregion subfiles -------------------------------------------------------------------

% region graphics ----------------------------------------------------------------------
\usepackage{adjustbox} % resize arbitrary content
\usepackage{float} % improved float, H option
\usepackage{graphicx} % \includegraphics
\usepackage{svg} % svg images
\usepackage[svgnames]{xcolor} % colors
\usepackage{tikz} % tikz figures
\usepackage{pgfplots} % function plots
% endregion graphics -------------------------------------------------------------------

% region maths -------------------------------------------------------------------------
\usepackage{amsmath} % math utilities
\usepackage{physics} % physics package
\usepackage{xfrac} % \sfrac for typesetting fractions a la ½
\usepackage{cancel} % \cancel for crossing out terms in equations
\usepackage{mathtools} % extension to amsmath
\usepackage{nicematrix}
% endregion maths ----------------------------------------------------------------------

% region tables/figures ----------------------------------------------------------------
\usepackage{tabularx} % tables with fixed width
\usepackage{ltablex} % \tabularx longer than one page
\usepackage{longtable} % tabular longer than one page
\usepackage{wrapfig} % text wrapping around figures
\usepackage{booktabs} % professional-quality tables
\usepackage{tablefootnote} % footnotes in tables
\usepackage{multirow} % \multirow in tables
\usepackage{pgfplotstable} % import csv or tsv files as tables
\usepackage{arydshln} % dashed lines in tables
% \RequirePackage{colortbl} % color column or row
\usepackage{caption} % captions for figures and tables
\usepackage{subcaption} % captions for subfigures.
% endregion tables/figures -------------------------------------------------------------

% region fonts/typography --------------------------------------------------------------
% \usepackage{times} % times new roman
\usepackage{microtype} % microtypography
\usepackage{amsfonts} % math fonts
\usepackage{lipsum} % dummy text
\usepackage{outlines} % easy nested lists/enumerations
\usepackage{enumitem} % customizing lists, provides noitemsep
%\usepackage{todonotes} % todos in margin
% endregion fonts/typography -----------------------------------------------------------

\pgfplotsset{compat=1.18}
\graphicspath{{images/}} % Sets the path to the images folder
\captionsetup{justification=centering}
\pdfminorversion=7% Set PDF version to 1.7

\usepackage{ismll-mathoperators}
\newcommand{\crulefill}{\vspace{.25\baselineskip}\hrule\vspace{.25\baselineskip}}
\definecolor{optional}{rgb}{1.0, 0.4, 0.4}
\newcommand{\optional}[1]{{\color{optional} #1}}

% consider using ⁇ instead of \? for where-operator? (\Question in stix package)
\newcommand{\?}{\mathbin{?}}
% \newcommand{\?}{\mathbin{\ooalign{$\hidewidth?\hidewidth$\cr$\phantom{+}$}}}
% \newcommand{\nan}{\ifmmode\texttt{NA}\else\GenericError{}{Need math mode}{}{}\fi}
\newcommand{\nan}{\texttt{NaN}}
\newcommand{\NA}{\texttt{N\!/\!A}}
\DeclareMathOperator{\Seq}{Seq}
\DeclareMathOperator{\codom}{codom}
\DeclareMathOperator{\im}{im}
\DeclareMathOperator{\range}{range}

% \newcommand{\citeit}{\textcolor{red}{\textsc{reference}}}
\newcommand{\obs}{{\textsc{obs}}}% observed
\newcommand{\emp}{{\textsc{emp}}}% empirical
\newcommand{\now}{{\textsc{now}}}% now
\newcommand{\TODO}[1]{\textcolor{red}{\textbf{#1}}}


%\usepackage{amsfonts} % math fonts
\begin{document}
The standard continuous time forecasting task is to predict the value of $𝓨$ over the time interval $(t_\now, t_F]$, called the \emph{forecasting window} or \emph{future horizon}, given all observations in the interval $[t_L, t_\now]$, called the \emph{lookback window} or \emph{observation horizon}.

$$ \textsc{bar} $$
$$\textsc{foo} \text{\scshape bar} βα∑ₖ $$
\end{document}
31 changes: 18 additions & 13 deletions latex-package/texmf/tex/latex/unicode-symbols.sty
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@

% Get some missing symbols
\@ifpackageloaded{stix}{}{% REF:https://tex.stackexchange.com/a/318144/119955
\DeclareFontEncoding{LS2}{}{\noaccents@}
\DeclareFontSubstitution{LS2}{stix}{m}{n}
\DeclareSymbolFont{stix@largesymbols}{LS2}{stixex}{m}{n}
\SetSymbolFont{stix@largesymbols}{bold}{LS2}{stixex}{b}{n}
\DeclareMathDelimiter{\lBrack}{\mathopen} {stix@largesymbols}{"E0}{stix@largesymbols}{"06}
\DeclareMathDelimiter{\rBrack}{\mathclose}{stix@largesymbols}{"E1}{stix@largesymbols}{"07}
\DeclareMathDelimiter{\lBrace}{\mathopen} {stix@largesymbols}{"E8}{stix@largesymbols}{"0E}
\DeclareMathDelimiter{\rBrace}{\mathclose}{stix@largesymbols}{"E9}{stix@largesymbols}{"0F}
\DeclareMathDelimiter{\lParen}{\mathopen} {stix@largesymbols}{"DE}{stix@largesymbols}{"02}
\DeclareMathDelimiter{\rParen}{\mathclose}{stix@largesymbols}{"DF}{stix@largesymbols}{"03}
\DeclareMathDelimiter{\lAngle}{\mathopen} {stix@largesymbols}{"EC}{stix@largesymbols}{"12}
\DeclareMathDelimiter{\rAngle}{\mathclose}{stix@largesymbols}{"ED}{stix@largesymbols}{"13}
\DeclareFontEncoding{LS2}{}{\noaccents@}
\DeclareFontSubstitution{LS2}{stix}{m}{n}
\DeclareSymbolFont{stix@largesymbols}{LS2}{stixex}{m}{n}
\SetSymbolFont{stix@largesymbols}{bold}{LS2}{stixex}{b}{n}
\DeclareMathDelimiter{\lBrack}{\mathopen} {stix@largesymbols}{"E0}{stix@largesymbols}{"06}
\DeclareMathDelimiter{\rBrack}{\mathclose}{stix@largesymbols}{"E1}{stix@largesymbols}{"07}
\DeclareMathDelimiter{\lBrace}{\mathopen} {stix@largesymbols}{"E8}{stix@largesymbols}{"0E}
\DeclareMathDelimiter{\rBrace}{\mathclose}{stix@largesymbols}{"E9}{stix@largesymbols}{"0F}
\DeclareMathDelimiter{\lParen}{\mathopen} {stix@largesymbols}{"DE}{stix@largesymbols}{"02}
\DeclareMathDelimiter{\rParen}{\mathclose}{stix@largesymbols}{"DF}{stix@largesymbols}{"03}
\DeclareMathDelimiter{\lAngle}{\mathopen} {stix@largesymbols}{"EC}{stix@largesymbols}{"12}
\DeclareMathDelimiter{\rAngle}{\mathclose}{stix@largesymbols}{"ED}{stix@largesymbols}{"13}
}


Expand Down Expand Up @@ -165,6 +165,8 @@


% region text/math macros --------------------------------------------------------------
\newcommand{\unicode@transpose}{\superscript{\mkern-1.5mu\mathsf{T}\mkern-1.5mu}}
\newcommand{\unicode@hermitian}{\superscript{\mkern-1.5mu\mathsf{H}\mkern-1.5mu}}
\newcommand{\unicode@dagger}{\ifmmode\dagger\else\textdagger\fi}
\newcommand{\unicode@ddagger}{\ifmmode\ddagger\else\textdaggerdbl\fi}
\newcommand{\unicode@times}{\ifmmode\times\else\texttimes\fi}
Expand Down Expand Up @@ -288,7 +290,8 @@
\makeatletter

% region experimental ------------------------------------------------------------------
\newunicodechar{ᵸ}{^{\mathsf{H}}} % Hermitian conjugate (note: cyrillic H)
\newunicodechar{𞁀}{\superscript{\mkern-1.5mu\mathsf{T}\mkern-1.5mu}}% U+1E040 Modifier Letter Cyrillic Small Te (Transpose)
\newunicodechar{ᵸ}{\superscript{\mkern-1.5mu\mathsf{H}\mkern-1.5mu}}% U+1D78 Modifier Letter Cyrillic En (Hermitian conjugate)
% endregion experimental ---------------------------------------------------------------

% region misc --------------------------------------------------------------------------
Expand Down Expand Up @@ -319,6 +322,7 @@
\newunicodechar{‡}{\unicode@ddagger}
\newunicodechar{↯}{\unicode@contradiction}
\newunicodechar{≙}{\hateq} % U+02259 Estimates
\newunicodechar{⊺}{\intercal}
% endregion misc -----------------------------------------------------------------------

% region combining characters ----------------------------------------------------------
Expand Down Expand Up @@ -2255,4 +2259,5 @@

% endregion payload ====================================================================
\makeatother%
\PackageInfo{unicode-symbols}{finished importing symbols}
\endinput%

0 comments on commit 8db6cad

Please sign in to comment.