# awkward tabular

I have a need to create some awkward tabulars as shown below. So far, I managed to create them to a certain degree (not perfect) as shown below. I sure would like some help here to produce a better result as the original shown above. My MWE is shown below and hope some of you can lend some hands. Thank you.

\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 Answer

I think you can use \multirow for this.

In the first array I've put the first plus after the first vertical rule for consistency.

\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}


• Thank you and that looks very good. Mar 26 '19 at 1:05
• @user91822 You're welcome, thank you for accepting my answer! Mar 26 '19 at 5:42
• TBH, I had to make some slight changes. For instance (on the 2nd or last equation), on both the "+[(b_{4}+)/(a_{4}+)]" and the "+[1/(a_{4}+)]" to move the right "+" signs closer to the fractions. Doing so will leave the last item "[+(b_{4}/a_{4})]" with their fraction bar longer extends out and I don't know how to fix it. But, that is OK. So far, so good. Mar 26 '19 at 12:54
• @user91822 You could ask another question, I'll answer if no one else does it before me, do not hesitate to ask again! Mar 26 '19 at 13:48