3

I am writing a mathematical model using eqnarray environment in beamer, the problem is that I need it to be smaller, so I tried to use resize it using \scalebox or resizebox but I got error (not familiar with them thoug). Is there an easy way to resize the eqnarray environment ? (Do not want to use the \small, \tiny to change font size). Below there is a little equation I would like to apply some resize action. Thanks in advance.

\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usepackage{amssymb,amsmath}

\begin{document}
\begin{frame}{test}
\begin{eqnarray}    
&& \textbf{TP} ~~\text{Max} \sum_{i \in N\setminus\{4\}} J_{i} z_{i} 
\label{S1}\\
&& \text{st} \nonumber\\
&& \sum_{j \in N} xv_{ij} = z_{i}, ~~\forall i \in N \label{S2}
\end{frame}
\end{document}
  • Your objective isn't entirely clear. On the one hand, you say you don't want to use a smaller font size (via an instruction such as \tiny, say). On the other hand, you also say that the system of equations needs to be made smaller. What's driving the implied preference for \resizebox over using a smaller-than-normal font size? – Mico Mar 2 '18 at 6:56
4

with use of mathtools and nccmath you can slightly reduce size of equation (without changing font size):

\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usepackage{mathtools, % instead amsmath, provide `\mathclap`
            nccmath,   % for smaller `sum` symbol
            amssymb}

\begin{document}
\begin{frame}{test}
    \begin{align}
& \textbf{TP} ~~\max \medop\sum_{\mathclap{i \in N\setminus\{4\}}} J_{i} z_{i}
\label{S1}\\
& \text{st } 
  \medop\sum_{j \in N} xv_{ij} = z_{i},\ \forall i \in N \label{S2}
    \end{align}
\end{frame}
\end{document}

note: eqnarray is long time deprecated and replaced with math environment from amsmath.

enter image description here

for comparison result with your mwe:

enter image description here

1

Don't use \resizebox or scalebox unless you're fine with making your document look like an attempt at a ransom note.

To conserve some (vertical) space, don't place the "such that" statement on a separate line, and do place the limits of summation to the right of the summation symbols rather than below and above them; do this by writing \sum\nolimits. And, do use LaTeX "operators" such as \max for some standard math notation.

Since there seems to be no reason to perform vertical alignment, just use a gather environment. A final comment: The eqnarray environment is badly deprecated and should be avoided. If you must perform alignment across equations, use the align environment (provided by the amsmath package).

The following screenshot provides a before-and-after comparison; the first two equations generate your code, and the next two show a space savings of more than a third -- all without having to resort to \resizebox-based tricks.

enter image description here

\documentclass{beamer}
\begin{document}
\begin{frame}{test}
\hrule
\begin{eqnarray}    
&& \textbf{TP} ~~\text{Max} \sum_{i \in N\setminus\{4\}} J_{i} z_{i} 
\label{S3}\\
&& \text{st} \nonumber\\
&& \sum_{j \in N} xv_{ij} = z_{i}, ~~\forall i \in N \label{S4}
\end{eqnarray}
\hrule
\begin{gather}    
\mathbf{TP}\quad \max \sum\nolimits_{i\in \mathbb{N}\setminus\{4\}} J_{i} z_{i} \label{S1}\\
\text{s.t. }
\sum\nolimits_{j \in N} xv_{ij} = z_{i}\quad \forall i\in \mathbb{N} \label{S2}
\end{gather}
\hrule
\end{frame}
\end{document}
  • In that context, “s.t.” stands for “subject to” – egreg Mar 2 '18 at 6:58
  • @egreg - Many thanks for pointing out this issue. I'll apply the fix. – Mico Mar 2 '18 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.