2

I have been trying to figure out how to put addition symbols in between each of the following characters for this code:

\begin{equation}
    \begin{array}{c|ccccc}
                 &a_0  &a_1x   &a_2x^2 &a_3x^3  &\cdots\\
                 \hline
  b_0 &a_0b_0  &a_1b_0x  &a_2b_0x^2 & a_3b_0x^3  &\cdots\\
  b_1x  &a_0b_1x & a_1b_1x^2 & a_2b_1x^3  & a_3b_1x^4  &\cdots \\
  b_2x^2        &a_0b_2x^2 &a_1b_2x^3 &a_2b_2x^4  &a_3b_2x^5&\cdots \\
  b_3 x^3           &a_0b_3x^3 & a_1b_3x^4 & a_2b_3x^5  &a_3b_3x^6 &\cdots \\
                \vdots & \vdots & \vdots & \vdots & \vdots &\ddots
\end{array}
\end{equation}

I have tried aligning &+& like this but the table becomes rather messy. To be more specific, I was looking to have + sign's in the center (between) each part of text. For example, a_0 + a_1x etc. but also under the text as well-- as in a + sign underneath a_0, a_1, etc. as well as + signs under each text on the left hand side $b_0$ and then underneath it a + sign. How would I go about doing this? If the latter was equivocal here is a sketch: enter image description here

1
  • Welcome to TeX SX! Could you post a sketch of what you're expecting?
    – Bernard
    May 18, 2020 at 21:37

1 Answer 1

1

You can exploit array features:

\documentclass{article}
\usepackage{amsmath,array}

\begin{document}

\begin{equation}
\begin{array}{>{\vphantom{\Big|}}c | c *{4}{@{}>{{}}c<{{}}@{}c}}
\multicolumn{1}{c|}{}
        & a_0       &+& a_1x      &+& a_2x^2    &+& a_3x^3    &+& \cdots\\
\hline
b_0     & a_0b_0    &+& a_1b_0x   &+& a_2b_0x^2 &+& a_3b_0x^3 &+& \cdots\\
b_1x    & a_0b_1x   &+& a_1b_1x^2 &+& a_2b_1x^3 &+& a_3b_1x^4 &+& \cdots \\
b_2x^2  & a_0b_2x^2 &+& a_1b_2x^3 &+& a_2b_2x^4 &+& a_3b_2x^5 &+& \cdots \\
b_3x^3  & a_0b_3x^3 &+& a_1b_3x^4 &+& a_2b_3x^5 &+& a_3b_3x^6 &+& \cdots \\
\vdots  & \vdots    & & \vdots    & & \vdots    & & \vdots    & & \ddots
\end{array}
\end{equation}

\end{document}

The @{} bits remove the intercolumn spacing, >{{}} and <{{}} insert empty atoms so the + signs get their proper spacing. The \vphantom{\Big|} inserted in every row except the first gives more air to the table.

enter image description here

With additions also between the rows:

\documentclass{article}
\usepackage{amsmath,array}

\begin{document}

\begin{equation}
\begin{array}{>{\vphantom{\Big|}}c | c *{4}{@{}>{{}}c<{{}}@{}c}}
\multicolumn{1}{c|}{}
        & a_0       &+& a_1x      &+& a_2x^2    &+& a_3x^3    &+& \cdots\\
\hline
b_0     & a_0b_0    &+& a_1b_0x   &+& a_2b_0x^2 &+& a_3b_0x^3 &+& \cdots\\
\multicolumn{1}{c|}{+}
        & +         & & +         & & +         & & + \\
b_1x    & a_0b_1x   &+& a_1b_1x^2 &+& a_2b_1x^3 &+& a_3b_1x^4 &+& \cdots \\
\multicolumn{1}{c|}{+}
        & +         & & +         & & +         & & + \\
b_2x^2  & a_0b_2x^2 &+& a_1b_2x^3 &+& a_2b_2x^4 &+& a_3b_2x^5 &+& \cdots \\
\multicolumn{1}{c|}{+}
        & +         & & +         & & +         & & + \\
b_3 x^3 & a_0b_3x^3 &+& a_1b_3x^4 &+& a_2b_3x^5 &+& a_3b_3x^6 &+& \cdots \\
\multicolumn{1}{c|}{+}
        & +         & & +         & & +         & & + \\
\vdots  & \vdots    & & \vdots    & & \vdots    & & \vdots    & & \ddots
\end{array}
\end{equation}

\end{document}

enter image description here

2
  • I really appreciate it. I tried doing something along the lines of this except I was also aligning the text. Thank you!
    – user212817
    May 18, 2020 at 21:45
  • @Allusion I also added the version with vertical + signs.
    – egreg
    May 18, 2020 at 21:48

You must log in to answer this question.