如何对齐分数下的字母?

如何对齐分数下的字母?

我正在尝试重新创建这样的事情:

分数

但是,使用基本对齐方式,我无法重现这种情况。我该如何重现该图像(忽略字体)?

答案1

一个选项是将分数(此处为<item>)堆叠在字母(此处为<anchor>\stackon[<stacklength>]{<anchor>}{<item>}上方,使用stackengine包裹。

(感谢@Steven B. Segletes 的评论,代码有所改进)

举个例子:

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\setstackgap{S}{14pt}
\begin{document}
    \stackon{A}{$\dfrac{17}{19}$}
    \stackon{B}{$\dfrac{78}{85}$}
    \stackon{C}{$\dfrac{19}{51}$}
    \stackon{D}{$\dfrac{23}{38}$}
    \stackon{E}{$\dfrac{29}{33}$}
    \stackon{F}{$\dfrac{77}{29}$}
\end{document}

给出

堆

答案2

我刚刚学习了 LaTeX,但我认为对于你的问题,你可以使用表格环境来执行此操作。 这是我的示例。

\documentclass[12pt, letterpaper]{article}
\usepackage{amsmath}
\begin{document}

\begin{tabular}{c c c c c}
$\frac{17}{91}$ & $\frac{17}{91}$ & $\frac{17}{91}$ & $\frac{17}{91}$ & $\frac{17}{91}$ \\[10pt]
A & B & C & D & E \\
\end{tabular}

\end{document}

它看起来像这样,

在此处输入图片描述

因此,我们的想法是与表格对齐,并使用不可见的垂直线和水平线。

表格环境的详细信息可以参考LaTex 2e 的简短介绍

希望这可以帮助!

答案3

简单array就够了。我没有写出所有的分数,因为你没有提供最小工作示例(MWE),有点无聊。我把完成度交给你了。

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \[
    \begin{array}{*{14}{c}}
    \dfrac{17}{91} & \dfrac{78}{85} & \dfrac{19}{51} & \dfrac{23}{38} & \dfrac{29}{33} & & & & & & & & & \dfrac{55}{1} \\[10pt]
    \text{A} & \text{B} & \text{C} & \text{D} & \text{E} & \text{F} & \text{G} & \text{H} & \text{I} & \text{J} & \text{K} & \text{L} & \text{M} & \text{N} \\
    \end{array}
    \]
\end{document}

在此处输入图片描述

答案4

例如,您可以尝试这样的操作:

\def\xoy #1/#2 #3 {\vbox{\baselineskip=22pt
   \halign{\hfil$\displaystyle{##}$\hfil\cr #1\over#2\cr \rm#3\cr}}\quad}

\noindent
\xoy 17/91 A
\xoy 78/85 B
\xoy 19/51 C
\xoy 23/38 D
\xoy 29/33 E
\xoy 77/29 F
\xoy 95/23 G

\bye

相关内容