Forgot password?
 Create new account
View 559|Reply 3

中文环境测试

[Copy link]

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2017-5-15 17:17:33 |Read mode
\begin{测试代码}
\documentclass{ctexart}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}

%符号重叠命令\fhcd[类型]{符号}{符号}
%类型是最终输出的符号的类型(bin, rel, ord 等,默认 bin),两符号顺序随意
\makeatletter
\newcommand\fhcd[3][bin]{
\csname math#1\endcsname{\mathchoice
{\@fhcd\displaystyle{#2}{#3}}
{\@fhcd\textstyle{#2}{#3}}
{\@fhcd\scriptstyle{#2}{#3}}
{\@fhcd\scriptscriptstyle{#2}{#3}}}}
\newcommand\@fhcd[3]{
\settowidth\@tempdima{$\m@th#1{#2}$}
\settowidth\@tempdimb{$\m@th#1{#3}$}
\ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi
\kern.5\@tempdima\mathclap{#2}\mathclap{#3}\kern.5\@tempdima}
\makeatother

\begin{document}

这样,第一个可以这样定义
\newcommand\cttdiv{\fhcd\bigtriangledown\cdot}

效果 $A\cttdiv B = A\bigtriangledown B\cdot C$
\[A\cttdiv B + \frac{\frac{A\cttdiv B}{A\cttdiv B}}{A\cttdiv B}\]

第二个直接这样定会有瑕疵
\newcommand\cttcurl{\fhcd\bigtriangledown\times}%
$A\cttcurl B$

突了点儿,只能调整下了,比如
\renewcommand\cttcurl{\fhcd\bigtriangledown
{\text{\raisebox{0.25ex}{\scalebox{0.75}{$\times$}}}}}%
$A\cttcurl B+\frac{A\cttcurl B}2$

还可以搞些其他东西

长的不等价
\let\iff\Longleftrightarrow
\newcommand\niff{\fhcd[rel]/\iff}
$A\niff B\iff C+\frac{A\niff B}{A\iff B}$

斜的不平行
\newcommand\px{\mathrel{/\mkern-5mu/}}%
\newcommand\npx{\fhcd[rel]\px\smallsetminus}%
$AB\px CD\npx EF$

无聊的
\newcommand\asdf{\fhcd[ord]\leftrightarrow\updownarrow}%
\newcommand\aaaa{\fhcd[ord]\nearrow\searrow}%
\newcommand\bbbb{\fhcd[ord]\nwarrow\swarrow}%
\newcommand\cccc{\fhcd[ord]\aaaa\bbbb}%
$\asdf \ \cccc$

\end{document}
\end{测试代码}

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

 Author| kuing Posted at 2017-5-15 17:18:50
\(\newcommand{\中文}{123}\)
$\中文$

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-7-26 02:59:55
Unknown environment '测试代码'

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2022-9-5 21:18:57
用 | 分隔的第三个是 . 也就是除了换行符、英文字母外的任意一个字符(因为英文字母会被前面的a-z匹配)
  1. $\def\`{\frac}$
  2. $\`{-b\pm\sqrt{b^2-4ac}}{2a}$
Copy the Code
空格也可以:
  1. $\def\ {\frac}$
  2. $\ {-b\pm\sqrt{b^2-4ac}}{2a}$
Copy the Code

手机版Mobile version|Leisure Math Forum

2025-4-20 22:09 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list