Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

HI here is the latex code

    \documentclass{sig-alternate}
    \usepackage{ctable}
    \begin{document}
   $G_{CS}(\mathbb{S_c})=
\begin{cases}
\displaystyle\sum_{k=1}^{r} \frac{Gmax(k)-q_k(s)}{Gmax(k)-Gmin(k)}.w_k & if\ Gmax(k) \neq Gmin(k)\\
1 & if\ Gmax(k) = Gmin(k)
\end{cases}$
   This is boundary This is boundary This is boundary This is boundary This is boundary This is boundary This is boundary This is boundaryThis is boundary This is boundary This is boundary This is boundary This is boundary This is boundary This is boundary This is boundary

    \end{document} 

And here is the latex enter image description here

I am using two columns in with ACM SIG Proceedings template http://www.acm.org/sigs/publications/proceedings-templates

The equation has gone out from the boundary, is there a way to make it within the boundary? One way I can think of is make the space of red circle becomes smaller, and the font in red rectangle becomes smaller, but i am not sure how to achieve it. Furthermore, two multilines of equation are too near(draw by red line) is there a way to seperate it further?

share|improve this question
2  
A little suggestion, maybe not solving your problem, what about using G_{max} instead of Gmax ? –  fefe Nov 14 '12 at 0:00
3  
Or G_{\text{max}}, for that matter. –  mbork Nov 14 '12 at 2:36
    
Or G_{\max}, for the same matter. –  sfranky May 9 '13 at 17:27
add comment

4 Answers

Here's another option that uses local definitions

enter image description here

\documentclass{sig-alternate}
\usepackage{ctable}
\usepackage{lipsum}
\begin{document}

\subsection{Original}
\[
G_{CS}(\mathbb{S_c})=
\begin{cases}
    \displaystyle\sum_{k=1}^{r} \frac{Gmax(k)-q_k(s)}{Gmax(k)-Gmin(k)}.w_k & if\ Gmax(k) \neq Gmin(k) \\
    1                                                                      & if\ Gmax(k) = Gmin(k)    
\end{cases}
\]
\lipsum[1]

\subsection{New}
\[
G_{CS}(\mathbb{S_c})=
\begin{cases}
    \displaystyle\sum_{k=1}^{r} \frac{f(k,s)}{g(k,s)}.w_k & if\ Gmax(k) \neq Gmin(k) \\
    1                                                                      & if\ Gmax(k) = Gmin(k)    
\end{cases}
\]
where
\begin{align*}
  f(k,s)&=Gmax(k)-q_k(s)\\
  g(k,s)&=Gmax(k)-Gmin(k)
\end{align*}
\lipsum[2]

\end{document} 

Of course, I have completely discounted the possibility of resizing the equation using resizebox from the grahpicx package, as it would end up looking terrible :)

share|improve this answer
add comment

There are many ways to reduce the place needed by the equation:

  • \noindent skips the paragraph indenting.
  • The spacing around binary operators and relational symbols can be reduced by changing \thinmuskip and \medmuskip. Instead of using \medmuskip=.625\medmuskip the expression below with \muexpr also scales the shrink and stretch components and keeps them.
  • \mathit{Gmin} (BTW italic or upright?) saves some space, because Gmin is set as word and not as product G * m * i * n with additional spacing.
  • The cases environment adds \quad (= 1em), \hspace{-.5em} reduces that space.
  • The whole formula is set in smaller font size \small, the cases text in \scriptsize.
  • The word if should be set as word, not as product of i * f: \text{if}.
  • \cdot looks better than . as multiplication sign. The dot is omitted here to save some space, because it is not really needed here.

The example file:

\documentclass{sig-alternate}
\newcommand*{\Gmin}{\mathit{Gmin}}
\newcommand*{\Gmax}{\mathit{Gmax}}
\begin{document}
\noindent
\begingroup
  \small   
  \thinmuskip=\muexpr\thinmuskip*5/8\relax
  \medmuskip=\muexpr\medmuskip*5/8\relax  
  $G_{\mathit{CS}}(\mathbb{S_c})=
  \begin{cases}
    \displaystyle
    \sum_{k=1}^{r} \frac{\Gmax(k)-q_k(s)}{\Gmax(k)-\Gmin(k)}\,w_k
    & \text{\hspace{-.5em}\scriptsize if $\Gmax(k) \neq \Gmin(k)$}\\   
    1 & \text{\hspace{-.5em}\scriptsize if $\Gmax(k) = \Gmin(k)$}   
  \end{cases}
  $%
\endgroup\\
This is boundary This is boundary This is boundary This is boundary This
is boundary This is boundary This is boundary This is boundaryThis is   
boundary This is boundary This is boundary This is boundary This is boundary
This is boundary This is boundary This is boundary
\end{document}

