繁體
|
簡體
Sclub交友聊天~加入聊天室當版主
(檢舉)
分享
新浪微博
QQ空间
人人网
腾讯微博
Facebook
Google+
Plurk
Twitter
Line
标题:
两个符号重叠
[打印本页]
作者:
kuing
时间:
2017-6-12 02:35
标题:
两个符号重叠
转自:
http://bbs.ctex.org/forum.php?mod=viewthread&tid=153333
一个月前弄的,差点忘了存档。
要弄
2022-4-6 13:41
2022-4-6 13:41
这样的符号
试着写了一个有通用性的重叠命令,缺陷及副作用尚未明确 :D
\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}
复制代码
2022-4-6 13:45
图片附件:
wdoRd8h.png
(2022-4-6 13:41, 371 Bytes) / 下载次数 192
http://kuing.orzweb.net/attachment.php?aid=11363&k=1ae5628fef763126f4d5093c86760bf0&t=1711716209&sid=Vp8cog
图片附件:
2qNHhl2.png
(2022-4-6 13:41, 418 Bytes) / 下载次数 189
http://kuing.orzweb.net/attachment.php?aid=11364&k=7358eb637c831a93928813548abaae2b&t=1711716209&sid=Vp8cog
图片附件:
捕获.PNG
(2022-4-6 13:45, 57.19 KB) / 下载次数 198
http://kuing.orzweb.net/attachment.php?aid=11365&k=af73a779274e4ae274b8d9be4e2db886&t=1711716209&sid=Vp8cog
作者:
kuing
时间:
2017-8-24 19:17
https://liam0205.me/2017/06/30/c ... symbols-by-ooalign/
(使用 \ooalign 命令创建叠加在一起的记号)
这个帖讲的看起来更高大上一些,暂时还没完全理解……那个什么 \hidewidth ……还有后面那些……有空再研究下
作者:
kuing
时间:
2018-10-6 08:37
回复
2#
kuing
“\ooalign 中,每一行都复写在上一行之上”
“\hidewidth 定义是 \hskip -1000pt plus 1fill”
照这两点来理解就能解释如下结果:
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\newcommand\testoo[1]{\fbox{{%
\ooalign{%
Q\cr
#1\crcr
}}}\par}
\fboxsep=0pt
\newcommand\x{{\color{red}x}}
\newcommand\y{{\color{green}y}}
\renewcommand\o{{\color{blue}o}}
\newcommand\xx{{\color{red}xxxx}}
\newcommand\yy{{\color{green}yyyyyy}}
\newcommand\oo{{\color{blue}ooo}}
\testoo{}
\testoo{\x\hidewidth}
\testoo{\hidewidth\y}
\testoo{\hidewidth\o\hidewidth}
\testoo{\xx\hidewidth}
\testoo{\hidewidth\yy}
\testoo{\hidewidth\oo\hidewidth}
\testoo{\xx\hidewidth\yy}
\testoo{\xx\hidewidth\oo\hidewidth}
\testoo{\hidewidth\oo\hidewidth\yy}
\testoo{\xx\hidewidth\oo\hidewidth\yy}
\end{document}
复制代码
2018-10-6 09:47
除此之外,如果注意一下细节——深度,似乎 ooalign 的最终深度似乎只取决于最后一行,进而猜测:高度只取决于第一行?测试了一下似乎确实如此:
\fbox{{\ooalign{k\cr q\crcr}}} \fbox{{\ooalign{q\cr k\crcr}}}
复制代码
得出:
2018-10-6 09:59
这样看的话,ooalign 的方法还是存在缺陷嘀……
比如说文中用 {\ooalign{\$\bigcup\$\cr\hidewidth\$\bullet\$\hidewidth\cr}} 构造的 `\bigcup` 与 `\bullet` 重叠的符号,用 \fbox 来框一下就很清楚了:
\fbox{$\bullet$}
\fbox{$\bigcup$}
\fbox{{\ooalign{$\bigcup$\cr\hidewidth$\bullet$\hidewidth\cr}}}
复制代码
2018-10-6 10:15
原因就是后者深度由 \bullet 决定。
虽然多数时候没什么影响,但如果处于某些特殊情况下(例如繁分式),垂直间距或许就会有问题(贴得太近)。
图片附件:
oo.png
(2018-10-6 09:47, 33.36 KB) / 下载次数 400
http://kuing.orzweb.net/attachment.php?aid=6668&k=517dd68beb76070b2e60edcb96d5e1dc&t=1711716209&sid=Vp8cog
图片附件:
QQ截图20181006095945.png
(2018-10-6 09:59, 1.91 KB) / 下载次数 409
http://kuing.orzweb.net/attachment.php?aid=6670&k=7bfc68d35161ff13fe6d4259e50f2d89&t=1711716209&sid=Vp8cog
图片附件:
QQ截图20181006101527.png
(2018-10-6 10:15, 2.04 KB) / 下载次数 412
http://kuing.orzweb.net/attachment.php?aid=6672&k=851c4bd7ec8629dd31be784b52c6964b&t=1711716209&sid=Vp8cog
欢迎光临 悠闲数学娱乐论坛(第2版) (http://kuing.orzweb.net/)
Powered by Discuz! 7.2