summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/semtex/semtex.sty
blob: 077cdb1983f8aee41d2d5bbacec6fc64f371c15d (plain)
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
\RequirePackage{xparse}
\ProvidesExplPackage{semtex}{2020/10/03}{0.45}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%																%
%		semtex -- for documents stripped of SemanTeX markup		%
%		https://ctan.org/pkg/semantex							%
%		(C) 2020 Sebastian Ørsted								%
%       sorsted@gmail.com										%
%																%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Bullets:

\cs_new_protected:Npn\semantex_set_mathsurround_to_zero:
{
	 % This is equivalent to "\m@th"
	\dim_set:Nn \mathsurround { 0pt }
}

\cs_new_protected:Npn\semantex_bullet:
{
	\mathord{\mathpalette\__semantex_bullet_auxiliary:Nn{0.5}}
}

\box_new:N \l__semantex_bullet_box

\cs_new_protected:Npn\__semantex_bullet_auxiliary:Nn#1#2
{
	\hbox_set:Nn \l__semantex_bullet_box { $\semantex_set_mathsurround_to_zero: #1 \bullet$ }
	\box_scale:Nnn \l__semantex_bullet_box { #2 } { #2 }
	\vcenter{ \hbox:n { \box_use_drop:N \l__semantex_bullet_box } }
}

\cs_new_protected:Nn\semantex_double_bullet: {\semantex_bullet: \semantex_bullet:}

\cs_set_eq:NN\SemantexBullet \semantex_bullet:

\cs_set_eq:NN \SemantexDoubleBullet \semantex_double_bullet:

% Parentheses:

\cs_set:Npn\SemantexLeft { \mathopen{}\mathclose\bgroup\left }

\cs_set:Npn\SemantexRight { \aftergroup\egroup\right }