1

I would like to write two equations (R3 and R4) in overleaf.

expected equations Since I use a template which are in two column format, the equations become untidy as in the screenshot.

Here is the code:

\begin{equation} \label{eq:R3}
R_3(i) = 
 \begin{cases} 
  (q_i.c_i + (1-q_i)p_i + (n+1)w + nv)(\frac{q_i}{m_i-z_i} +\frac{(1-q_i)}{m_i-z_i})  & \text{if } i \geq (n-1) \\
  (q_n.p_n + (1-q_n)c_n + (n+1)w + nv)(\frac{q_n}{m_n-z_n} +\frac{(1-q_n)}{m_n-z_n})       & \text{if } i = n
 \end{cases}\end{equation}

\begin{equation} \label{eq:R4}
R_4(i) = 
 \begin{cases} 
  (q_i.p_i + (1-q_i)c_i + (n+3)w + (n+2)v)(\frac{q_i}{z_i+1} +\frac{(1-q_i)}{z_i+1})  & \text{if } i \geq (n-1) \\
  (q_n.c_n + (1-q_n)p_n + (n+3)w + (n+2)v)(\frac{q_n}{z_n+1} +\frac{(1-q_n)}{z_n+1})       & \text{if } i = n
 \end{cases}\end{equation}

Then, here is the preview. preview

Do you have any idea how to make these equations tidier ? I am thinking to make the font smaller however I am not sure what to do.

Thank you.

6
  • 2
    Welcome to the TEX.SE. community. What is the minimal complete example to reproduce your screenshot? Please can you glue in your question?
    – Sebastiano
    Jan 24 at 10:37
  • It is probably better to rephrase especially since you are working in two columns and thus have much more limited space.
    – daleif
    Jan 24 at 10:48
  • 1
    Hi @Sebastiano, I added the expected equation on this page. Is that what you meant? Hi Daleif, what is meant by "to rephrase"? Any example, perhaps? Thank you. Jan 24 at 11:06
  • 1
    What document class are you using?
    – egreg
    Jan 24 at 11:53
  • 1
    Hi @egreg, it is \documentclass[journal]{IEEEtran}. Jan 25 at 6:40

3 Answers 3

3

wrap and small fontsize

\documentclass{IEEEtran}
\usepackage{tabularray}
\usepackage{amsmath}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\lipsum[1-6]
\begin{equation}\label{eq:R3}
\small
R_3(i) =
\begin{cases}
\begin{tblr}{colspec={l},colsep={0pt}}(q_i.c_i + (1-q_i)p_i + (n+1)w + nv) \\ \times(\frac{q_i}{m_i-z_i} +\frac{(1-q_i)}{m_i-z_i})\end{tblr} & \text{if } i \geq (n-1) \\
\begin{tblr}{colspec={l},colsep={0pt}}(q_n.p_n + (1-q_n)c_n + (n+1)w + nv) \\ \times(\frac{q_n}{m_n-z_n} +\frac{(1-q_n)}{m_n-z_n})\end{tblr} & \text{if } i = n
\end{cases}
\end{equation}

\begin{equation}\label{eq:R4}
\footnotesize
R_4(i) =
\begin{cases}
\begin{tblr}{colspec={l},colsep={0pt}}(q_i.p_i + (1-q_i)c_i + (n+3)w + (n+2)v) \\ \times(\frac{q_i}{z_i+1} +\frac{(1-q_i)}{z_i+1})\end{tblr} & \text{if } i \geq (n-1) \\
\begin{tblr}{colspec={l},colsep={0pt}}(q_n.c_n + (1-q_n)p_n + (n+3)w + (n+2)v) \\ \times(\frac{q_n}{z_n+1} +\frac{(1-q_n)}{z_n+1})\end{tblr} & \text{if } i = n
\end{cases}
\end{equation}
\par\lipsum[1]
\end{document}

enter image description here

double column equation

\documentclass{IEEEtran}
\usepackage{cuted}
\usepackage{amsmath}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{strip}
\begin{equation}\label{eq:R3}
R_3(i) =
\begin{cases}
(q_i.c_i + (1-q_i)p_i + (n+1)w + nv)(\frac{q_i}{m_i-z_i} +\frac{(1-q_i)}{m_i-z_i}) & \text{if } i \geq (n-1) \\
(q_n.p_n + (1-q_n)c_n + (n+1)w + nv)(\frac{q_n}{m_n-z_n} +\frac{(1-q_n)}{m_n-z_n}) & \text{if } i = n
\end{cases}
\end{equation}
\begin{equation}\label{eq:R4}
R_4(i) =
\begin{cases}
(q_i.p_i + (1-q_i)c_i + (n+3)w + (n+2)v)(\frac{q_i}{z_i+1} +\frac{(1-q_i)}{z_i+1}) & \text{if } i \geq (n-1) \\
(q_n.c_n + (1-q_n)p_n + (n+3)w + (n+2)v)(\frac{q_n}{z_n+1} +\frac{(1-q_n)}{z_n+1}) & \text{if } i = n
\end{cases}
\end{equation}
\end{strip}
\lipsum[4-7]
\end{document}

enter image description here

2

Typesetting such big formulas in two-column format often requires some comprimise.

Here the compromise is to split the longish parts and give up with cases, so pushing the conditions under the longer top part.

