4

here is the equation I would like to write but it is not working as it should

enter image description here

Here is what I have tried so far

    \begin{equation} \label{eq:3.2}
     & \[(EQE)= \frac{photons_{out}}{electrons_{in}}\]

     & = \frac{radiant flux / photon energy}{injected current / elementary charge}
        \end{equation}
3
  • Please show a compilable minimal working example (MWE) showing what you have tried so far – fractal Dec 20 '19 at 16:47
  • Nest an amsmath aligned environment in an equation. – Bernard Dec 20 '19 at 16:50
  • You are putting math mode (\[\]) inside math mode (equation). Remove \[ and \]. Also, use \text for photon, out, radiant flux, etc. – fractal Dec 20 '19 at 17:01
5

You are nesting math mode \[ \] in another math environment {equation}. This is a recommended version of your equation.

Some notes:

  • The number should go to the last line of the equation.
  • Use \text from amsmath to display text.
  • Use align from amsmath to align equations on different lines.
  • Don't use numbers in labels. Use meaningful labels for \label.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  \text{EQE}&=\frac{\#\,\text{photons}_{\text{out}}}{\#\,\text{electrons}_\text{in}}\nonumber\\
  &=\frac{\text{radiation flux}/\text{photon energy}}{\text{injected current}/\text{elementary charge}}\nonumber\\
  &=\frac{\Phi_e/E_{\text{ph}}}{I_{\text{in}/e}}=\frac{\Phi_e\times e}{I_{\text{in}\times E_{\text{ph}}}}\nonumber\\
  &=\frac{\pi\times A\times L_{\text{v}}\times e\times \lambda_{\text{average}}}{K_{\text{m}}\times V(\lambda_{\text{peak}})\times I_{\text{in}}\times hc}\label{eq:somename}
\end{align}
\end{document}

enter image description here

3
  • +1 for "Use meaningful labels for \label." – Mico Dec 20 '19 at 17:17
  • 1
    If there's any chance such an expression might appear in a theorem or other italic environment, you want to use either \mathrm or \textup to ensure that the "words" don't become italic. \text follows the upright or italic style of the surrounding text. – barbara beeton Dec 20 '19 at 20:29
  • @barbarabeeton I would say that in an italic environment, I want those text to be italic as well. – fractal Dec 21 '19 at 1:05
5

I would use a single aligned environment inside an equation environment. I would also use \mathrm and \textnormal for words and acronyms.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'aligned' environment
\usepackage{newpxtext,newpxmath} % optional
\numberwithin{equation}{section} % optional

\begin{document}
\setcounter{section}{4}  % just for this example
\setcounter{equation}{4}

\begin{equation} \label{eq:EQE}
\begin{aligned}
\mathrm{EQE}
&= \frac{\textnormal{\#photons}_{\textnormal{out}}}{\textnormal{\#electrons}_{\textnormal{in}}}\\
&= \frac{\textnormal{radiant flux}/\textnormal{photon energy}}{\textnormal{injected current}/\textnormal{elementary charge}}
\end{aligned}
\end{equation}
\end{document} 

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.