latex - 如何在 LaTeX 中获得通过将一个字符放在另一个表面上而产生的符号?
解决方案
如果您在某处找不到可用的符号,我认为使用 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, draw, inner sep=#1]{}; \node[thick, draw, inner sep=#1]{};}}
\newcommand{\myhandmadesymbol}[1]{\tikz[baseline=-1mm]{
\draw[] (-#1,-#1) -- (#1,-#1) -- (#1,#1) -- (-#1,#1) -- (-#1,-#1);
\draw[] (-2.1*#1, 0) -- (0,2.1*#1) -- (2.1*#1,0) -- (0, -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}
输出:
推荐阅读
- html - angular - 加载组件时动画效果失败
- regex - 使用 PowerShell 和正则表达式解析文本
- flutter - Google 在 SingleChildScrollView 中的表单内映射
- multithreading - 用于运行脚本和更新 GUI 的 TCL 线程
- javascript - 我想创建测验
- django - 无效的 Geojson 对象 Django 传单 [django]
- c# - 用于填充包含每项 BindingList 数据的 DataGridView 的语法
- git - 如何在 azure 存储库中不区分大小写 git diff?
- python - Python:使用 SQL 从表中检索列作为字典
- openstreetmap - 如何在开放的街道地图上添加标记而不提及经纬度