1

My code as follows:

\documentclass{book}
\usepackage{amsmath}
\begin{document}

Test
\begin{equation}
\left.\begin{array}{c} \displaystyle\sum\limits_{t=0}^{T}\pi
\rho^{t}\overset{\textrm{add and subtract 2nd and 3rd
terms}}{\overbrace{=\displaystyle\sum\limits_{t=0}^{T}\pi \rho
^{t}+\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho
^{t}-\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho ^{t}}}\ \
\overset{\textrm{combine first two
terms}}{\overbrace{=\displaystyle\sum\limits_{t=0}^{\infty }\pi
\rho ^{t}-\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho^{t}}}
\\\noalign{\vskip6pt}
\hspace*{-2pc}\underset{\textrm{factor out }\rho^{T+1}\textrm{ from
second term}}{\underbrace{=\displaystyle\sum\limits_{t=0}^{\infty
}\pi \rho^{t}-\rho ^{T+1}\displaystyle\sum\limits_{t=0}^{\infty
}\pi \rho ^{t}}}\ \ \underset{\begin{smallmatrix}\textrm{use formula
for sum of}\\ \textrm{geometric
series}\end{smallmatrix}}{\underbrace{=\frac{1-\rho^{T+1}}{1-\rho
}\pi }}.
\end{array}\right. \label{eq formula geometric series}
\end{equation}

\end{document}

And the output came as:

enter image description here

I am converting this to HTML with MathML through the tag

htlatex test "xhtml,mathml,mathml-" " -cunihft" "-cvalidate -p"

Conversion doesn't shows any errors, but the limits for the symbol sum changed to side limits, but I should match the MathML output same as TeX output, i.e., upper and lower limits should as is. Please advise...

enter image description here

2
  • 2
    Which web browser do you use to view the html output? Firefix? Chrome? Safari? Something else? Various browsers handle mathml code in surprisingly different ways...
    – Mico
    Commented Nov 11, 2017 at 7:52
  • @Mico I'm using Mozilla for viewing...
    – MadyYuvi
    Commented Nov 11, 2017 at 7:59

1 Answer 1

1

(too long for a comment, hence posted as an answer)

Your math code is rather complex -- dare I say, needlessly complex? Please give the following, modified and simplified form of your code a try. Do you still experience the discrepancy issues described in your query?

enter image description here

\documentclass{book}
\usepackage{amsmath}
% struts for to even out vertical spacing
\newcommand\BigStrutA{\vphantom{\sum_{t=0}^{T}}}
\newcommand\BigStrutB{\vphantom{\sum_{t=0}^{\infty}}}
\begin{document}

Proposed new form:
\begin{equation}
\begin{split}
\sum_{t=0}^{T} \pi\rho^{t} 
&={}
\overbrace{\sum_{t=0}^{T} \pi\rho^{t}
   +\sum_{t=T+1}^\infty \pi\rho^{t}
   -\sum_{t=T+1}^\infty \pi\rho^{t}}%
^{\textrm{add and subtract 2nd and 3rd terms}} 
{}={} 
\overbrace{\sum_{t=0}^\infty \pi\rho^{t}
   -\sum_{t=T+1}^\infty \pi\rho^{t}\BigStrutA}%
^{\textrm{combine first two terms}}
\\
&={}
\underbrace{\sum_{t=0}^{\infty} \pi\rho^{t}
   -\rho^{T+1} \sum_{t=0}^{\infty} \pi\rho^{t}}%
_{\substack{\textrm{factor out $\rho^{T+1}$}\\
            \textrm{from 2nd term}}}
{}={}
\underbrace{\frac{1-\rho^{T+1}}{1-\rho}\,\pi\BigStrutB}%
_{\substack{\textrm{formula for}\\
            \textrm{sum of geo-\strut}\\ 
            \textrm{metric series}}}.
\end{split}
\label{eq proposed new form}
\end{equation}

\medskip
For comparison, the orginal form:
\begin{equation}
\left.\begin{array}{c} \displaystyle\sum\limits_{t=0}^{T}\pi
\rho^{t}\overset{\textrm{add and subtract 2nd and 3rd
terms}}{\overbrace{=\displaystyle\sum\limits_{t=0}^{T}\pi \rho
^{t}+\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho
^{t}-\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho ^{t}}}\ \
\overset{\textrm{combine first two
terms}}{\overbrace{=\displaystyle\sum\limits_{t=0}^{\infty }\pi
\rho ^{t}-\displaystyle\sum\limits_{t=T+1}^{\infty }\pi \rho^{t}}}
\\\noalign{\vskip6pt}
\hspace*{-2pc}\underset{\textrm{factor out }\rho^{T+1}\textrm{ from
second term}}{\underbrace{=\displaystyle\sum\limits_{t=0}^{\infty
}\pi \rho^{t}-\rho ^{T+1}\displaystyle\sum\limits_{t=0}^{\infty
}\pi \rho ^{t}}}\ \ \underset{\begin{smallmatrix}\textrm{use formula
for sum of}\\ \textrm{geometric
series}\end{smallmatrix}}{\underbrace{=\frac{1-\rho^{T+1}}{1-\rho
}\pi }}.
\end{array}\right. \label{eq orig form}
\end{equation}

\end{document}
5
  • Your suggestion works in TeX output, but in HTML+MathML same error only....
    – MadyYuvi
    Commented Nov 11, 2017 at 7:58
  • @MadyYuvi - It turns out that the "error" is caused by the browser, not the LaTeX code. To wit, if I run your compile sequence and view the html file with Safari instead of Mozilla/Firefox, the summation bounds are placed correctly. Unfortunately, the horizontal braces are not displayed correctly under Safari. In contrast, Mozilla/Firefox actually displays the braces correctly (even though it has problems with displaying the summation bounds).
    – Mico
    Commented Nov 11, 2017 at 8:40
  • 2
    to fix mathml rendering issues in various browsers, it is best to use MathJax for rendering, like in this answer of mine: tex.stackexchange.com/a/362207/2891
    – michal.h21
    Commented Nov 11, 2017 at 9:45
  • 1
    @MadyYuvi it seems that browsers just choose to render it this way, even if MathJax is used.
    – michal.h21
    Commented Nov 11, 2017 at 19:03
  • @michal.h21 and Mico, thanks a lot for both of your suggestions...
    – MadyYuvi
    Commented Nov 13, 2017 at 5:29

You must log in to answer this question.

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