![在 tabularx 中模拟对齐环境,每个证明甚至多次](https://linux22.com/image/467931/%E5%9C%A8%20tabularx%20%E4%B8%AD%E6%A8%A1%E6%8B%9F%E5%AF%B9%E9%BD%90%E7%8E%AF%E5%A2%83%EF%BC%8C%E6%AF%8F%E4%B8%AA%E8%AF%81%E6%98%8E%E7%94%9A%E8%87%B3%E5%A4%9A%E6%AC%A1.png)
我已经问过这个问题了:定义一个类似于 align 的环境,以便可以在 tabularx 或 tabular 中使用。
Zarko 对这个问题的回答(https://tex.stackexchange.com/a/693393/277990)包括附录对于只有一组连续语句且其“=”符号水平对齐的情况,其代码给出了我想要的输出。
我希望允许存在多个此类组的情况。请参阅以下代码中的我的注释:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
% The code given in the Addendum to Zarko's answer:
\begin{tabularx}{250pt}{r l @{\;} >{$\raggedright}X<{$} l}
1. & \multicolumn{2}{l}{Math}
& Words \\
2. & m & = 9/3 & Words \\
3. & & = 3 & Words \\
\end{tabularx}
\vspace{1cm}
The above code is succcessful.
However, it cannot cope with situations in which
there are two or more different groups of successive statements
requiring separate horizontal alignments of = symbols.
For example, look what happens to the output if we keep going
(e.g. if we add lines 4 and 5 to the above):
\vspace{1cm}
\begin{tabularx}{250pt}{r l @{\;} >{$\raggedright}X<{$} l}
1. & \multicolumn{2}{l}{Math}
& Words \\
2. & m & = 9/3 & Words \\
3. & & = 3 & Words \\
4. & 34x+2 & = 30/2 & Words \\
5. & & = 15 & Words \\
\end{tabularx}
\vspace{1cm}
We see that the horizontal alignment of all four `=' symbols
is determined by the `=' symbol in line 4,
whereas what we want is for the `=' symbol in line 3
to be aligned with the `=' symbol in line 2
and for the `=' symbol in line 5
to be aligned with the `=' symbol in line 4.
In other words, we want to eliminate
the space between `m' and `= 9/3',
and then align the `=' symbol in line 3
directly below the `=' symbol in line 2.
\end{document}
答案1
第二列应右对齐(朝向 =)并且数学如下:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
The above code is succcessful.
However, it cannot cope with situations in which
there are two or more different groups of successive statements
requiring separate horizontal alignments of = symbols.
For example, look what happens to the output if we keep going
(e.g. if we add lines 4 and 5 to the above):
\vspace{1cm}
\begin{tabularx}{250pt}{r >$r<$ @{} >{\raggedright${}}X<{$} l}
1. & \multicolumn{2}{l}{Math}
& Words \\
2. & m & = 9/3 & Words \\
3. & & = 3 & Words \\
4. & 34x+2 & = 30/2 & Words \\
5. & & = 15 & Words \\
\end{tabularx}
\vspace{1cm}
\begin{tabularx}{250pt}{r >$r<$ @{} >{\raggedright${}}X<{$} l}
1. & \multicolumn{2}{l}{Math}
& Words \\
2. & m & = 9/3 & Words \\
3. & & = 3 & Words \\
\end{tabularx}
\begin{tabularx}{250pt}{r >$r<$ @{} >{\raggedright${}}X<{$} l}
4. & 34x+2 & = 30/2 & Words \\
5. & & = 15 & Words \\
\end{tabularx}
\vspace{1cm}
We see that the horizontal alignment of all four `=' symbols
is determined by the `=' symbol in line 4,
whereas what we want is for the `=' symbol in line 3
to be aligned with the `=' symbol in line 2
and for the `=' symbol in line 5
to be aligned with the `=' symbol in line 4.
In other words, we want to eliminate
the space between `m' and `= 9/3',
and then align the `=' symbol in line 3
directly below the `=' symbol in line 2.
\end{document}