3

I'm trying to recreate something like this:

fractions

However, using basic alignment, I can't recreate this. How would I go about recreating that image (ignoring font)?

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – CarLaTeX
    Commented Dec 14, 2017 at 4:26

4 Answers 4

8

One option is to stack the fractions (here the <item>) above the letters (here the <anchor>) using \stackon[<stacklength>]{<anchor>}{<item>} from the stackengine package.

(Improvements to code thanks to comments by @Steven B. Segletes)

As an example:

\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}

gives

stack

3
  • 3
    @Sam If you like Troy's answer and it was helpful, please consider marking it as the accepted answer (by clicking on the checkmark ✓).
    – CarLaTeX
    Commented Dec 14, 2017 at 4:58
  • 1
    Great answer ;^), but a slight quibble. The default stack type is short (S), so using \Lstackgap is not really the appropriate measure to use. Rather, you could state something like \setstackgap{S}{14pt} prior to the initial \stackon and then omit the optional arguments altogether. As a further upgrade, consider using the tabstackengine package, and you could set the whole array with a single \tabbedstackon! Commented Dec 14, 2017 at 11:15
  • @StevenB.Segletes Thank you for your comments! tabstackengine sounds interesting, I'll have to take a look at it later! :)
    – Troy
    Commented Dec 14, 2017 at 11:59
14

I have just learned LaTeX, but I think for your question, you can use the tabular environment to do it. Here is my example for it.

\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}

And it looks like this,

enter image description here

So the idea is to align with tabular, with invisible vertical and horizontal lines.

Details of the tabular environment can be referred from page 43 of The Not So Short Introduction to LaTex 2e.

Hope this helps!

Sen

2
  • 2
    You could abbreviate the column definition, see here: tex.stackexchange.com/a/233603/101651
    – CarLaTeX
    Commented Dec 14, 2017 at 4:49
  • 2
    @Sen offtopic, two things that I would have liked to learn earlier regarding tables: The siunitx package provides a S column specifier to align numbers, see sections 4.6 and 5.14, especially the table-format key on page 47f. The booktabs documentation summarizes how to design formal tables: "(1) Never, ever use vertical rules. (2) Never use double rules. [...]".
    – jakun
    Commented Dec 14, 2017 at 8:09
11

A simple array is enough. I didn't write all the fractions because, since you didn't provide a minimal working example (MWE), it is a bit boring. I let the completion to you.

\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}

enter image description here

3

For example, you can try something like this:

\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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .