首先一个MWS,其输出如下。
\documentclass{article}
\linespread{2}
\usepackage{amsmath,amsfonts,amssymb,graphicx}
\usepackage{trimclip}
\newlength{\weq}
\makeatletter
\newcommand{\varsubset}{\mathrel{\mathpalette\var@subset\relax}}
\newcommand{\var@subset}[2]{\settowidth{\weq}{$\m@th#1\subset$}%
\clipbox{0pt 0pt {0.525\weq} 0pt}{$\m@th#1\subset$}%
\clipbox{{0.725\weq} 0pt 0pt 0pt}{$\m@th#1\subset$}%
}
\newcommand{\schroderimply}{\mathop{=}\kern-0.725em\mathop{\varsubset}}%Shroder imply
\makeatother
\begin{document}
normal size: {\normalsize $x\schroderimply y$}
footnote size: {\footnotesize $x\schroderimply y$
huge size: {\huge $x\schroderimply y$}
\end{document}
可以看到,符号在正常尺寸和脚注尺寸下表现良好,但在超大尺寸下表现不佳。那么有没有什么方法可以改进代码,让符号在所有尺寸下都能表现良好呢?
答案1
您希望右对齐\varsubset
,=
这可以通过移除右侧的边距来实现。但是,如果\varsubset
单独使用 ,效果并不好,因此我引入了一个条件。
\documentclass{article}
\usepackage{amsmath,amssymb,graphicx}
\usepackage{trimclip}
\makeatletter
\newif\if@schroder
\newcommand{\varsubset}{\mathrel{\@schroderfalse\mathpalette\var@subset\relax}}
\newcommand{\var@subset}[2]{%
\clipbox{0pt 0pt {0.525\width} 0pt}{$\m@th#1\subset$}%
\clipbox{{0.725\noexpand\width} 0pt 0pt 0pt}{$\m@th#1\subset$}%
\if@schroder\settowidth{\dimen@}{$\m@th#1\subset$}\kern-0.05\dimen@\fi
}
\newcommand{\schroderimply}{\mathrel{\mathpalette\schroder@imply\relax}}
\newcommand{\schroder@imply}[2]{%
\vphantom{\subset}%
\ooalign{\hidewidth$\@schrodertrue\var@subset{#1}{}$\cr$\m@th#1=$\cr}%
}
\makeatother
\begin{document}
normal size: {\normalsize $x\schroderimply y_{\schroderimply}$}
footnote size: {\footnotesize $x\schroderimply y_{\schroderimply}$}
huge size: {\huge $x\schroderimply y_{\schroderimply}$}
{\fboxsep=0pt\fbox{$\schroderimply$}}
\end{document}