如何在数学模式下调整或抑制字母间距

如何在数学模式下调整或抑制字母间距

换句话说,如何实现将整个等式包装起来的效果\mathit,但不使用斜体数字?

更一般地说,如何改变数学模式下连续字母之间添加的空格量?

我在网站上发现了很多关于删除运算符周围空格的问题,但没有关于字母间距的问题。以下是我想要的:

在此处输入图片描述

答案1

不确定你的 TeX 代码有多丰富,无论如何希望以下样本代码能够有所帮助:

\documentclass{article}

\usepackage{amssymb}
\usepackage{txfonts}

\DeclareSymbolFont{mymathvariables}{OT1}{txr}{m}{it}

\DeclareMathSymbol{a}{\mathalpha}{mymathvariables}{`a}
\DeclareMathSymbol{b}{\mathalpha}{mymathvariables}{`b}
\DeclareMathSymbol{c}{\mathalpha}{mymathvariables}{`c}
\DeclareMathSymbol{d}{\mathalpha}{mymathvariables}{`d}
\DeclareMathSymbol{e}{\mathalpha}{mymathvariables}{`e}
\DeclareMathSymbol{f}{\mathalpha}{mymathvariables}{`f}
\DeclareMathSymbol{g}{\mathalpha}{mymathvariables}{`g}
\DeclareMathSymbol{h}{\mathalpha}{mymathvariables}{`h}
\DeclareMathSymbol{i}{\mathalpha}{mymathvariables}{`i}
\DeclareMathSymbol{j}{\mathalpha}{mymathvariables}{`j}
\DeclareMathSymbol{k}{\mathalpha}{mymathvariables}{`k}
\DeclareMathSymbol{l}{\mathalpha}{mymathvariables}{`l}
\DeclareMathSymbol{m}{\mathalpha}{mymathvariables}{`m}
\DeclareMathSymbol{n}{\mathalpha}{mymathvariables}{`n}
\DeclareMathSymbol{o}{\mathalpha}{mymathvariables}{`o}
\DeclareMathSymbol{p}{\mathalpha}{mymathvariables}{`p}
\DeclareMathSymbol{q}{\mathalpha}{mymathvariables}{`q}
\DeclareMathSymbol{r}{\mathalpha}{mymathvariables}{`r}
\DeclareMathSymbol{s}{\mathalpha}{mymathvariables}{`s}
\DeclareMathSymbol{t}{\mathalpha}{mymathvariables}{`t}
\DeclareMathSymbol{u}{\mathalpha}{mymathvariables}{`u}
\DeclareMathSymbol{v}{\mathalpha}{mymathvariables}{`v}
\DeclareMathSymbol{w}{\mathalpha}{mymathvariables}{`w}
\DeclareMathSymbol{x}{\mathalpha}{mymathvariables}{`x}
\DeclareMathSymbol{y}{\mathalpha}{mymathvariables}{`y}
\DeclareMathSymbol{z}{\mathalpha}{mymathvariables}{`z}

\DeclareMathSymbol{A}{\mathalpha}{mymathvariables}{`A}
\DeclareMathSymbol{B}{\mathalpha}{mymathvariables}{`B}
\DeclareMathSymbol{C}{\mathalpha}{mymathvariables}{`C}
\DeclareMathSymbol{D}{\mathalpha}{mymathvariables}{`D}
\DeclareMathSymbol{E}{\mathalpha}{mymathvariables}{`E}
\DeclareMathSymbol{F}{\mathalpha}{mymathvariables}{`F}
\DeclareMathSymbol{G}{\mathalpha}{mymathvariables}{`G}
\DeclareMathSymbol{H}{\mathalpha}{mymathvariables}{`H}
\DeclareMathSymbol{I}{\mathalpha}{mymathvariables}{`I}
\DeclareMathSymbol{J}{\mathalpha}{mymathvariables}{`J}
\DeclareMathSymbol{K}{\mathalpha}{mymathvariables}{`K}
\DeclareMathSymbol{L}{\mathalpha}{mymathvariables}{`L}
\DeclareMathSymbol{M}{\mathalpha}{mymathvariables}{`M}
\DeclareMathSymbol{N}{\mathalpha}{mymathvariables}{`N}
\DeclareMathSymbol{O}{\mathalpha}{mymathvariables}{`O}
\DeclareMathSymbol{P}{\mathalpha}{mymathvariables}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{mymathvariables}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{mymathvariables}{`R}
\DeclareMathSymbol{S}{\mathalpha}{mymathvariables}{`S}
\DeclareMathSymbol{T}{\mathalpha}{mymathvariables}{`T}
\DeclareMathSymbol{U}{\mathalpha}{mymathvariables}{`U}
\DeclareMathSymbol{V}{\mathalpha}{mymathvariables}{`V}
\DeclareMathSymbol{W}{\mathalpha}{mymathvariables}{`W}
\DeclareMathSymbol{X}{\mathalpha}{mymathvariables}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{mymathvariables}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{mymathvariables}{`Z}

%\DeclareSymbolFont{mymathnumerals}{T1}{ybv}{m}{n}
%\SetSymbolFont{mymathnumerals}{normal}{T1}{ybv}{m}{n}
%\DeclareSymbolFontAlphabet{\mathnormal}{mymathnumerals}

\begin{document}

$qpdb_0+1$

$\mathit{qpdb_0+1} \lambda$

\end{document}