Using newtxmath not only ensures consistency between text and math fonts, but also makes the math narrower.

Note. showframe and lipsum are used only for debugging. The former adds the frames as seen in the picture.

\documentclass[journal]{IEEEtran}
\usepackage{amsmath,mathtools}
\usepackage{newtxtext,newtxmath}

\usepackage{showframe,lipsum}

\begin{document}

\lipsum*[1][1-3]
\begin{align}
\label{eq:R3}
\hspace{-0.5em}
R_3(i) &=
  \left\lbrace
  \begin{aligned}
    &\mathmakebox[0.5\columnwidth][l]{(q_i.c_i + (1-q_i)p_i + (n+1)w + nv)} \\[0.5ex]
    &\cdot\left(\frac{q_i}{m_i-z_i} +\frac{1-q_i}{m_i-z_i}\right)
    && \text{if } i \geq n-1
  \\[2ex]
    &\mathmakebox[0.5\columnwidth][l]{(q_n.p_n + (1-q_n)c_n + (n+1)w + nv)} \\[0.5ex]
    &\cdot\left(\frac{q_n}{m_n-z_n} +\frac{1-q_n}{m_n-z_n}\right)
    && \text{if } i = n
  \end{aligned}
  \right.
\\
\label{eq:R4}
\hspace{-0.5em}
R_4(i) &=
  \left\lbrace
  \begin{aligned}
    &\mathmakebox[0.5\columnwidth][l]{(q_i.p_i + (1-q_i)c_i + (n+3)w + (n+2)v)} \\[0.5ex]
    &\cdot\left(\frac{q_i}{z_i+1} +\frac{1-q_i}{z_i+1}\right)
    && \text{if } i \geq n-1
  \\[2ex]
    &\mathmakebox[0.5\columnwidth][l]{(q_n.c_n + (1-q_n)p_n + (n+3)w + (n+2)v)} \\[0.5ex]
    &\cdot\left(\frac{q_n}{z_n+1} +\frac{1-q_n}{z_n+1}\right)
    && \text{if } i = n
  \end{aligned}
  \right.
\end{align}
\lipsum

\end{document}

enter image description here

5
  • Hi @egred, both notations are well written, however there is additional text: Lorem ipsum... same as in your screenshot. What should I do to delete the unnecessarily text? Thank you. Jan 25 at 8:33
  • There are missing "are" between two equations in the systeme. Can you see the image in the question?
    – Sebastiano
    Jan 25 at 9:07
  • @NicholasTI Just remove the \lipsum commands. I removed the “and” between the cases, because it's not customary to have it: the brace already tells the reader about it.
    – egreg
    Jan 25 at 9:10
  • Thank you @egred Jan 25 at 9:14
  • Hi @clara, do you mind taking a look at this question: tex.stackexchange.com/q/678591/288908 , please? Thank you. Mar 8 at 3:38
2

I'd like to suggest that you load the mathtools package -- a superset of the amsmath package -- and employ \mathrlap wrappers and dcases environments, both provided by the mathtools package.

enter image description here

\documentclass[journal]{IEEEtran} 
\usepackage{mathtools}   % for '\mathrlap' macro and 'dcases' env.
\usepackage{newtxtext,newtxmath} % Times Roman text and math font clones
\usepackage{lipsum}      % filler text
\begin{document}
\lipsum[1] % a paragraph of filler text
\begin{align} 
R_3(i) &=
 \begin{dcases}
  \mathrlap{\bigl(q_i c_i + (1-q_i)p_i + (n+1)w + nv\bigr)} \\
  \quad\times\biggl(\frac{q_i}{m_i-z_i} +\frac{1-q_i}{m_i-z_i}\biggr)
  & \text{if $1\le i<n$} \\[1ex]
  \mathrlap{\bigl(q_n p_n + (1-q_n)c_n + (n+1)w + nv)} \\
  \quad\times\biggl(\frac{q_n}{m_n-z_n} +\frac{1-q_n}{m_n-z_n}\biggr)
  & \text{if $i=n$}
 \end{dcases} \label{eq:R3} \\[1.5ex]
R_4(i) &=
 \begin{dcases}
  \mathrlap{\bigl(q_i p_i + (1-q_i)c_i + (n+3)w + (n+2)v\bigr)} \\
  \quad\times\biggl(\frac{q_i}{z_i+1} +\frac{1-q_i}{z_i+1}\biggr)
  & \text{if $1\le i<n$} \\[1ex]
  \mathrlap{\bigl(q_n c_n + (1-q_n)p_n + (n+3)w + (n+2)v\bigr)}\\
  \quad\times\biggl(\frac{q_n}{z_n+1} +\frac{1-q_n}{z_n+1}\biggr)
  & \text{if $i=n$}
 \end{dcases} \label{eq:R4}
\end{align}
\lipsum % more filler text
\end{document}
3
  • Hi @Mico, how to delete the additional text which is not in English (Lorem ipsum dolor sit amet, ...) when I used the given code? Thank you. Jan 25 at 9:09
  • @NicholasTI - Just omit the directives \lipsum[1] and \lipsum.
    – Mico
    Jan 25 at 9:30
  • Hi, do you mind taking a look at the new question: tex.stackexchange.com/q/678591/288908 , please? Mar 8 at 3:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .