我可以通过使用以下aligned
环境来实现这一点:
\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}
当然,这很好,但我现在想知道是否有更好的方法来呈现这些信息。我愿意接受任何建议。
答案1
不知道它应该演示什么,它似乎是正确的,但由于代码的原因,左手leq
没有正确的间距。所以我提出了这个代码,它也是基于以下代码简化的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}
答案2
那么如何在图表上显示你的数据呢?
这是通过元帖子包裹在内luamplib
,因此用 进行编译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 (a*u, b*v) -- (a*u, c*v);
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, G*v) withcolor 7/8;
label(decimal G, (-10, G*v));
endfor
for g=40 step 40 until 280:
draw yy shifted (g*u, 0) withcolor 7/8;
label(decimal g, (g*u, -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}