3

I have the following code to define a piece-wise equation as shown in the following figure:

\begin{equation}
\label{xput_vc}
Throughput_{VC} = 
\begin{array}{cc}
  1 & N_{VC} \leq N_{slave} \\
  \frac{N_{req2slave}\times N_{VC}}{N_{req2slave}+Latency} &  N_{VC} > N_{slave} \\
\end{array}
\end{equation}

piecewise equation

I want to decrease the font size of the conditions in that equation (NVC less then NSlave) but I can't seem to be able to get it to do that. I tried typing \footnotesize before the condition but it makes no difference.

How can I change the font size inside the array nested in an equation environment?

  • 3
    Welcome to TeX.SX. If you really need (explanatory) text in an equation use \text{Throughput} or \intertext. And you need amsmath as package, but you can't change the font size (this way) in math mode, in addition there's a case command that's meant for such piecewise functions/definitions etc. – user31729 Nov 17 '15 at 23:16
3

Here are ways to do it, with the cases environment. In the second way, you can have the 1 centred easily with \hfill (thanks to @Mico's suggestion):

    \documentclass{article}
    \usepackage{amsmath}

    \begin{document}

    \begin{equation}
      \label{xput_vc}
      \text{Throughput}_{VC} =
      \begin{cases}
        1 & \scriptstyle N_{VC} \leq N_\text{slave} \\
        \frac{N_\text{req2slave}\times N_{VC}}{N_\text{req2slave}+\text{Latency}} & \scriptstyle N_{VC} > N_\text{slave} \\
      \end{cases}
    \end{equation}
    \vskip1cm
    \begin{equation}
      \label{xput_vc}
      \text{Throughput}_{VC} =
      \begin{cases}
        \hfill 1\hfill & \scriptstyle N_{VC} \leq N_\text{slave} \\
        \frac{N_\text{req2slave}\times N_{VC}}{N_\text{req2slave}+\text{Latency}} & \scriptstyle N_{VC} > N_\text{slave} \\
      \end{cases}
    \end{equation}

    \end{document} 

enter image description here

  • Thanks! How do I center the "1" in this environment? – mohsaied Nov 18 '15 at 1:47
  • You can with the small makebox package. Please see my updated answer. – Bernard Nov 18 '15 at 9:03
  • @Mico: I didn't even think of using it, not knowing how TeX measures the boxes that play here. I've incorporated it in my answer. Thanks for you suggestion: the code is much neater! – Bernard Nov 18 '15 at 13:21
1

You can do it like this

\text{\footnotesize $N_{VC} \leq N_{slave}$}
  • 1
    Maybe, but you certainly shouldn't! – cfr Nov 17 '15 at 23:29
  • I agree, this seems too hacky; what should I do though? – mohsaied Nov 17 '15 at 23:49
  • I must say, this did actually work fine though -- upvote for that – mohsaied Nov 17 '15 at 23:54

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.