我正在做一个测试。有些问题有选择,而选择是数学表达式。我已包含前两个问题的代码;1.) 有六个选择,2.) 有八个选择。选择标记为“i.)”、“ii.)”...“viii.)”。我希望每行中的第一个右括号垂直对齐。因此,我希望 1.) 中的“i.)”和“iv.)”中的“)”与 2.) 中的“i.)”和“v.)”中的“)”对齐。
我提供的代码确实在每个问题中垂直对齐了“)”。现在我想添加一个额外的功能 - 所有行中的第一个“)”与左边距的距离相同。(我猜“4em”的距离是合适的。)
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\begin{document}
\noindent {\bf 1.)} Which of the following functions is graphed?
\begin{alignat*}{6}
{\mathrm{i.})} \ &y = (x + 5)^{2}
\qquad \quad
&{\mathrm{ii.})} \ &y = \sqrt{x + 5}
\qquad \quad
&{\mathrm{iii.})} \ &x = y^{2} + 5
\\
{\mathrm{iv.})} \ &y = \frac{\sqrt{x^{2} - 25}}{\sqrt{x - 5}}
\qquad \quad
&{\mathrm{v.})} \ &y = \frac{1}{\sqrt{x + 5}}
\qquad \quad
&{\mathrm{vi.})} \ &\vert x \vert = y^{2} + 5
\end{alignat*}
\vskip0.25in
\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
xmax=26,ymax=7,
axis lines=middle,
restrict y to domain=-3:6.5,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={fill=white},
ytick=\empty,
xtick={-5,5}
]
\addplot[domain=5:26,mark=none,samples=201] {sqrt(x + 5)};
\addplot[domain=-6:5,dashed,thin,mark=none,samples=201] {sqrt(x + 5)};
\draw [densely dashed] (5,3.16227766) -- (5,0);
\draw [fill=white] (5,3.16227766) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\hspace{\fill}
\vskip0.25in
\noindent {\bf 2.)} Which of the following products is equal to an integral power of 10?
\begin{alignat*}{8}
{\mathrm{i.})} \ &1
\qquad \quad
&{\mathrm{ii.})} \ &5^{-3}\left(\frac{1}{8}\right)
\qquad \quad
&{\mathrm{iii.})} \ &5^{-3}\left(\frac{1}{80}\right)
\qquad \quad
&{\mathrm{iv.})} \ &5^{-3}\left(\frac{1}{800}\right) \\
{\mathrm{v.})} \ &\left(\frac{4}{9}\right)^{3}15^{6}
\qquad \quad
&{\mathrm{vi.})} \ &2^{-6}25^{-3}
\qquad \quad
&{\mathrm{vii.})} \ &\left(\frac{1}{2}\right)^{6}\left(\frac{1}{25}\right)^{3}
\qquad \quad
&{\mathrm{viii.})} \ &\left(\frac{7}{4}\right)^{6}\left(\frac{1}{5^{4}49}\right)^{3}
\end{alignat*}
\vskip0.25in
\end{document}
答案1
使用该tablists
包很容易,并且语法也更加友好。
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage{tablists,enumitem,amsmath}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\begin{document}
\begin{enumerate}[label=\bfseries\arabic*.,leftmargin=*]
\item Which of the following functions is graphed?
\medskip
\begin{tabenum}[i.)]
\tabenumitem $y = (x + 5)^{2}$
\tabenumitem $y = \sqrt{x + 5}$
\tabenumitem $x = y^{2} + 5$
\\[1ex]
\tabenumitem $y = \dfrac{\sqrt{x^{2} - 25}}{\sqrt{x - 5}}$
\tabenumitem $y = \dfrac{1}{\sqrt{x + 5}}$
\tabenumitem $\lvert x \rvert = y^{2} + 5$
\end{tabenum}
\begin{center}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
xmax=26,ymax=7,
axis lines=middle,
restrict y to domain=-3:6.5,
enlargelimits={abs=1cm},
axis line style={-latex},
ticklabel style={fill=white},
ytick=\empty,
xtick={-5,5}
]
\addplot[domain=5:26,mark=none,samples=201] {sqrt(x + 5)};
\addplot[domain=-6:5,dashed,thin,mark=none,samples=201] {sqrt(x + 5)};
\draw [densely dashed] (5,3.16227766) -- (5,0);
\draw [fill=white] (5,3.16227766) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\end{center}
\item Which of the following products is equal to an integral power of $10$?
\medskip
\begin{tabenum}[i.)]
\tabenumitem $1$
\tabenumitem $5^{-3}\left(\dfrac{1}{8}\right)$
\tabenumitem $5^{-3}\left(\dfrac{1}{80}\right)$
\tabenumitem $5^{-3}\left(\dfrac{1}{800}\right)$
\\[1ex]
\tabenumitem $\left(\dfrac{4}{9}\right)^{3}15^{6}$
\tabenumitem $2^{-6}25^{-3}$
\tabenumitem $\left(\dfrac{1}{2}\right)^{6}\left(\dfrac{1}{25}\right)^{3}$
\tabenumitem $\left(\dfrac{7}{4}\right)^{6}\left(\dfrac{1}{5^{4}49}\right)^{3}$
\end{tabenum}
\end{enumerate}
\end{document}
答案2
我采取了一种tabstack
方法来解决该问题。对您的 MWE 的更改包括:
1)更换
\begin{alignat*}{8}...\end{alignat*}
和
\[ \makebox[\textwidth][l]{\kern4em\alignShortstack{...}}\]
它具有从左边距缩进对齐的 Shortstack 4em 的效果;
2)将所有替换\ &
为&\
;和
3) 在每行的第一个罗马数字标签上使用\llap
。由于“i) iv)”标签的宽度比“i) v)”标签的宽度宽,并且 OP 希望右括号在第一列以 4em 对齐,因此我不得不将第 1 列的标签全部设为零宽度,我使用 来实现这一点\llap
。
序言中采用的其他参数定义如下:
\stackMath
将使得\alignShortstack
参数在数学模式下进行处理;\setstackgap{S}{10pt}
将答案行之间的间隙设置为10pt;\setstackaligngap{3em}
更改列之间的默认水平间距(因此用于消除所有quads
和\qquads
);和\renewcommand\TAB@delim[1]{\displaystyle#1}
是一种未公开的方法,用于强制处理所有 TABstack 参数\displaystyle
。
以下是修订后的 MWE:
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.11}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\usepackage{tabstackengine}
\stackMath
\setstackgap{S}{10pt}
\setstackaligngap{3em}
\makeatletter
\renewcommand\TAB@delim[1]{\displaystyle#1}%
\makeatother
\begin{document}
\noindent {\bf 1.)} Which of the following functions is graphed?
\[ \makebox[\textwidth][l]{\kern4em\alignShortstack{
\llap{i.)} &\ y = (x + 5)^{2}
&{\mathrm{ii.})} &\ y = \sqrt{x + 5}
&{\mathrm{iii.})} &\ x = y^{2} + 5
\\
\llap{iv.)} &\ y = \frac{\sqrt{x^{2} - 25}}{\sqrt{x - 5}}
&{\mathrm{v.})} &\ y = \frac{1}{\sqrt{x + 5}}
&{\mathrm{vi.})} &\ \vert x \vert = y^{2} + 5
}}\]
\vskip0.25in
\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
xmax=26,ymax=7,
axis lines=middle,
restrict y to domain=-3:6.5,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={fill=white},
ytick=\empty,
xtick={-5,5}
]
\addplot[domain=5:26,mark=none,samples=201] {sqrt(x + 5)};
\addplot[domain=-6:5,dashed,thin,mark=none,samples=201] {sqrt(x + 5)};
\draw [densely dashed] (5,3.16227766) -- (5,0);
\draw [fill=white] (5,3.16227766) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\hspace{\fill}
\vskip0.25in
\noindent {\bf 2.)} Which of the following products is equal to an integral power of 10?
\[ \makebox[\textwidth][l]{\kern4em\alignShortstack{
\llap{i.)} &\ 1
&{\mathrm{ii.})} &\ 5^{-3}\left(\frac{1}{8}\right)
&{\mathrm{iii.})} &\ 5^{-3}\left(\frac{1}{80}\right)
&{\mathrm{iv.})} &\ 5^{-3}\left(\frac{1}{800}\right) \\
\llap{v.)} &\ \left(\frac{4}{9}\right)^{3}15^{6}
&{\mathrm{vi.})} &\ 2^{-6}25^{-3}
&{\mathrm{vii.})} &\ \left(\frac{1}{2}\right)^{6}\left(\frac{1}{25}\right)^{3}
&{\mathrm{viii.})} &\ \left(\frac{7}{4}\right)^{6}\left(\frac{1}{5^{4}49}\right)^{3}
}}\]
\vskip0.25in
\end{document}
在下图中,在 4em 缩进处添加了一条红线,以显示不同问题中第 1 列右括号的对齐方式,这是 OP 的要求。
附录:
以下基本上与上面的操作相同,但是使用宏简化了添加答案标签的输入\LBL{integer}
。
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.11}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\usepackage{tabstackengine}
\stackMath
\setstackgap{S}{10pt}
\setstackaligngap{5em}
\makeatletter
\renewcommand\TAB@delim[1]{\displaystyle#1}%
\makeatother
\newcommand\LBL[1]{\llap{\romannumeral#1.)}}
\begin{document}
\noindent {\bfseries 1.)} Which of the following functions is graphed?
\[ \makebox[\textwidth][l]{\kern4em\alignShortstack{
\LBL{1} &\ y = (x + 5)^{2}
&\LBL{2} &\ y = \sqrt{x + 5}
&\LBL{3} &\ x = y^{2} + 5
\\
\LBL{4} &\ y = \frac{\sqrt{x^{2} - 25}}{\sqrt{x - 5}}
&\LBL{5} &\ y = \frac{1}{\sqrt{x + 5}}
&\LBL{6} &\ \vert x \vert = y^{2} + 5
}}\]
\vskip0.25in
\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
xmax=26,ymax=7,
axis lines=middle,
restrict y to domain=-3:6.5,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={fill=white},
ytick=\empty,
xtick={-5,5}
]
\addplot[domain=5:26,mark=none,samples=201] {sqrt(x + 5)};
\addplot[domain=-6:5,dashed,thin,mark=none,samples=201] {sqrt(x + 5)};
\draw [densely dashed] (5,3.16227766) -- (5,0);
\draw [fill=white] (5,3.16227766) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\hspace{\fill}
\vskip0.25in
\noindent {\bfseries 2.)} Which of the following products is equal to an integral power of 10?
\[ \makebox[\textwidth][l]{\kern4em\alignShortstack{
\LBL{1} &\ 1
&\LBL{2} &\ 5^{-3}\left(\frac{1}{8}\right)
&\LBL{3} &\ 5^{-3}\left(\frac{1}{80}\right)
&\LBL{4} &\ 5^{-3}\left(\frac{1}{800}\right)
\\
\LBL{5} &\ \left(\frac{4}{9}\right)^{3}15^{6}
&\LBL{6} &\ 2^{-6}25^{-3}
&\LBL{7} &\ \left(\frac{1}{2}\right)^{6}\left(\frac{1}{25}\right)^{3}
&\LBL{8} &\ \left(\frac{7}{4}\right)^{6}\left(\frac{1}{5^{4}49}\right)^{3}
}}\]
\vskip0.25in
\end{document}