Result

Variant with \resizebox

The sledgehammer method is using \resizebox to scale the equation down to \linewidth:

\documentclass{sig-alternate}
\usepackage{graphicx}
\newcommand*{\Gmin}{\mathit{Gmin}}
\newcommand*{\Gmax}{\mathit{Gmax}}
\begin{document}
\noindent
\resizebox{\linewidth}{!}{%
  $G_{\mathit{CS}}(\mathbb{S_c})=
  \begin{cases}
    \displaystyle
    \sum_{k=1}^{r} \frac{\Gmax(k)-q_k(s)}{\Gmax(k)-\Gmin(k)}\cdot w_k
    & \text{if $\Gmax(k) \neq \Gmin(k)$}\\
    1 & \text{if $\Gmax(k) = \Gmin(k)$}
  \end{cases}$%
}\\
This is boundary This is boundary This is boundary This is boundary This
is boundary This is boundary This is boundary This is boundaryThis is
boundary This is boundary This is boundary This is boundary This is boundary
This is boundary This is boundary This is boundary
\end{document}

resizebox

This can also be combined or replaced with asymmetrical scaling \resizebox{\linewidth}{\height} or (a nested) \scalebox{.975}{1}. Reducing the horizontal width only avoids small looking fonts. But the asymmetries should be kept as small as possible to avoid the equation looking ugly distorted.

And these methods and tricks can be combined, e.g. first reducing the space with the tricks at the beginning and resizing to get the last points.

Variant with max and min as subscripts

Following Gregorio's suggestion by using max and min as subscripts, it becomes easier to adjust the width of the equation, e.g.:

\documentclass{sig-alternate}
\newcommand*{\Gmin}{\mathit{G_{\mathrm{min}}}}
\newcommand*{\Gmax}{\mathit{G_{\mathrm{max}}}}
\begin{document}
\noindent
\begingroup
  \small
  $G_{\mathrm{CS}}(\mathbb{S_c})=
  \begin{cases}
    \displaystyle
    \sum_{k=1}^{r} \frac{\Gmax(k)-q_k(s)}{\Gmax(k)-\Gmin(k)}\,w_k
    & \text{\hspace{-.5em} if $\Gmax(k) \neq \Gmin(k)$}\\
    1 & \text{\hspace{-.5em} if $\Gmax(k) = \Gmin(k)$}
  \end{cases}
  $%
\endgroup\\
This is boundary This is boundary This is boundary This is boundary This
is boundary This is boundary This is boundary This is boundaryThis is
boundary This is boundary This is boundary This is boundary This is boundary
This is boundary This is boundary This is boundary
\end{document}

Result

share|improve this answer
add comment

Narrow columns pose big problems with wide formulas. A possibility is to write the first condition on a line below the formula, sticking a bit outside:

\documentclass[twocolumn]{article}
\usepackage{amsmath,amssymb,lipsum}

\newcommand\Gmax{\mathit{Gmax}}
\newcommand\Gmin{\mathit{Gmin}}

\begin{document}
\lipsum*[2]
\[
G_{CS}(\mathbb{S_c})=
\begin{cases}
\displaystyle\sum_{k=1}^{r} \frac{\Gmax(k)-q_k(s)}{\Gmax(k)-\Gmin(k)}\cdot w_k \qquad\\
\hfill \text{if $\Gmax(k) \neq Gmin(k)$}\\[2\jot]
1 \hfill \text{if $\Gmax(k) = \Gmin(k)$}
\end{cases}
\]
\lipsum*[2]
\end{document}

enter image description here

Note that if the variable is called "G" and "max" and "min" are subscripts, you should define

\newcommand\Gmax{G_\mathrm{max}}
\newcommand\Gmin{G_\mathrm{min}}
share|improve this answer
add comment

In a single column layout I would not use the cases layout and instead write it as two equations with an inline condition. Also I took the _c out of the \mathbb since the AMS bb font doesn't have lowercase so it vanished in your posted image.

If $G_{\mathrm{max}}(k) \neq G_{\mathrm{min}}(k)$ then
\[
G_{\mathrm{CS}}(\mathbb{S}_c)=
\sum_{k=1}^{r} \frac{G_{\mathrm{max}(k)-q_k(s)}}{G_{\mathrm{max}}(k)-G_{\mathrm{min}}(k)}.w_k 
\]
else
\[
G_{\mathrm{CS}}(\mathbb{S}_c)= 1
\]

Note you should never use math italic for multi-letter identifiers and especially not text such as if which should not be in math mode at all.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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