我需要创建一些如下所示的尴尬的表格。 到目前为止,我已经设法在一定程度上(并不完美)创建它们,如下所示。我确实需要一些帮助来产生更好的结果,如上面显示的原始结果。我的 MWE 如下所示,希望你们中的一些人能伸出援手。谢谢。
\documentclass[a4paper,11pt,twoside]{book}
\usepackage{array}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
y = a_{0} +
\begin{tabular}{|c|c|c|c|c}
$b_{1}$ &
$+\dfrac{1}{}$ &
------ &
------ &
------ \\
&
$\phantom{+} a_{2}$ &
$+\dfrac{b_{3}}{a_{3}}$ &
$\dfrac{+\dfrac{1}{b_{4}}}{+\dfrac{b_{1}}{a_{4}}}$ &
------ \\
\hline
$a_{1}$ &
$+\dfrac{b_{2}}{a_{2}}$ &
$\dfrac{+\dfrac{1}{a_{3}}}{+\dfrac{b_{3}}{a_{3}}}$ &
$\dfrac{\dfrac{}{+\dfrac{b_{4}}{a_{4}}}}{\dfrac{}{+\dfrac{b_{4}}{a_{4}}}}$ &
------ \\
\end{tabular}
\\
\intertext{and}
\\
x = b_{0}
\left|+\cfrac{1}{a_{1}
\left|+\dfrac{b_{2}}{a_{2}}
\left|\dfrac{+\dfrac{1}{a_{3}}}{+\dfrac{b_{3}}{a_{3}}}
\left|\dfrac{\dfrac{}{+\dfrac{b_{4}+}{a_{4}+}}}
{\dfrac{+\dfrac{1}{a_{4}+}}{+\dfrac{b_{4}}{a_{4}}}}
\right.
\right.
\right.}
\right.
\end{gather*}
\end{document}
答案1
我认为你可以用\multirow
这个。
在第一个数组中,为了保持一致性,我将第一个加号放在了第一个垂直规则之后。
\documentclass[a4paper,11pt,twoside]{book}
\renewcommand{\arraystretch}{1.2}
\usepackage{amsmath}
\usepackage{array}
\usepackage{multirow}
\newcommand{\myplus}{\multirow{2}{*}{$+$}}
\newcommand{\mymul}[1]{\multirow{2}{*}{$#1$}}
\begin{document}
\begin{gather*}
\begin{array}{l*4{|l>{$}p{1.5em}<{$}}|p{1.5em}}
&&\mymul{b_{1}}&\myplus& 1 &&&&& \\
\cline{5-10}
&&&&&&\mymul{b_{3}}&\myplus& 1 & \\
\cline{9-10}
&&&&\mymul{a_{2}}&\myplus&&& a_{4} & \\
\cline{7-10}
&&&&&&\mymul{a_{3}}&\myplus& b_{4} & \\
\cline{9-10}
\mymul{y_{0}=a_{0}}&\myplus&&&&&&& a_{4} & \\
\cline{3-10}
&&&&\mymul{b_{2}}&\myplus& 1 &&& \\
\cline{7-10}
&&&&&&\mymul{a_{3}}&\myplus& b_{4} & \\
\cline{9-10}
&&\mymul{a_{1}}&\myplus&&&&& a_{4} & \\
\cline{5-10}
&&&&&&\mymul{b_{3}}&\myplus& 1 & \\
\cline{9-10}
&&&&\mymul{a_{2}}&\myplus&&& a_{4} & \\
\cline{7-10}
&&&&&&\mymul{a_{3}}&\myplus& b_{4} & \\
\cline{9-10}
&&&&&&&& a_{4} & \\
\end{array}
\intertext{and}
\begin{array}{l*3{|l>{$}p{1.5em}<{$}}|lll}
\mymul{x_{0}=b_{0}}&\myplus&\multicolumn{3}{l}{$1$} \\
\cline{3-10}
&&&&\mymul{b_{2}}&\myplus& 1 && \\
\cline{7-10}
&&&&&&\mymul{a_{3}}&\myplus& b_{4} & + \\
\cline{9-10}
&&\mymul{a_{1}}&\myplus&&&&& a_{4} &+ \\
\cline{5-10}
&&&&&&\mymul{b_{3}}&\myplus& 1 \\
\cline{9-10}
&&&&\mymul{a_{2}}&\myplus&&& a_{4} & + \\
\cline{7-10}
&&&&&&\mymul{a_{3}}&\myplus& b_{4} \\
\cline{9-10}
&&&&&&&& a_{4} \\
\end{array}
\end{gather*}
\end{document}