笔记:这里我使用了 txfont 来显示变化,您可以在代码中相应地替换{<encoding>}和。{<family>}\DeclareSymbolFont

有用的链接:

答案2

由于您似乎正在使用一些类似 Times 的字体,这里有一个示例:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}
\usepackage{microtype}

\begin{document}

$math$ $is$ $difficult$ $qpdb_0+1$

{\boldmath$math$ $is$ $difficult$}

\end{document}

这输出

在此处输入图片描述

现在将其转换为

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}
\usepackage{microtype}

\DisableLigatures{encoding=OT1,family=ntxtlf}

\DeclareSymbolFont{unspacedletters}{OT1}{ntxtlf}{m}{it}
\SetSymbolFont{unspacedletters}{bold}{OT1}{ntxtlf}{b}{it}
\DeclareMathSymbol{A}{\mathalpha}{unspacedletters}{`A}
\DeclareMathSymbol{B}{\mathalpha}{unspacedletters}{`B}
\DeclareMathSymbol{C}{\mathalpha}{unspacedletters}{`C}
\DeclareMathSymbol{D}{\mathalpha}{unspacedletters}{`D}
\DeclareMathSymbol{E}{\mathalpha}{unspacedletters}{`E}
\DeclareMathSymbol{F}{\mathalpha}{unspacedletters}{`F}
\DeclareMathSymbol{G}{\mathalpha}{unspacedletters}{`G}
\DeclareMathSymbol{H}{\mathalpha}{unspacedletters}{`H}
\DeclareMathSymbol{I}{\mathalpha}{unspacedletters}{`I}
\DeclareMathSymbol{J}{\mathalpha}{unspacedletters}{`J}
\DeclareMathSymbol{K}{\mathalpha}{unspacedletters}{`K}
\DeclareMathSymbol{L}{\mathalpha}{unspacedletters}{`L}
\DeclareMathSymbol{M}{\mathalpha}{unspacedletters}{`M}
\DeclareMathSymbol{N}{\mathalpha}{unspacedletters}{`N}
\DeclareMathSymbol{O}{\mathalpha}{unspacedletters}{`O}
\DeclareMathSymbol{P}{\mathalpha}{unspacedletters}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{unspacedletters}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{unspacedletters}{`R}
\DeclareMathSymbol{S}{\mathalpha}{unspacedletters}{`S}
\DeclareMathSymbol{T}{\mathalpha}{unspacedletters}{`T}
\DeclareMathSymbol{U}{\mathalpha}{unspacedletters}{`U}
\DeclareMathSymbol{V}{\mathalpha}{unspacedletters}{`V}
\DeclareMathSymbol{W}{\mathalpha}{unspacedletters}{`W}
\DeclareMathSymbol{X}{\mathalpha}{unspacedletters}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{unspacedletters}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{unspacedletters}{`Z}
\DeclareMathSymbol{a}{\mathalpha}{unspacedletters}{`a}
\DeclareMathSymbol{b}{\mathalpha}{unspacedletters}{`b}
\DeclareMathSymbol{c}{\mathalpha}{unspacedletters}{`c}
\DeclareMathSymbol{d}{\mathalpha}{unspacedletters}{`d}
\DeclareMathSymbol{e}{\mathalpha}{unspacedletters}{`e}
\DeclareMathSymbol{f}{\mathalpha}{unspacedletters}{`f}
\DeclareMathSymbol{g}{\mathalpha}{unspacedletters}{`g}
\DeclareMathSymbol{h}{\mathalpha}{unspacedletters}{`h}
\DeclareMathSymbol{i}{\mathalpha}{unspacedletters}{`i}
\DeclareMathSymbol{j}{\mathalpha}{unspacedletters}{`j}
\DeclareMathSymbol{k}{\mathalpha}{unspacedletters}{`k}
\DeclareMathSymbol{l}{\mathalpha}{unspacedletters}{`l}
\DeclareMathSymbol{m}{\mathalpha}{unspacedletters}{`m}
\DeclareMathSymbol{n}{\mathalpha}{unspacedletters}{`n}
\DeclareMathSymbol{o}{\mathalpha}{unspacedletters}{`o}
\DeclareMathSymbol{p}{\mathalpha}{unspacedletters}{`p}
\DeclareMathSymbol{q}{\mathalpha}{unspacedletters}{`q}
\DeclareMathSymbol{r}{\mathalpha}{unspacedletters}{`r}
\DeclareMathSymbol{s}{\mathalpha}{unspacedletters}{`s}
\DeclareMathSymbol{t}{\mathalpha}{unspacedletters}{`t}
\DeclareMathSymbol{u}{\mathalpha}{unspacedletters}{`u}
\DeclareMathSymbol{v}{\mathalpha}{unspacedletters}{`v}
\DeclareMathSymbol{w}{\mathalpha}{unspacedletters}{`w}
\DeclareMathSymbol{x}{\mathalpha}{unspacedletters}{`x}
\DeclareMathSymbol{y}{\mathalpha}{unspacedletters}{`y}
\DeclareMathSymbol{z}{\mathalpha}{unspacedletters}{`z}

\begin{document}

$math$ $is$ $difficult$ $qpdb_0+1$

{\boldmath$math$ $is$ $difficult$}

\end{document}

你会得到

在此处输入图片描述

连字必须被禁用;将 T1 作为正常字体编码并使用 OT1 作为数学字母会更容易。

两个 f 只是似乎形成连字符。

相关内容