當我在這裡輸入“~2.1”時,~和2.1之間的距離是完美的(即正是我想要的)。在LaTeX中如何實現呢?
對於$\sim\,2.1$
,它們之間的距離太大。
答案1
\sim
行為類似於關係,因此被 a 包圍\thickmuskip
,類似於您在 周圍發現的內容=
:
$a \sim b$
$a = b$
如果新增\showoutput
到文件中,您會發現以下位置插入了空格.log
:
....\mathon <- $
....\OML/cmm/m/it/10 a <- a
....\glue(\thickmuskip) 2.77771 plus 2.77771 <- \thickmuskip
....\OMS/cmsy/m/n/10 ^^X <- \sim
....\penalty 500 <- ...penalty to limit line breaks
....\glue(\thickmuskip) 2.77771 plus 2.77771 <- \thickmuskip
....\OML/cmm/m/it/10 b <- b
....\mathoff <- $
----------------------------------------
....\mathon <- $
....\OML/cmm/m/it/10 a <- a
....\glue(\thickmuskip) 2.77771 plus 2.77771 <- \thickmuskip
....\OT1/cmr/m/n/10 = <- =
....\penalty 500 <- ...penalty to avoid line breaks
....\glue(\thickmuskip) 2.77771 plus 2.77771 <- \thickmuskip
....\OML/cmm/m/it/10 b <- b
....\mathoff <- $
您可以使用或變更要設定為二進位數學元素的\sim
設置,然後rel
ord
{\sim}
\mathord{\sim}
新增間距以滿足您的需求。
\documentclass{article}
\begin{document}
\begin{tabular}{ l l }
\verb|\sim 2.1|: &
$\sim 2.1$ \\
\verb|\sim \, 2.1|: &
$\sim \, 2.1$ \\
\verb|{\sim} 2.1|: &
${\sim} 2.1$ \\
\verb|\mathord{\sim} 2.1|: &
$\mathord{\sim} 2.1$ \\
\verb|{\sim} \, 2.1|: &
${\sim} \, 2.1$ \\
\verb|\mathord{\sim} \, 2.1|: &
$\mathord{\sim} \, 2.1$
\end{tabular}
\end{document}