3

In the code:

\begin{eqnarray} \text{minimize: } J &=& w_1j_1 + w_2j_2 + w_3j_3 + w_4j_4 + w_5j_5\\ &=& w_1 (\bar{T}_{HLF} - 343K) + w_2(\bar{T}_{HLR} - 300K) + w_3 C_{total} + w_4\dot{m}_{BSI} + w_5\dot{m}_{RSI} \end{eqnarray} 

The second equation &=& w_1... overlaps the equation number on the righthand side, is there anyway to fix that?

3
  • 1
    Please extend your code fragment to complete small documenr (MWE: Minimal Working Example), which we can test as it is. Commented Jun 8, 2024 at 3:42
  • 3
    Welcome to tex.sx. This is an inherent flaw in eqnarray. A better choice would be align from amsmath, which has been designed to avoid the overlap. Commented Jun 8, 2024 at 3:47
  • 1
    @Mico I have withdrawn the statement made. It does indeed seem there is an error with eqnarray. Commented Jun 8, 2024 at 6:01

1 Answer 1

6

There are two issues with your code. First, you're using the near-deprecated eqnarray environment. Second, the material in the second row is simply too long to fit on one line.

Regarding the first issue, let me provide the following quote from the posting eqnarray vs align:

Although eqnarray may seem to work "well enough", Avoid eqnarray! Avoid eqnarray! Avoid eqnarray!

Please follow the links shown above to inform yourself about why you really shouldn't be using eqnarray environments. The upshot? Load the amsmath package and use align environments instead. Fortunately, making the transition is really quite easy; in most cases, it'll consist of (a) changing the environment names from eqnarray to align (or from eqnarray* to align*) and (b) changing all instances of &=& to &=.

Regarding the second issue: I suggest you insert a line break after the third additive term on the right-hand side. I would also render most of the subscript terms in upright lettering.

enter image description here

\documentclass{article} \usepackage{amsmath} \newcommand\vn[1]{\mathrm{#1}} % "vn": short for "variable name" \begin{document} \begin{align} \textup{minimize: } J &= w_1j_1 + w_2j_2 + w_3j_3 + w_4j_4 + w_5j_5\\ &= w_1 (\bar{T}_{\vn{HLF}} - 343K) + w_2(\bar{T}_{\vn{HLR}} - 300K) + w_3 C_{\mathrm{total}} \nonumber\\ &\quad+ w_4\dot{m}_{\vn{BSI}} + w_5\dot{m}_{\vn{RSI}} \end{align} \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.