我怎样才能得到一个符号,通过将一个字符放在另一个表面上,在 LaTeX 中?

问题描述

我需要在我的文档中输入

enter image description here

,但我找不到正确的方法。看起来它是通过以某种方式组合 $\Diamond$$\Box$ 而成的。那么我怎样才能得到它?

解决方法

如果您在某处找不到可用的符号,我认为使用 tikz 将是一个简单的解决方案。小 tikz 图片可以内联或定义为命令。该符号可以创建为重叠节点的内容、节点形状或手工制作的 tikz 路径。以下代码显示了一些示例:

\documentclass{article}%
\usepackage{tikz}%
\usepackage{amssymb}
\usetikzlibrary{shapes,math}

\newcommand{\myawesomesymbol}[1]{\tikz[baseline=-1mm]{\node[diamond,draw,inner sep=#1]{}; \node[draw,inner sep=#1]{};}}
\newcommand{\mythicksymbol}[1]{\tikz[baseline=-1mm]{\node[thick,diamond,inner sep=#1]{}; \node[thick,inner sep=#1]{};}}

\newcommand{\myhandmadesymbol}[1]{\tikz[baseline=-1mm]{ 
\draw[] (-#1,-#1) -- (#1,#1) -- (-#1,-#1); 
\draw[] (-2.1*#1,0) -- (0,2.1*#1) -- (2.1*#1,-2.1*#1)-- (-2.1*#1,0);}}

\begin{document}
This is some sentence with this symbol \tikz[baseline=-1mm]{\node[diamond,draw]{}; \node[draw]{};} in the text. 
This one \myawesomesymbol{.7mm} is smaller and as a command and there is a larger one: \myawesomesymbol{3mm},or scaling with the font size: {\tiny tiny  \myawesomesymbol{.5ex}},{\small small \myawesomesymbol{.5ex}},Large {\Large \myawesomesymbol{.5ex}}. 
Maybe thick: \mythicksymbol{1.5mm}. 
Using tikz,it is also possible to overlay math symbols as suggested in the question: \tikz[baseline=-1mm]{\node[]{\Huge$\diamond$}; \node[]{\tiny$\Box$};},however,the spacing is not perfect. 
And last,in case the little overlapping corners are a concern,it is still possible drawing it by hand: small \myhandmadesymbol{.1},larger \myhandmadesymbol{.2},scaling with font \myhandmadesymbol{.5ex}.
\end{document}

输出:

enter image description here