# How to scale eqnarray to fit page width

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!

• eqnarray is deprecated, use align or alignat etc. – user31729 Feb 23 '17 at 18:28
• How or where is \equalto defined? – Mico Feb 23 '17 at 21:37

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}{%
\begin{tabular}[t]{@{}c@{}}
\makebox[\widthof{$#2$}]{$#1$}\\[-.5ex]
\rotatebox{90}{$=$}
\end{tabular}%
}

\begin{document}

\begin{equation}
\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} 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.

Here a way to do it, if I've well understood, with a simple align environment and blockarray:

\documentclass{article}
\usepackage{mathtools, blkarray, graphicx}

\newcommand{\verteq}{\rotatebox{90}{$\,=$}}
\newcommand{\equalto}{\underset{\scriptstyle\overset{\mkern4mu\verteq}{#2}}{#1}}

\usepackage[showframe]{geometry}

\begin{document}

\begin{equation}%
\raisebox{1.12ex}{$\begin{blockarray}{ccccc} \equalto{\mathbf{s^{i_0}}}{} & \equalto{\mathbf{s^{i_1}}}{} & \cdots & \equalto{\mathbf{s^{i_{N - 1}}}}{} \\[-0.4ex] \begin{block}{(cccc)>{\!}c} b^0_{i_0} & b^0_{i_1} & \cdots & b^0_{i_{N - 1}} & \to\\ b^1_{i_0} & b^1_{i_1} & \cdots & b^1_{i_{N - 1}} & \to \\ \vdots & \cdots & \cdots & \vdots & \to \\ b^L_{i_0} & b^L_{i_1} & \cdots & b^L_{i_{N - 1}} & \to\\ \end{block} \end{blockarray}$}
\hspace{-0.9em}
\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 & \cdots & \cdots & \vdots \\
a^L_0 & a^L_1 & \cdots & a^L_{N - 1}
\end{pmatrix}
=
\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{equation}

\end{document} 