[Tex/LaTex] How to scale eqnarray to fit page width

equationsresize

I have the following eqnarray in Latex:

\begin{eqnarray*}
&
\begin{matrix}
\equalto{\mathbf{s^{i_0}}}{} & \equalto{\mathbf{s^{i_1}}}{} & \cdots & \equalto{\mathbf{s^{i_{N - 1}}}}{}
\end{matrix}
& \\
&
\left(
\begin{matrix}
b^0_{i_0} & b^0_{i_1} & \cdots & b^0_{i_{N - 1}} \\
b^1_{i_0} & b^1_{i_1} & \cdots & b^1_{i_{N - 1}} \\
\vdots & \cdots & \cdots & \vdots \\
b^L_{i_0} & b^L_{i_1} & \cdots & b^L_{i_{N - 1}}
\end{matrix}
\right)
&
\begin{matrix}
\rightarrow \\
\rightarrow \\
\rightarrow \\
\rightarrow
\end{matrix}
\left(
\begin{matrix}
a^0_0 & a^0_1 & \cdots & a^0_{N - 1} \\
a^1_0 & a^1_1 & \cdots & a^1_{N - 1} \\
\vdots & \cdots & \cdots & \vdots \\
a^L_0 & a^L_1 & \cdots & a^L_{N - 1}
\end{matrix}
\right)
=
\left(
\begin{matrix}
s_0 & s_1 & \cdots & s_{N - 1} \\
s_N & s_{N + 1} & \cdots & s_{2N - 1} \\
\vdots & \cdots & \cdots & \vdots \\
s_S & 0 & \cdots & 0
\end{matrix}
\right)
\end{eqnarray*}

As you can see, it's very large, with a lot of lines and things that need to be aligned. I know that I can scale the content of an equation to fit the line by

\begin{equation}
\resizebox{.9 \linewidth}{!}
{
    $my_equation_here$
}
\end{equation}

While I can obviously do it for simple equations, I wouldn't even know where to start to translate that gargantuan eqnarray into some set of $$ environments while maintaining the alignment I need.

So I wonder: is there any sensible way to resize an equation from outside its environment? Something like

\resizemyprettyequation{fitthepage}
{
  \begin{equation}
    my_pretty_equation_here
  \end{equation}
}

I looked around but I don't seem to be able to find a solution!

Best Answer

Hoping you don't have too many such things to typeset.

The trick is to reduce a bit the intercolumn padding. The row above the first matrix is positioned by hand, adjust the spacing to suit.

I increased the value of \arraystretch, feeling that a bit of vertical room is needed, due to the big subscripts.

The settings are local to the equation environment, so you don't need to revert them.

\documentclass{article}
\usepackage{amsmath,calc,graphicx}

\newcommand{\equalto}[2]{%
  \begin{tabular}[t]{@{}c@{}}
  \makebox[\widthof{$#2$}]{$#1$}\\[-.5ex]
  \rotatebox{90}{$=$}
  \end{tabular}%
}

\begin{document}

\begin{equation}
\addtolength{\arraycolsep}{-3pt}
\renewcommand{\arraystretch}{1.2}
\begin{aligned}[b]
&\mspace{19mu}\begin{matrix}
 \equalto{\mathbf{s^{i_0}}}{b^0_{i_0}} &
 \equalto{\mathbf{s^{i_1}}}{b^0_{i_1}} &
 \cdots &
 \equalto{\mathbf{s^{i_{N - 1}}}}{b^0_{i_{N-1}}}
 \end{matrix}
\\[-1ex]
&\begin{pmatrix}
b^0_{i_0} & b^0_{i_1} & \cdots & b^0_{i_{N - 1}} \\
b^1_{i_0} & b^1_{i_1} & \cdots & b^1_{i_{N - 1}} \\
\vdots & \vdots & \ddots & \vdots \\
b^L_{i_0} & b^L_{i_1} & \cdots & b^L_{i_{N - 1}}
\end{pmatrix}
\begin{matrix}
{\rightarrow}\vphantom{b^0_{i_{N - 1}}} \\
{\rightarrow}\vphantom{b^0_{i_{N - 1}}} \\
\vdots \\
{\rightarrow}\vphantom{b^0_{i_{N - 1}}}
\end{matrix}
\begin{pmatrix}
a^0_0 & a^0_1 & \cdots & a^0_{N - 1} \\
a^1_0 & a^1_1 & \cdots & a^1_{N - 1} \\
\vdots & \vdots & \ddots & \vdots \\
a^L_0 & a^L_1 & \cdots & a^L_{N - 1}
\end{pmatrix}
=
\begin{pmatrix}
s^{}_0 & s^{}_1 & \cdots & s^{}_{N - 1} \\
s^{}_N & s^{}_{N + 1} & \cdots & s^{}_{2N - 1} \\
\vdots & \vdots & \ddots & \vdots \\
s^{}_S & 0 & \cdots & 0
\end{pmatrix}
\end{aligned}
\end{equation}

\end{document}

enter image description here

Without the equation number, I found that

\addtolength{\arraycolsep}{-1.5pt}

suffices, but of course the setting depends on the (unknown) size of your document.

Related Question