3

I want to present the following information in some way: enter image description here

I can achieve this by using an aligned environment as follows:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{aligned}
g(2) &= 4       &\qquad             &G(2) = 4       \\
g(3) &= 9       &\qquad     4 \leq  &G(3) \leq 7    \\
g(4) &= 19      &\qquad             &G(4) = 16      \\
g(5) &= 37      &\qquad     6 \leq  &G(5) \leq 17   \\
g(6) &= 73      &\qquad     9 \leq  &G(6) \leq 24   \\
g(7) &= 143     &\qquad     8 \leq  &G(7) \leq 33   \\
g(8) &= 279     &\qquad    32 \leq  &G(8) \leq 42
\end{aligned}
\]
\end{document}

This works fine, of course, but I am now wondering if there might be some better way of presenting this information. I am open to any and all suggestions.

the_fox
  • 547

2 Answers2

7

What about showing your data on a chart?

enter image description here

This is done with Metapost wrapped up in luamplib, so compile with lualatex.

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
numeric u, v;
u = 2;
v = 8;

vardef showit(expr n, a, b, c) = interim ahangle := 180; drawdblarrow (au, bv) -- (au, cv); z[n] = (a * u, (b+c) * 1/2 v); fill fullcircle scaled 10 shifted z[n] withcolor 7/8[blue, white]; draw fullcircle scaled 10 shifted z[n]; label(decimal n, z[n]); enddef;

path xx, yy; xx = 8 left -- 290u * right; yy = 8 down -- 44v * up;

beginfig(1);

for G=8 step 8 until 40: draw xx shifted (0, Gv) withcolor 7/8; label(decimal G, (-10, Gv)); endfor for g=40 step 40 until 280: draw yy shifted (gu, 0) withcolor 7/8; label(decimal g, (gu, -10)); endfor

showit(2, 4, 4, 4); showit(3, 9, 4, 7); showit(4, 19, 16, 16); showit(5, 37, 6, 17); showit(6, 73, 9, 24); showit(7, 143, 8, 33); showit(8, 279, 32, 42);

drawarrow xx; label.rt("$g$", point 1 of xx); drawarrow yy; label.top("$G$", point 1 of yy);

endfig; \end{mplibcode} \end{document}

Thruston
  • 42,268
6

Not knowing what it is supposed to demonstrate, it seems correct, except the left hand leq doesn't have a correct spacing, due to the code. So I propose this code, which is also simplified, based on alignat*:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat}{2} g(2) &= 4 & G(2) &= 4 \ g(3) &= 9 & 4 \leq G(3) &\leq 7 \ g(4) &= 19 & G(4) &= 16 \ g(5) &= 37 & 6 \leq G(5) &\leq 17 \ g(6) &= 73 &\ 9 \leq G(6) &\leq 24 \ g(7) &= 143 & 8 \leq G(7) &\leq 33 \ g(8) &= 279 & \hspace{3em}32 \leq G(8) &\leq 42 \end{alignat}

\end{document}

enter image description here

Bernard
  • 271,350