Sie sind auf Seite 1von 4

sign up log in tour help

_
TeX - LaTeX Stack Exchange is a Here's how it works:
question and answer site for users
of TeX, LaTeX, ConTeXt, and related
typesetting systems. Join them; it
only takes a minute:
The best answers are
Sign up Anybody can Anybody can voted up and rise to the
ask a question answer top

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
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!

{equations} {resize}

asked Feb 23 at 18:24


Matteo Monti
163 2

2   eqnarray is deprecated, use align or alignat etc. – Christian Hupfer Feb 23 at 18:28

    How or where is \equalto defined? – Mico Feb 23 at 21:37

2 Answers

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}

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.

edited Feb 23 at 22:30 answered Feb 23 at 22:18


egreg
590k 70 1562
2715

Did you find this question interesting? Try our newsle er


Sign up for our newsletter and get our top new
questions delivered to your inbox (see an example).

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}[2]{\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}

edited Feb 23 at 22:39 answered Feb 23 at 21:22


Bernard
112k 3 47 148

Das könnte Ihnen auch gefallen