4

I would like to ask about writing equation for this double columns' format.
My equation is a bit long for this format so the equation numbering moves to the bottom as in the first case.
Is this normal to keep it like that?
I also tried to fix it by using split to break the equation but this doesn't look good to me.
Please let me know a standard or better way to do it as I don't have experience on this. enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts}

\begin{document}
\begin{equation}
\label{eq:label1}
\frac{x_n}{y_{HADL}} =
\frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)] }
\end{equation}
\begin{equation}
\label{eq:label2}
\begin{split}
\frac{x_n}{y_{HADL}} &=\\
&\frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)] }
\end{split}
\end{equation}
\end{document}
5
  • Some shortening and better typesetting would be to write y_\text{HADL} instead of y_{HADL}. You could also factorise the minus sign and even put it on the numerator.
    – Jhor
    Jun 16, 2022 at 7:29
  • 1
    @Jhor It's "undocumented behavior" that _\text{...} without another brace group works though. Might break any time.
    – user202729
    Jun 16, 2022 at 7:35
  • Thanks, I'll check it. EDIT: I just checked but it doesn't look good to me.
    – hana
    Jun 16, 2022 at 7:44
  • @user202729. You're right, of course. But I did that for hundreds of equations in several document and classes without any problem..
    – Jhor
    Jun 16, 2022 at 7:50
  • @Jhor -- If it always worked, you were lucky, or never varied your use, never using it in a context where it might be fragile. Jun 16, 2022 at 18:25

4 Answers 4

4

Mixing Computer Modern math with Times is really bad. If you load newtx (or mathptmx, if you want to be old-fashioned), the math will be compatible.

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts}

\usepackage{lipsum} % for context

\usepackage{newtx}

\begin{document}

\lipsum[1][1-3]
\begin{equation}
\label{eq:label1}
\frac{y^{}_{\mathrm{HADL}}}{x_n}=
-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)]
\end{equation}
\lipsum[2][1-3]
\begin{equation}
\label{eq:label2}
\frac{x_n}{y^{}_{\mathrm{HADL}}} =
\frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)] }
\end{equation}
\lipsum[3][1-3]

\end{document}

enter image description here

Note \mathrm{HADL}, because I don't think it's a product of four quantities, is it? The ^{} is meant to lower a bit the subscript.

Without newtx it will fit as well, but you can clearly see the font mismatch. I'll use a small trick for the second one.

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts}

\usepackage{lipsum} % for context

\begin{document}

\lipsum[1][1-3]
\begin{equation}
\label{eq:label1}
\frac{y^{}_{\mathrm{HADL}}}{x_n}=
-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)]
\end{equation}
\lipsum[2][1-3]
\begin{equation}
\label{eq:label2}
\hspace{-0.5em}
\frac{x_n}{y^{}_{\mathrm{HADL}}} =
\frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)] }
\hspace{1000pt minus 1fil}
\end{equation}
\lipsum[3][1-3]

\end{document}

enter image description here

10
  • Thanks, it looks nice but I got this error while load newtx package. LaTeX Error: File newtx.sty' not found.`
    – hana
    Jun 16, 2022 at 10:48
  • I'm using overleaf.
    – hana
    Jun 16, 2022 at 10:59
  • Another question: why don't you use x_\mathrm{n} instead of x_n?
    – hana
    Jun 16, 2022 at 11:42
  • 1
    @hana No, it's math. Use \mathrm for textual subscripts.
    – egreg
    Jun 16, 2022 at 14:44
  • 1
    @hana Yes, definitely.
    – egreg
    Jun 16, 2022 at 17:14
5

I suggest loading mathtools, which is a superset of amsmath and use its \splitfrac command:

    \documentclass[journal]{IEEEtran}
    \usepackage{blindtext}
    \usepackage{booktabs,capt-of}
    \usepackage{graphicx}
    \usepackage{mathtools,amsfonts}

    \begin{document}

    \begin{equation}
    \label{eq:label1}
    \frac{x_n}{y_{HADL}} =
    -\frac{1}{\splitfrac{k_3 N +p_3 (1-N) + {}}{q_2 [k_2 N + p_2 (1-N)] }}
    \end{equation}

    \end{document} 

enter image description here

Edit: another possibility would be to use the medium-sized fractions from nccmath (~ 80 % of \displaystyle):

    \begin{equation}\label{eq; label2}
      \frac{x_n}{y_{HADL}} =
    -\mfrac{1}{[k_3 N +p_3 (1-N)] + q_2 [k_2 N + p_2 (1-N)]}
    \end{equation}

enter image description here

Still another edit: Two other possibilities: one with the fleqn environment from nccmath, which ensures equations start at the left margin, another with the multlined environment from mathtools:

    \begin{fleqn}
      \begin{equation}\label{eq; label2}
    \begin{split}
      \frac{x_n}{y_{HADL}} & = \\[-0.5ex]
    &\quad -\mfrac{1}{[k_3 N +p_3 (1-N)] + q_2 [k_2 N + p_2 (1-N)]}
    \end{split}
    \end{equation}
    \end{fleqn} \bigskip

      \begin{equation}\label{eq; label2}
    \begin{multlined}
      \frac{x_n}{y_{HADL}} = \\[-0.5ex]
    \quad -\mfrac{1}{[k_3 N +p_3 (1-N)] + q_2 [k_2 N + p_2 (1-N)]}
    \end{multlined}
    \end{equation}

enter image description here

3
  • Thanks, the first one doesn't look good to me and I worries about the second case as changing the font, size would probably violating the rules.
    – hana
    Jun 16, 2022 at 10:55
  • @hana; I've added two other possibilities.
    – Bernard
    Jun 16, 2022 at 11:31
  • Moving the minus sign to the begining does look better.
    – hana
    Jun 16, 2022 at 11:41
3

If you are ok with the space, another way is to use sub-expressions with their definitions

enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{kantlipsum}   % \usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts}


\begin{document}
\section{Something}
\kant[1][1]
\begin{align} \label{eq:label1}
    \frac{x_n}{y_{HADL}} &= -\frac{1}{I + q_2 J} \\
    \intertext{with}
    I &= k_3 N + p_3 (1-N), \nonumber \\
    J &= k_2 N + p_2 (1-N). \nonumber
\end{align}

\kant[1][2]
\begin{align} \label{eq:label2}
    \frac{x_n}{y_{HADL}} &= -\frac{1}{K + q_2 L} \\
    \intertext{with}
    K &= k_3 N + p_3 (1-N), \nonumber \\
    L &= k_2 N  + p_2 (1-N). \nonumber
\end{align}

\kant[1][3]
\end{document}
1
  • This is a nice option as well.
    – hana
    Jun 16, 2022 at 10:55
2

Just make it smaller to fit the page (taken from here, example 1.1)

enter image description here

\documentclass[journal]{IEEEtran}
\usepackage{blindtext}
\usepackage{booktabs,capt-of}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts}

\begin{document}
\begin{equation}\label{eq:label1}
\resizebox{.4\textwidth}{!}{
$\frac{x_n}{y_{HADL}} = \frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)]}$}
\end{equation}
\begin{equation}\label{eq:label2}
\resizebox{.4\textwidth}{!}{
$\frac{x_n}{y_{HADL}} = \frac{1}{-[k_3 N   +p_3 (1-N)]  -q_2 [k_2 N  + p_2 (1-N)]}$}
\end{equation}
\end{document}
1
  • 2
    Using \resizebox in this manner can lead to wildly inconsisten font sizes.
    – Mico
    Jun 16, 2022 at 9:43

You must log in to answer this question.

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