6

How to write this equation in latex?

I wrote this code but not getting it.

enter image description here

E_{t-2}P_t=\frac{1}{2}(E_{t-2}m_t+\underbrace{E_{t-2}v_t}_\textrm{=0}-\underbrace{E_{t-2}u_t}_\textrm{=0}+(\frac{(1-\zeta )}{2})(\underbrace{E_{t-2}E_{t-1}P_t}_\textrm{=E_{t-2}}+\underbrace{E_{t-2}E_{t-2}P_t}_\textrm{=E_{t-2}})+(\frac{\zeta }{2})(E_{t-2}P_{t-1}+E_{t-2}P_{t-2})
  • 1
    Please add some \usepackages to make your code compilable. – user156344 May 24 at 5:20
  • Can you elaborate a bit more? What kind of '\usepackage' should I use? – Henam May 24 at 5:26
  • 1
    Anyway you already got an answer, but this is my note for your future questions: if you are using Mathjax, do not ask it here as Mathjax is off topic on this site. Sometimes we need a compilable code to reproduce the issue, and without it we can hardly do anything. – user156344 May 24 at 5:29
  • Hey, no offence, but I'm using LaTex only. – Henam May 24 at 5:33
  • I believe JouleV is asking for an MWE. The point is if I copy and paste the code you have written into a blank .tex file and try to compile it, it won't work. So then I have to do the job of adding a template, with a \documentclass and perhaps \usepackage{amsmath} and so on, \begin{document} etc. and you could have saved me that tiny chore. It's polite and helps us to help you. – Au101 May 24 at 20:56
8

You're almost there. Instead of

\underbrace{E_{t-2}v_t}_\textrm{=0}

type

\underbrace{E_{t-2}v_t}_{=0}

etc


I would also introduce some line breaks in the long equation.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\E}{E}
\begin{document}
\begin{multline*}
\E_{t-2}P_t=
\frac{1}{2}\Bigl(\E_{t-2}m_t
+\underbrace{\E_{t-2}v_t}_{=0}
-\underbrace{\E_{t-2}u_t}_{=0}\Bigr) \\
+\frac{(1-\zeta )}{2}\Bigl(
\underbrace{\E_{t-2}\E_{t-1}P_t}_{=\E_{t-2}}+
\underbrace{\E_{t-2}\E_{t-2}P_t}_{=\E_{t-2}}\Bigr) \\
+\frac{\zeta }{2}\Bigl(\E_{t-2}P_{t-1}+\E_{t-2}P_{t-2}\Bigr)
\end{multline*}
\end{document}
4

You can use Mathpix to generate LaTeX code for any mathematical equation by simply taking a screenshot of the equation. It will save you tons of time in future like it did for me after I discovered it!

Mathpix demo

  • 4
    It is pretty cool, but I never recommend automated generators for LaTeX. They may give nice results, but never good results. – user156344 May 24 at 6:23
  • 2
    I totally agree. I too never rely completely on automated generators, but I do find it much easier to tweak the codes rather than building it up from the scratch. Also, these codes help you learn LaTeX as well! – Ashirwad May 24 at 6:48
  • 1
    You know, I have to upvote your answer for the last sentence of your comment – user156344 May 24 at 6:50
  • 1
    Thanks! I can't thank the developers of this software enough for helping me prepare a report with too many equations in it with significantly lesser efforts as well as enriching my LaTeX vocabulary. – Ashirwad May 24 at 7:05
  • 1
    Strictly speaking, this posting does not address the OP's question. Why? You copied-and-pasted a screenshot from my answer -- which, ahem, is already known to be based on valid LaTeX code -- and showed that the software can generate something that resembles decent, though not solid, LaTeX code. (Why "not solid"? Well, for one, note the use of $$ to start and stop an unnumbered displayed equation -- definitely not good practice for a LaTeX document.) It would be more impressive if you demonstrated that working with the OP's screenshot led to a satisfactory chunk of LaTeX code. – Mico May 24 at 16:10

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.