元素符号的普遍错位

元素符号的普遍错位

我最近注意到 latex 中的元素符号放错了位置,不仅与\mathbb{R}我的示例中的元素符号组合不正确,而且与任何其他符号组合也不正确。无论在哪种数学模式下使用它都没有关系。我问了我的一个朋友,他也观察到了同样的情况,所以这似乎与 PDF 查看器、编译器、操作系统等无关。

我花了一些时间在网上搜索,但没有找到有关该行为的任何信息,这确实令人非常困惑,因为人们对于使用\coloneqq而不是非常挑剔,:=但他们并不介意经常使用的元素符号明显放错位置。

如果有任何现成的解决方法,我很乐意知道。如果存在我没有发现的现有问题,我请求道歉。

梅威瑟:

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\selectlanguage{ngerman}

\usepackage{amsmath, amsfonts, amssymb, mathtools}

\begin{document}
$1+1+1+1 \in \mathbb{R}$, $\underbrace{1+1+1+1}_{\in \mathbb{R}}$
\end{document}

在此处输入图片描述

答案1

这是 的通常形状\in。有些字体的形状较小,但您始终会看到中间的直线与分数线处于同一高度。

如果符号延伸到基线以下,您可以通过稍微缩放来更改符号。(老实说,我不会这么做。)

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}% <--- This is important for German
\usepackage[ngerman]{babel}
\usepackage{amsmath, amssymb, mathtools}

\makeatletter
\let\standard@in\in
\DeclareRobustCommand{\in}{\mathrel{\mathpalette\scaled@in\relax}}
\newcommand{\scaled@in}[2]{%
  \sbox\z@{$\m@th#1\standard@in$}%
  \ifdim\dp\z@>\z@
    \raisebox{\depth}{\resizebox{!}{\dimexpr\ht\z@-\dp\z@}{\copy\z@}}%
  \else
    \box\z@
  \fi
}
\makeatother

\begin{document}

$1+1+1+1 \in \mathbb{R}$, $\underbrace{1+1+1+1}_{\in \mathbb{R}}$

\end{document}

在此处输入图片描述

我离开时也作为一种锻炼而改变\notin

请注意,现在无需使用inputenc来加载。相反,对于德语,确实需要使用 选项来加载。utf8fontencT1

答案2

这归结于数学字体中 ∈ 字形的度量。这只是传统的绘制方式。但这里有一个模板可以将其升高(升高量为字形 0 和 ∈ 高度差的一半)。使用不同的数学字体进行尝试。

\tracinglostchars=2
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{newpxmath}
\usepackage{settobox}

\newlength\inheight
\newlength\textstyleraisein
\newlength\displaystyleraisein
\newlength\scriptstyleraisein
\newlength\sscriptstyleraisein

\newsavebox\inbox
\newsavebox\zerobox

\savebox{\inbox}{\( \textstyle\in \)}
\savebox{\zerobox}{\( \textstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\textstyleraisein}{\zerobox}
\addtolength{\textstyleraisein}{-\inheight}
\setlength{\textstyleraisein}{0.5\textstyleraisein}
\savebox{\inbox}{\( \displaystyle\in \)}
\savebox{\zerobox}{\( \displaystyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\displaystyleraisein}{\zerobox}
\addtolength{\displaystyleraisein}{-\inheight}
\setlength{\displaystyleraisein}{0.5\displaystyleraisein}
\savebox{\inbox}{\( \scriptstyle\in \)}
\savebox{\zerobox}{\( \scriptstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\scriptstyleraisein}{\zerobox}
\addtolength{\scriptstyleraisein}{-\inheight}
\setlength{\scriptstyleraisein}{0.5\scriptstyleraisein}
\savebox{\inbox}{\( \scriptscriptstyle\in \)}
\savebox{\zerobox}{\( \scriptscriptstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\sscriptstyleraisein}{\zerobox}
\addtolength{\sscriptstyleraisein}{-\inheight}
\setlength{\sscriptstyleraisein}{0.5\sscriptstyleraisein}
\newcommand\isin{\mathrel{\mathchoice%
{\raisebox{\displaystyleraisein}{\(\displaystyle\in\)}}%
{\raisebox{\textstyleraisein}{\(\textstyle\in\)}}%
{\raisebox{\scriptstyleraisein}{\(\scriptstyle\in\)}}%
{\raisebox{\sscriptstyleraisein}{\(\scriptscriptstyle\in\)}}%
}}

\begin{document}
\begin{minipage}{10cm}
\( 0 \isin \mathbb{R}_{\isin \mathbb{R}_{\isin \mathbb{R}}} \)
\[
\underbrace{{\lambda a^i - c_i}}_{\isin \mathbb{R} \setminus \mathbb{R}^+_0} 
\underbrace{x_i}_{\isin \mathbb{R}} = 0 \isin \mathbb{R}
\]
\end{minipage}
\end{document}

Newpxmath 字体示例

fourier代替newpxmath

Fourier 字体示例

包机选项如下mathdesign

宪章/数学设计样本

根据要求,下面是一个将其与加号并排放置的示例。如您所见,默认(左侧)\in+大多数字体(包括)对齐stix。在右侧,我展示了凸起的样子。

\tracinglostchars=2
\documentclass{article}
\usepackage{amsmath, stix}
\usepackage{settobox}

%% Formatting for a MWE on TeX.SX:
\usepackage[paperwidth=10cm]{geometry}
\pagestyle{empty}

\newlength\inheight
\newlength\textstyleraisein
\newlength\displaystyleraisein
\newlength\scriptstyleraisein
\newlength\sscriptstyleraisein

\newsavebox\inbox
\newsavebox\zerobox

\savebox{\inbox}{\( \textstyle\in \)}
\savebox{\zerobox}{\( \textstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\textstyleraisein}{\zerobox}
\addtolength{\textstyleraisein}{-\inheight}
\setlength{\textstyleraisein}{0.5\textstyleraisein}
\savebox{\inbox}{\( \displaystyle\in \)}
\savebox{\zerobox}{\( \displaystyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\displaystyleraisein}{\zerobox}
\addtolength{\displaystyleraisein}{-\inheight}
\setlength{\displaystyleraisein}{0.5\displaystyleraisein}
\savebox{\inbox}{\( \scriptstyle\in \)}
\savebox{\zerobox}{\( \scriptstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\scriptstyleraisein}{\zerobox}
\addtolength{\scriptstyleraisein}{-\inheight}
\setlength{\scriptstyleraisein}{0.5\scriptstyleraisein}
\savebox{\inbox}{\( \scriptscriptstyle\in \)}
\savebox{\zerobox}{\( \scriptscriptstyle 0 \)}
\settoboxheight{\inheight}{\inbox}
\settoboxheight{\sscriptstyleraisein}{\zerobox}
\addtolength{\sscriptstyleraisein}{-\inheight}
\setlength{\sscriptstyleraisein}{0.5\sscriptstyleraisein}
\newcommand\isin{\mathrel{\mathchoice%
{\raisebox{\displaystyleraisein}{\(\displaystyle\in\)}}%
{\raisebox{\textstyleraisein}{\(\textstyle\in\)}}%
{\raisebox{\scriptstyleraisein}{\(\scriptstyle\in\)}}%
{\raisebox{\sscriptstyleraisein}{\(\scriptscriptstyle\in\)}}%
}}

\begin{document}
\[ 1+1+1+1 \in \mathbb{R} \qquad 1+1+1+1 \isin \mathbb{R} \]
\end{document}

STIX 字体示例

相关内容