中文数学符号与数学音符定制
在LaTeX中,有很多中文的数学符号都是没有的,所以有必要进行特殊定制,首先我们来看一些常见的数学符号的定制,这里直接引用前人已经借助tikz
包定制过的符号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\usepackage{tikz}
%平行
\newcommand\pxx{%
\mathrel{\tikz[baseline] \draw (0em,-0.3ex) -- (.4em,1.7ex) (.2em,-0.3ex) -- (.6em,1.7ex);%
}}
%平行且等于
\newcommand*\pxqdy{%
\mathrel{\tikz[baseline]
\draw (.1em,0ex) -- (.9em,0ex)
(.1em,-.25ex) -- (.9em,-.25ex)
(.375em,.1ex) -- (.675em,1.5ex)
(.525em,.1ex) -- (.825em,1.5ex);%
}}
%新的平行且等于
\newcommand*\pxdy{%
\mathrel{\tikz[baseline]
\draw (.1em,0ex) -- (.9em,0ex)
(.1em,.3ex) -- (.9em,.3ex)
(.375em,.4ex) -- (.675em,1.8ex)
(.55em,.4ex) -- (.85em,1.8ex);}%
}
%相似
\newcommand*\xiangs{%
\mathrel{%
\tikz \draw[baseline] (-.25em,1.15ex) .. controls (-.55em,1.15ex) and (-.51em,.23ex) .. (-.275em,.23ex) .. controls (0,.23ex) and (0,1.15ex) .. (.275em,1.15ex) .. controls (.51em,1.15ex) and (.55em,.23ex) .. (.25em,.23ex);%
}}
%全等
\newcommand*\quand{%
\mathrel{%
\tikz \draw[baseline] (-.2em,1.35ex) .. controls (-.46em,1.6ex) and (-.54em,.65ex) .. (-.25em,.65ex) .. controls (-.06em,.65ex) and (.06em,1.35ex) .. (.25em,1.35ex) .. controls (.54em,1.35ex) and (.46em,.4ex) .. (.2em,.65ex) (-.46em,.4ex) -- (.46em,.4ex) (-.46em,0ex) -- (.46em,0ex);%
}}
%中文真子集
\newcommand*\zhziji{%
\mathrel{\tikz
\draw[baseline] (.6636em,1.57ex) -- (.192em,1.57ex) arc (90:270:0.4022ex) -- (.6636em,.7674ex) (0,.2558ex) -- (.6636em,.2558ex) (0,.5116ex) -- (.6636em,.5116ex) (.2323em,0ex) -- (.4313em,.7674ex);%
}%
}
%中文子集
\newcommand*\ziji{%
\mathrel{\raisebox{.15ex}{\tikz
\draw[baseline] (.6636em,1.57ex) -- (.20235em,1.57ex) arc (90:270:0.4797ex) -- (.6636em,.61ex) (0,.305ex) -- (.6636em,.305ex);%
}}%
}
%中文反向子集
\newcommand*\zijif{%
\mathrel{\raisebox{.15ex}{\tikz
\draw[baseline] (-.6636em,1.57ex) -- (-.20235em,1.57ex) arc (90:-90:0.4797ex) -- (-.6636em,.61ex) (-.6636em,.305ex) -- (0,.305ex);%
}}%
}
%中文反向真子集
\newcommand*\zhzijif{%
\mathrel{\tikz
\draw[baseline] (-.6636em,1.57ex) -- (-.192em,1.57ex) arc (90:-90:0.4022ex) -- (-.6636em,.7674ex) (0,.2558ex) -- (-.6636em,.2558ex) (0,.5116ex) -- (-.6636em,.5116ex) (-.4313em,0ex) -- (-.2323em,.7674ex);%
}%
}
%平行四边形
\newcommand*\Pxsbx[1][1]{%
\mathord{%
\tikz[baseline,scale=#1]
\draw (0,.1ex) -- (.8em,.1ex) -- (1em,1.4ex) -- (.2em,1.4ex) -- cycle;}}
\newcommand*\pxsbx{
\mathchoice{\Pxsbx}{\Pxsbx}{\Pxsbx[0.6]}{\Pxsbx[0.4]}
}
% 圆符号的重新定制
\newcommand*\Odot[1][1.1]{
\mathord{%
\tikz[baseline,scale=#1]
{\draw(0,0.32em) circle(0.35em);
\fill(0,0.32em) circle(0.7pt);}
}
}
\renewcommand*\odot{
\mathchoice{\Odot}{\Odot}{\Odot[0.7]}{\Odot[0.7]}
}
这些符号是非常常见的中文数学符号,尤其是在高中阶段用处颇多,除此之外还有很多数学的音符,我们也用tikz
绘制一些数学音符,虽然有些音符在某些字体宏包中也有定义,但是引入宏包的后果就是会改变其他数学符号的字体,当然,如果你会提取宏包中某个特定符号的定义也行,这里统一给出tikz
的方法。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\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
%%圆弧
\def\wideparen#1{\mathord{
\begin{tikzpicture}
\node[inner sep=0pt] (a) {$#1$};
\fill (a.north west)[bend left=25]to(a.north east)
[bend right=33]to(a.north west);
\end{tikzpicture}
}
}
%%带箭头的弧
\def\xwideparen#1{\mathord{
\begin{tikzpicture}
\node[inner sep=0pt] (a) {$#1$};
\fill (a.north west)[bend left=25]to(a.north east)
[bend right=33]to(a.north west);
\draw[line width=0pt,-{Stealth[width=1.8pt]}](a.north west)[bend left=29]to(a.north east);
\end{tikzpicture}
}
}
%%集合的势,顶部双横线,
\def\xbar#1{\mathord{
\begin{tikzpicture}
\node[inner sep=0pt](a){$#1$};
\draw([shift={(0.2ex,0.2ex)}]a.north west)--
([shift={(-0.2ex,0.2ex)}]a.north east);
\draw([shift={(0.2ex,0.5ex)}]a.north west)--
([shift={(-0.2ex,0.5ex)}]a.north east);
\end{tikzpicture}
}
}
%%带箭头的帽子
\def\xhat#1{\mathord{
\begin{tikzpicture}
\node[inner sep=0pt](a){$#1$};
\draw[{Stealth[width=0.4ex,length=0.5ex]}-{Stealth[width=0.4ex,length=0.5ex]}]
([shift={(0.6ex,0.2ex)}]a.north west)--++(0,1ex)--([shift={(-0.6ex,1.2ex)}]a.north east)--++(0,-1ex);
\end{tikzpicture}
}
}
\begin{document}
\[\wideparen{ABC}\xbar{A}\xwideparen{AB}\xhat{ABC}\]
\end{document}
用类似的方法,大家也可以自定义出许多自己所需要的符号,这里就不再赘述。