public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Pandoc With MathJax
@ 2015-03-12 12:41 MikeyD
       [not found] ` <fc10b210-0fd7-49e6-838a-463f2edc8efb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: MikeyD @ 2015-03-12 12:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


[-- Attachment #1.1: Type: text/plain, Size: 11471 bytes --]

K, I've run into a bit of a dead end looking on the distributions, etc. for 
support on a problem.  My intern and I are working to translate the 
NIST/SEMATECH Statistics handbook (link 
<http://www.itl.nist.gov/div898/handbook/index.htm>) from html to latex.  
We are having difficulties in getting pandoc to go from html with MathJax 
back to LaTeX.  Our example file that we are working with as a test case is 
the Levene's test (link 
<http://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm>). I found 
an example of using some additional commands to clean things up a little 
bit, link 
<http://stackoverflow.com/questions/11338049/how-to-convert-html-with-mathjax-into-latex-using-pandoc>, 
but the result doesn't appear to work properly in our case.  Code snippets 
taken from the Levene's test linked above are below as well as the pandoc 
--version output.  

Thanks in advance for the help!

*MathJax Code Snippet*
<td>
                <span class="MathJax" id="MathJax-Element-1-Frame">
                  <nobr>
                    <span class="math" id="MathJax-Span-1" role="math" style
="width: 8.741em; display: inline-block;">
                      <span style="display: inline-block; position: relative
; width: 8.498em; height: 0px; font-size: 103%;">
                        <span style="position: absolute; clip: rect(3.037em 
1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;">


                          <span class="mrow" id="MathJax-Span-2">
                            <span class="msubsup" id="MathJax-Span-3">
                              <span style="display: inline-block; position: 
relative; width: 1.035em; height: 0px;">
                                <span style="position: absolute; clip: rect(
3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">


                                  <span class="mi" id="MathJax-Span-4" style
="font-family: MathJax_Math-italic;">ü/span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
                                  <span class="texatom" id="MathJax-Span-5">
                                    <span class="mrow" id="MathJax-Span-6">
                                      <span class="mn" id="MathJax-Span-7"
                                      style="font-size: 70.7%; font-family: 
MathJax_Main;">2</span>
                                    </span>
                                  </span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
                                  <span class="texatom" id="MathJax-Span-8">
                                    <span class="mrow" id="MathJax-Span-9">
                                      <span class="mn" id="MathJax-Span-10"
                                      style="font-size: 70.7%; font-family: 
MathJax_Main;">1</span>
                                    </span>
                                  </span>
                                </span>
                              </span>
                            </span>
                            <span class="mo" id="MathJax-Span-11"
                            style="font-family: MathJax_Main; padding-left: 
0.306em;">=</span>
                            <span class="msubsup" id="MathJax-Span-12" style
="padding-left: 0.306em;">
                              <span style="display: inline-block; position: 
relative; width: 1.035em; height: 0px;">
                                <span style="position: absolute; clip: rect(
3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
                                  <span class="mi" id="MathJax-Span-13" 
style="font-family: MathJax_Math-italic;">ü/span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
                                  <span class="texatom" id="MathJax-Span-14"
>
                                    <span class="mrow" id="MathJax-Span-15">
                                      <span class="mn" id="MathJax-Span-16"
                                      style="font-size: 70.7%; font-family: 
MathJax_Main;">2</span>
                                    </span>
                                  </span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
                                  <span class="texatom" id="MathJax-Span-17"
>
                                    <span class="mrow" id="MathJax-Span-18">
                                      <span class="mn" id="MathJax-Span-19"
                                      style="font-size: 70.7%; font-family: 
MathJax_Main;">2</span>
                                    </span>
                                  </span>
                                </span>
                              </span>
                            </span>
                            <span class="mo" id="MathJax-Span-20"
                            style="font-family: MathJax_Main; padding-left: 
0.306em;">=</span>
                            <span class="mo" id="MathJax-Span-21"
                            style="font-family: MathJax_Main; padding-left: 
0.306em;">…</span>
                            <span class="mo" id="MathJax-Span-22"
                            style="font-family: MathJax_Main; padding-left: 
0.306em;">=</span>
                            <span class="msubsup" id="MathJax-Span-23" style
="padding-left: 0.306em;">
                              <span style="display: inline-block; position: 
relative; width: 1.035em; height: 0px;">
                                <span style="position: absolute; clip: rect(
3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
                                  <span class="mi" id="MathJax-Span-24" 
style="font-family: MathJax_Math-italic;">ü/span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
                                  <span class="texatom" id="MathJax-Span-25"
>
                                    <span class="mrow" id="MathJax-Span-26">
                                      <span class="mn" id="MathJax-Span-27"
                                      style="font-size: 70.7%; font-family: 
MathJax_Main;">2</span>
                                    </span>
                                  </span>
                                </span>
                                <span style="position: absolute; clip: rect(
3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
                                  <span class="texatom" id="MathJax-Span-28"
>
                                    <span class="mrow" id="MathJax-Span-29">
                                      <span class="mi" id="MathJax-Span-30"
                                      style="font-size: 70.7%; font-family: 
MathJax_Math-italic;">k</span>
                                    </span>
                                  </span>
                                </span>
                              </span>
                            </span>
                          </span>
                        </span>
                      </span>
                    </span>
                  </nobr>
                </span>
                <script type="math/tex" id="MathJax-Element-1">
 \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2} 
</script>
</td>

*Pandoc Command (less file names)*

pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex -s -o


*Actual Latex Output*
\begin{minipage}[t]{0.47\columnwidth}\raggedright\strut
{}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}}
\strut\end{minipage}\tabularnewline
 
*Expected LaTeX Output (maybe with the minipage commands above)*
\sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}


*Pandoc --version Output*



*pandoc.exe 1.13.2Compiled with texmath 0.8.0.1, highlighting-kate 
0.5.11.1.Syntax highlighting is supported for the following languages:    
abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, 
c,    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, 
css,    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, 
doxygenlua, dtd,    eiffel, email, erlang, fasm, fortran, fsharp, gcc, 
glsl, gnuassembler, go,    haskell, haxe, html, ini, isocpp, java, javadoc, 
javascript, json, jsp,    julia, latex, lex, lilypond, literatecurry, 
literatehaskell, lua, m4,    makefile, mandoc, markdown, mathematica, 
matlab, maxima, mediawiki,    metafont, mips, modelines, modula2, modula3, 
monobasic, nasm, noweb,    objectivec, objectivecpp, ocaml, octave, opencl, 
pascal, perl, php, pike,    postscript, prolog, pure, python, r, relaxng, 
relaxngcompact, rest, rhtml,    roff, ruby, rust, scala, scheme, sci, sed, 
sgml, sql, sqlmysql,    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, 
xml, xorg, xslt, xul,    yacc, yaml, zshDefault user data directory: 
C:\Users\manderso\AppData\Roaming\pandocCopyright (C) 2006-2014 John 
MacFarlaneWeb:  http://johnmacfarlane.net/pandocThis is free software; see 
the source for copying conditions.There is no warranty, not even for 
merchantability or fitnessfor a particular purpose.*

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 101981 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pandoc With MathJax
       [not found] ` <fc10b210-0fd7-49e6-838a-463f2edc8efb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-12 17:11   ` Matthew Pickering
       [not found]     ` <CALuQ0m-tbNzJvjkCLsMiLDywvEsR6arXAywFVg5azhf+aRC5HQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Pickering @ 2015-03-12 17:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

This website is very strange. It seems like MathJax preprocesses
MathML into this weird group of spans rather than relying on a
browsers native MathML rendering. Pandoc can handle MathML just fine
but I'm afraid there is no support for this garbled input. If you can
get hold of the original document source then I feel like you could do
much better.

Matt

On Thu, Mar 12, 2015 at 12:41 PM, MikeyD <michael.danderson-BUHhN+a2lJ4@public.gmane.org> wrote:
> K, I've run into a bit of a dead end looking on the distributions, etc. for
> support on a problem.  My intern and I are working to translate the
> NIST/SEMATECH Statistics handbook (link) from html to latex.  We are having
> difficulties in getting pandoc to go from html with MathJax back to LaTeX.
> Our example file that we are working with as a test case is the Levene's
> test (link). I found an example of using some additional commands to clean
> things up a little bit, link, but the result doesn't appear to work properly
> in our case.  Code snippets taken from the Levene's test linked above are
> below as well as the pandoc --version output.
>
> Thanks in advance for the help!
>
> MathJax Code Snippet
> <td>
>                 <span class="MathJax" id="MathJax-Element-1-Frame">
>                   <nobr>
>                     <span class="math" id="MathJax-Span-1" role="math"
> style="width: 8.741em; display: inline-block;">
>                       <span style="display: inline-block; position:
> relative; width: 8.498em; height: 0px; font-size: 103%;">
>                         <span style="position: absolute; clip: rect(3.037em
> 1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;">
>
>
>                           <span class="mrow" id="MathJax-Span-2">
>                             <span class="msubsup" id="MathJax-Span-3">
>                               <span style="display: inline-block; position:
> relative; width: 1.035em; height: 0px;">
>                                 <span style="position: absolute; clip:
> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>
>
>                                   <span class="mi" id="MathJax-Span-4"
> style="font-family: MathJax_Math-italic;">ü/span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>                                   <span class="texatom" id="MathJax-Span-5">
>                                     <span class="mrow" id="MathJax-Span-6">
>                                       <span class="mn" id="MathJax-Span-7"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Main;">2</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>                                   <span class="texatom" id="MathJax-Span-8">
>                                     <span class="mrow" id="MathJax-Span-9">
>                                       <span class="mn" id="MathJax-Span-10"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Main;">1</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                               </span>
>                             </span>
>                             <span class="mo" id="MathJax-Span-11"
>                             style="font-family: MathJax_Main; padding-left:
> 0.306em;">=</span>
>                             <span class="msubsup" id="MathJax-Span-12"
> style="padding-left: 0.306em;">
>                               <span style="display: inline-block; position:
> relative; width: 1.035em; height: 0px;">
>                                 <span style="position: absolute; clip:
> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>                                   <span class="mi" id="MathJax-Span-13"
> style="font-family: MathJax_Math-italic;">ü/span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>                                   <span class="texatom"
> id="MathJax-Span-14">
>                                     <span class="mrow" id="MathJax-Span-15">
>                                       <span class="mn" id="MathJax-Span-16"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Main;">2</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>                                   <span class="texatom"
> id="MathJax-Span-17">
>                                     <span class="mrow" id="MathJax-Span-18">
>                                       <span class="mn" id="MathJax-Span-19"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Main;">2</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                               </span>
>                             </span>
>                             <span class="mo" id="MathJax-Span-20"
>                             style="font-family: MathJax_Main; padding-left:
> 0.306em;">=</span>
>                             <span class="mo" id="MathJax-Span-21"
>                             style="font-family: MathJax_Main; padding-left:
> 0.306em;">…</span>
>                             <span class="mo" id="MathJax-Span-22"
>                             style="font-family: MathJax_Main; padding-left:
> 0.306em;">=</span>
>                             <span class="msubsup" id="MathJax-Span-23"
> style="padding-left: 0.306em;">
>                               <span style="display: inline-block; position:
> relative; width: 1.035em; height: 0px;">
>                                 <span style="position: absolute; clip:
> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>                                   <span class="mi" id="MathJax-Span-24"
> style="font-family: MathJax_Math-italic;">ü/span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>                                   <span class="texatom"
> id="MathJax-Span-25">
>                                     <span class="mrow" id="MathJax-Span-26">
>                                       <span class="mn" id="MathJax-Span-27"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Main;">2</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                                 <span style="position: absolute; clip:
> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>                                   <span class="texatom"
> id="MathJax-Span-28">
>                                     <span class="mrow" id="MathJax-Span-29">
>                                       <span class="mi" id="MathJax-Span-30"
>                                       style="font-size: 70.7%; font-family:
> MathJax_Math-italic;">k</span>
>                                     </span>
>                                   </span>
>                                 </span>
>                               </span>
>                             </span>
>                           </span>
>                         </span>
>                       </span>
>                     </span>
>                   </nobr>
>                 </span>
>                 <script type="math/tex" id="MathJax-Element-1">
>  \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
> </script>
> </td>
>
> Pandoc Command (less file names)
>
> pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex -s -o
>
>
> Actual Latex Output
> \begin{minipage}[t]{0.47\columnwidth}\raggedright\strut
> {}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}}
> \strut\end{minipage}\tabularnewline
>
> Expected LaTeX Output (maybe with the minipage commands above)
> \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
>
>
> Pandoc --version Output
> pandoc.exe 1.13.2
>
> Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1.
> Syntax highlighting is supported for the following languages:
>     abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo,
> c,
>     changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
>     curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua,
> dtd,
>     eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler,
> go,
>     haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, jsp,
>     julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, m4,
>     makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
>     metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
>     objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php,
> pike,
>     postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest,
> rhtml,
>     roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
>     sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
>     yacc, yaml, zsh
> Default user data directory: C:\Users\manderso\AppData\Roaming\pandoc
> Copyright (C) 2006-2014 John MacFarlane
> Web:  http://johnmacfarlane.net/pandoc
> This is free software; see the source for copying conditions.
> There is no warranty, not even for merchantability or fitness
> for a particular purpose.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m-tbNzJvjkCLsMiLDywvEsR6arXAywFVg5azhf%2BaRC5HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pandoc With MathJax
       [not found]     ` <CALuQ0m-tbNzJvjkCLsMiLDywvEsR6arXAywFVg5azhf+aRC5HQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-03-12 17:18       ` Matthew Pickering
       [not found]         ` <CALuQ0m-H+S4sL+5QtxZXi4jh0BnpbP+Q6VWmh_Z=mQo_hZmh7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Pickering @ 2015-03-12 17:18 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

OK -- I just realised you could right click on the Math and get them
to render using the browsers native MathML support. Chucking pandoc at
the page still doesn't work (more investigation needed) but attempting
to convert the Math element you mention gives the following result.

"\\mathit{\\sigma}_{1}^{2} = \\mathit{\\sigma}_{2}^{2} = \\ldots =
\\mathit{\\sigma}_{k}^{2}"

Which is close to what you want but.. it is better to notice that the
website already contains the necessary LaTeX embedded in the MathML.

<annotation encoding="application/x-tex">\sigma_{1}^{2} =
\sigma_{2}^{2} = \ldots =
\sigma_{k}^{2}</annotation></semantics></math>

So I would recommend bypassing pandoc and just using that.

Hope that helps.

Matt



On Thu, Mar 12, 2015 at 5:11 PM, Matthew Pickering
<matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> This website is very strange. It seems like MathJax preprocesses
> MathML into this weird group of spans rather than relying on a
> browsers native MathML rendering. Pandoc can handle MathML just fine
> but I'm afraid there is no support for this garbled input. If you can
> get hold of the original document source then I feel like you could do
> much better.
>
> Matt
>
> On Thu, Mar 12, 2015 at 12:41 PM, MikeyD <michael.danderson-BUHhN+a2lJ4@public.gmane.org> wrote:
>> K, I've run into a bit of a dead end looking on the distributions, etc. for
>> support on a problem.  My intern and I are working to translate the
>> NIST/SEMATECH Statistics handbook (link) from html to latex.  We are having
>> difficulties in getting pandoc to go from html with MathJax back to LaTeX.
>> Our example file that we are working with as a test case is the Levene's
>> test (link). I found an example of using some additional commands to clean
>> things up a little bit, link, but the result doesn't appear to work properly
>> in our case.  Code snippets taken from the Levene's test linked above are
>> below as well as the pandoc --version output.
>>
>> Thanks in advance for the help!
>>
>> MathJax Code Snippet
>> <td>
>>                 <span class="MathJax" id="MathJax-Element-1-Frame">
>>                   <nobr>
>>                     <span class="math" id="MathJax-Span-1" role="math"
>> style="width: 8.741em; display: inline-block;">
>>                       <span style="display: inline-block; position:
>> relative; width: 8.498em; height: 0px; font-size: 103%;">
>>                         <span style="position: absolute; clip: rect(3.037em
>> 1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;">
>>
>>
>>                           <span class="mrow" id="MathJax-Span-2">
>>                             <span class="msubsup" id="MathJax-Span-3">
>>                               <span style="display: inline-block; position:
>> relative; width: 1.035em; height: 0px;">
>>                                 <span style="position: absolute; clip:
>> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>>
>>
>>                                   <span class="mi" id="MathJax-Span-4"
>> style="font-family: MathJax_Math-italic;">ü/span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>>                                   <span class="texatom" id="MathJax-Span-5">
>>                                     <span class="mrow" id="MathJax-Span-6">
>>                                       <span class="mn" id="MathJax-Span-7"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Main;">2</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>>                                   <span class="texatom" id="MathJax-Span-8">
>>                                     <span class="mrow" id="MathJax-Span-9">
>>                                       <span class="mn" id="MathJax-Span-10"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Main;">1</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                               </span>
>>                             </span>
>>                             <span class="mo" id="MathJax-Span-11"
>>                             style="font-family: MathJax_Main; padding-left:
>> 0.306em;">=</span>
>>                             <span class="msubsup" id="MathJax-Span-12"
>> style="padding-left: 0.306em;">
>>                               <span style="display: inline-block; position:
>> relative; width: 1.035em; height: 0px;">
>>                                 <span style="position: absolute; clip:
>> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>>                                   <span class="mi" id="MathJax-Span-13"
>> style="font-family: MathJax_Math-italic;">ü/span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>>                                   <span class="texatom"
>> id="MathJax-Span-14">
>>                                     <span class="mrow" id="MathJax-Span-15">
>>                                       <span class="mn" id="MathJax-Span-16"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Main;">2</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>>                                   <span class="texatom"
>> id="MathJax-Span-17">
>>                                     <span class="mrow" id="MathJax-Span-18">
>>                                       <span class="mn" id="MathJax-Span-19"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Main;">2</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                               </span>
>>                             </span>
>>                             <span class="mo" id="MathJax-Span-20"
>>                             style="font-family: MathJax_Main; padding-left:
>> 0.306em;">=</span>
>>                             <span class="mo" id="MathJax-Span-21"
>>                             style="font-family: MathJax_Main; padding-left:
>> 0.306em;">…</span>
>>                             <span class="mo" id="MathJax-Span-22"
>>                             style="font-family: MathJax_Main; padding-left:
>> 0.306em;">=</span>
>>                             <span class="msubsup" id="MathJax-Span-23"
>> style="padding-left: 0.306em;">
>>                               <span style="display: inline-block; position:
>> relative; width: 1.035em; height: 0px;">
>>                                 <span style="position: absolute; clip:
>> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 0.003em;">
>>                                   <span class="mi" id="MathJax-Span-24"
>> style="font-family: MathJax_Math-italic;">ü/span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 0.61em;">
>>                                   <span class="texatom"
>> id="MathJax-Span-25">
>>                                     <span class="mrow" id="MathJax-Span-26">
>>                                       <span class="mn" id="MathJax-Span-27"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Main;">2</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                                 <span style="position: absolute; clip:
>> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 0.549em;">
>>                                   <span class="texatom"
>> id="MathJax-Span-28">
>>                                     <span class="mrow" id="MathJax-Span-29">
>>                                       <span class="mi" id="MathJax-Span-30"
>>                                       style="font-size: 70.7%; font-family:
>> MathJax_Math-italic;">k</span>
>>                                     </span>
>>                                   </span>
>>                                 </span>
>>                               </span>
>>                             </span>
>>                           </span>
>>                         </span>
>>                       </span>
>>                     </span>
>>                   </nobr>
>>                 </span>
>>                 <script type="math/tex" id="MathJax-Element-1">
>>  \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
>> </script>
>> </td>
>>
>> Pandoc Command (less file names)
>>
>> pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex -s -o
>>
>>
>> Actual Latex Output
>> \begin{minipage}[t]{0.47\columnwidth}\raggedright\strut
>> {}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}}
>> \strut\end{minipage}\tabularnewline
>>
>> Expected LaTeX Output (maybe with the minipage commands above)
>> \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
>>
>>
>> Pandoc --version Output
>> pandoc.exe 1.13.2
>>
>> Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1.
>> Syntax highlighting is supported for the following languages:
>>     abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo,
>> c,
>>     changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
>>     curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua,
>> dtd,
>>     eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler,
>> go,
>>     haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, jsp,
>>     julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, m4,
>>     makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
>>     metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
>>     objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php,
>> pike,
>>     postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest,
>> rhtml,
>>     roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
>>     sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
>>     yacc, yaml, zsh
>> Default user data directory: C:\Users\manderso\AppData\Roaming\pandoc
>> Copyright (C) 2006-2014 John MacFarlane
>> Web:  http://johnmacfarlane.net/pandoc
>> This is free software; see the source for copying conditions.
>> There is no warranty, not even for merchantability or fitness
>> for a particular purpose.
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m-H%2BS4sL%2B5QtxZXi4jh0BnpbP%2BQ6VWmh_Z%3DmQo_hZmh7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pandoc With MathJax
       [not found]         ` <CALuQ0m-H+S4sL+5QtxZXi4jh0BnpbP+Q6VWmh_Z=mQo_hZmh7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-03-12 18:03           ` MikeyD
       [not found]             ` <ac09a73e-8fda-4ea3-ac0f-18520a7102b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: MikeyD @ 2015-03-12 18:03 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


[-- Attachment #1.1: Type: text/plain, Size: 15123 bytes --]

Would love to do that, but I need the balance of the document formatted for 
LaTeX compiling... we are also looking into this in general as part of a 
collaboration aimed at making an ePub version of the site available as a 
book for people.  Since there is an embedded LaTeX equation, is there a way 
to just strip out the crud and then process with pandoc?

Best,

M

On Thursday, March 12, 2015 at 1:18:23 PM UTC-4, Matthew Pickering wrote:
>
> OK -- I just realised you could right click on the Math and get them 
> to render using the browsers native MathML support. Chucking pandoc at 
> the page still doesn't work (more investigation needed) but attempting 
> to convert the Math element you mention gives the following result. 
>
> "\\mathit{\\sigma}_{1}^{2} = \\mathit{\\sigma}_{2}^{2} = \\ldots = 
> \\mathit{\\sigma}_{k}^{2}" 
>
> Which is close to what you want but.. it is better to notice that the 
> website already contains the necessary LaTeX embedded in the MathML. 
>
> <annotation encoding="application/x-tex">\sigma_{1}^{2} = 
> \sigma_{2}^{2} = \ldots = 
> \sigma_{k}^{2}</annotation></semantics></math> 
>
> So I would recommend bypassing pandoc and just using that. 
>
> Hope that helps. 
>
> Matt 
>
>
>
> On Thu, Mar 12, 2015 at 5:11 PM, Matthew Pickering 
> <matthewt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> wrote: 
> > This website is very strange. It seems like MathJax preprocesses 
> > MathML into this weird group of spans rather than relying on a 
> > browsers native MathML rendering. Pandoc can handle MathML just fine 
> > but I'm afraid there is no support for this garbled input. If you can 
> > get hold of the original document source then I feel like you could do 
> > much better. 
> > 
> > Matt 
> > 
> > On Thu, Mar 12, 2015 at 12:41 PM, MikeyD <michael....-BUHhN+a2lJ4@public.gmane.org 
> <javascript:>> wrote: 
> >> K, I've run into a bit of a dead end looking on the distributions, etc. 
> for 
> >> support on a problem.  My intern and I are working to translate the 
> >> NIST/SEMATECH Statistics handbook (link) from html to latex.  We are 
> having 
> >> difficulties in getting pandoc to go from html with MathJax back to 
> LaTeX. 
> >> Our example file that we are working with as a test case is the 
> Levene's 
> >> test (link). I found an example of using some additional commands to 
> clean 
> >> things up a little bit, link, but the result doesn't appear to work 
> properly 
> >> in our case.  Code snippets taken from the Levene's test linked above 
> are 
> >> below as well as the pandoc --version output. 
> >> 
> >> Thanks in advance for the help! 
> >> 
> >> MathJax Code Snippet 
> >> <td> 
> >>                 <span class="MathJax" id="MathJax-Element-1-Frame"> 
> >>                   <nobr> 
> >>                     <span class="math" id="MathJax-Span-1" role="math" 
> >> style="width: 8.741em; display: inline-block;"> 
> >>                       <span style="display: inline-block; position: 
> >> relative; width: 8.498em; height: 0px; font-size: 103%;"> 
> >>                         <span style="position: absolute; clip: 
> rect(3.037em 
> >> 1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;"> 
> >> 
> >> 
> >>                           <span class="mrow" id="MathJax-Span-2"> 
> >>                             <span class="msubsup" id="MathJax-Span-3"> 
> >>                               <span style="display: inline-block; 
> position: 
> >> relative; width: 1.035em; height: 0px;"> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> 0.003em;"> 
> >> 
> >> 
> >>                                   <span class="mi" id="MathJax-Span-4" 
> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> 0.61em;"> 
> >>                                   <span class="texatom" 
> id="MathJax-Span-5"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-6"> 
> >>                                       <span class="mn" 
> id="MathJax-Span-7" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Main;">2</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> 0.549em;"> 
> >>                                   <span class="texatom" 
> id="MathJax-Span-8"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-9"> 
> >>                                       <span class="mn" 
> id="MathJax-Span-10" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Main;">1</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                               </span> 
> >>                             </span> 
> >>                             <span class="mo" id="MathJax-Span-11" 
> >>                             style="font-family: MathJax_Main; 
> padding-left: 
> >> 0.306em;">=</span> 
> >>                             <span class="msubsup" id="MathJax-Span-12" 
> >> style="padding-left: 0.306em;"> 
> >>                               <span style="display: inline-block; 
> position: 
> >> relative; width: 1.035em; height: 0px;"> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> 0.003em;"> 
> >>                                   <span class="mi" id="MathJax-Span-13" 
> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> 0.61em;"> 
> >>                                   <span class="texatom" 
> >> id="MathJax-Span-14"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-15"> 
> >>                                       <span class="mn" 
> id="MathJax-Span-16" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Main;">2</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> 0.549em;"> 
> >>                                   <span class="texatom" 
> >> id="MathJax-Span-17"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-18"> 
> >>                                       <span class="mn" 
> id="MathJax-Span-19" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Main;">2</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                               </span> 
> >>                             </span> 
> >>                             <span class="mo" id="MathJax-Span-20" 
> >>                             style="font-family: MathJax_Main; 
> padding-left: 
> >> 0.306em;">=</span> 
> >>                             <span class="mo" id="MathJax-Span-21" 
> >>                             style="font-family: MathJax_Main; 
> padding-left: 
> >> 0.306em;">…</span> 
> >>                             <span class="mo" id="MathJax-Span-22" 
> >>                             style="font-family: MathJax_Main; 
> padding-left: 
> >> 0.306em;">=</span> 
> >>                             <span class="msubsup" id="MathJax-Span-23" 
> >> style="padding-left: 0.306em;"> 
> >>                               <span style="display: inline-block; 
> position: 
> >> relative; width: 1.035em; height: 0px;"> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> 0.003em;"> 
> >>                                   <span class="mi" id="MathJax-Span-24" 
> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> 0.61em;"> 
> >>                                   <span class="texatom" 
> >> id="MathJax-Span-25"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-26"> 
> >>                                       <span class="mn" 
> id="MathJax-Span-27" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Main;">2</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                                 <span style="position: absolute; clip: 
> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> 0.549em;"> 
> >>                                   <span class="texatom" 
> >> id="MathJax-Span-28"> 
> >>                                     <span class="mrow" 
> id="MathJax-Span-29"> 
> >>                                       <span class="mi" 
> id="MathJax-Span-30" 
> >>                                       style="font-size: 70.7%; 
> font-family: 
> >> MathJax_Math-italic;">k</span> 
> >>                                     </span> 
> >>                                   </span> 
> >>                                 </span> 
> >>                               </span> 
> >>                             </span> 
> >>                           </span> 
> >>                         </span> 
> >>                       </span> 
> >>                     </span> 
> >>                   </nobr> 
> >>                 </span> 
> >>                 <script type="math/tex" id="MathJax-Element-1"> 
> >>  \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2} 
> >> </script> 
> >> </td> 
> >> 
> >> Pandoc Command (less file names) 
> >> 
> >> pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex -s 
> -o 
> >> 
> >> 
> >> Actual Latex Output 
> >> \begin{minipage}[t]{0.47\columnwidth}\raggedright\strut 
> >> 
> {}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}} 
>
> >> \strut\end{minipage}\tabularnewline 
> >> 
> >> Expected LaTeX Output (maybe with the minipage commands above) 
> >> \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2} 
> >> 
> >> 
> >> Pandoc --version Output 
> >> pandoc.exe 1.13.2 
> >> 
> >> Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1. 
> >> Syntax highlighting is supported for the following languages: 
> >>     abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, 
> boo, 
> >> c, 
> >>     changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, 
> css, 
> >>     curry, d, diff, djangotemplate, dockerfile, dot, doxygen, 
> doxygenlua, 
> >> dtd, 
> >>     eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, 
> gnuassembler, 
> >> go, 
> >>     haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, 
> jsp, 
> >>     julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, 
> m4, 
> >>     makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki, 
> >>     metafont, mips, modelines, modula2, modula3, monobasic, nasm, 
> noweb, 
> >>     objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, 
> >> pike, 
> >>     postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, 
> >> rhtml, 
> >>     roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, 
> >>     sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, 
> xul, 
> >>     yacc, yaml, zsh 
> >> Default user data directory: C:\Users\manderso\AppData\Roaming\pandoc 
> >> Copyright (C) 2006-2014 John MacFarlane 
> >> Web:  http://johnmacfarlane.net/pandoc 
> >> This is free software; see the source for copying conditions. 
> >> There is no warranty, not even for merchantability or fitness 
> >> for a particular purpose. 
> >> 
> >> 
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "pandoc-discuss" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an 
> >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <javascript:>. 
> >> To view this discussion on the web visit 
> >> 
> https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com. 
>
> >> For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ac09a73e-8fda-4ea3-ac0f-18520a7102b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 26702 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pandoc With MathJax
       [not found]             ` <ac09a73e-8fda-4ea3-ac0f-18520a7102b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-12 21:50               ` Matthew Pickering
       [not found]                 ` <CALuQ0m-jUVzFTd2A+H_Scx6xYSPJjFK0zrfakOZ29RmBgQgp_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Pickering @ 2015-03-12 21:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I don't think that it would be possible to translate the site without
quite a bit of work due to the use of tables for layout.

Someone else on the list might have more experience doing this but
using pandoc to pull out the equations and then a more manual editing
process might be the best solution.


On Thu, Mar 12, 2015 at 6:03 PM, MikeyD <michael.danderson-BUHhN+a2lJ4@public.gmane.org> wrote:
> Would love to do that, but I need the balance of the document formatted for
> LaTeX compiling... we are also looking into this in general as part of a
> collaboration aimed at making an ePub version of the site available as a
> book for people.  Since there is an embedded LaTeX equation, is there a way
> to just strip out the crud and then process with pandoc?
>
> Best,
>
> M
>
> On Thursday, March 12, 2015 at 1:18:23 PM UTC-4, Matthew Pickering wrote:
>>
>> OK -- I just realised you could right click on the Math and get them
>> to render using the browsers native MathML support. Chucking pandoc at
>> the page still doesn't work (more investigation needed) but attempting
>> to convert the Math element you mention gives the following result.
>>
>> "\\mathit{\\sigma}_{1}^{2} = \\mathit{\\sigma}_{2}^{2} = \\ldots =
>> \\mathit{\\sigma}_{k}^{2}"
>>
>> Which is close to what you want but.. it is better to notice that the
>> website already contains the necessary LaTeX embedded in the MathML.
>>
>> <annotation encoding="application/x-tex">\sigma_{1}^{2} =
>> \sigma_{2}^{2} = \ldots =
>> \sigma_{k}^{2}</annotation></semantics></math>
>>
>> So I would recommend bypassing pandoc and just using that.
>>
>> Hope that helps.
>>
>> Matt
>>
>>
>>
>> On Thu, Mar 12, 2015 at 5:11 PM, Matthew Pickering
>> <matthewt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > This website is very strange. It seems like MathJax preprocesses
>> > MathML into this weird group of spans rather than relying on a
>> > browsers native MathML rendering. Pandoc can handle MathML just fine
>> > but I'm afraid there is no support for this garbled input. If you can
>> > get hold of the original document source then I feel like you could do
>> > much better.
>> >
>> > Matt
>> >
>> > On Thu, Mar 12, 2015 at 12:41 PM, MikeyD <michael....-BUHhN+a2lJ4@public.gmane.org> wrote:
>> >> K, I've run into a bit of a dead end looking on the distributions, etc.
>> >> for
>> >> support on a problem.  My intern and I are working to translate the
>> >> NIST/SEMATECH Statistics handbook (link) from html to latex.  We are
>> >> having
>> >> difficulties in getting pandoc to go from html with MathJax back to
>> >> LaTeX.
>> >> Our example file that we are working with as a test case is the
>> >> Levene's
>> >> test (link). I found an example of using some additional commands to
>> >> clean
>> >> things up a little bit, link, but the result doesn't appear to work
>> >> properly
>> >> in our case.  Code snippets taken from the Levene's test linked above
>> >> are
>> >> below as well as the pandoc --version output.
>> >>
>> >> Thanks in advance for the help!
>> >>
>> >> MathJax Code Snippet
>> >> <td>
>> >>                 <span class="MathJax" id="MathJax-Element-1-Frame">
>> >>                   <nobr>
>> >>                     <span class="math" id="MathJax-Span-1" role="math"
>> >> style="width: 8.741em; display: inline-block;">
>> >>                       <span style="display: inline-block; position:
>> >> relative; width: 8.498em; height: 0px; font-size: 103%;">
>> >>                         <span style="position: absolute; clip:
>> >> rect(3.037em
>> >> 1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;">
>> >>
>> >>
>> >>                           <span class="mrow" id="MathJax-Span-2">
>> >>                             <span class="msubsup" id="MathJax-Span-3">
>> >>                               <span style="display: inline-block;
>> >> position:
>> >> relative; width: 1.035em; height: 0px;">
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left:
>> >> 0.003em;">
>> >>
>> >>
>> >>                                   <span class="mi" id="MathJax-Span-4"
>> >> style="font-family: MathJax_Math-italic;">ü/span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left:
>> >> 0.61em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-5">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-6">
>> >>                                       <span class="mn"
>> >> id="MathJax-Span-7"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Main;">2</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left:
>> >> 0.549em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-8">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-9">
>> >>                                       <span class="mn"
>> >> id="MathJax-Span-10"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Main;">1</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                               </span>
>> >>                             </span>
>> >>                             <span class="mo" id="MathJax-Span-11"
>> >>                             style="font-family: MathJax_Main;
>> >> padding-left:
>> >> 0.306em;">=</span>
>> >>                             <span class="msubsup" id="MathJax-Span-12"
>> >> style="padding-left: 0.306em;">
>> >>                               <span style="display: inline-block;
>> >> position:
>> >> relative; width: 1.035em; height: 0px;">
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left:
>> >> 0.003em;">
>> >>                                   <span class="mi" id="MathJax-Span-13"
>> >> style="font-family: MathJax_Math-italic;">ü/span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left:
>> >> 0.61em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-14">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-15">
>> >>                                       <span class="mn"
>> >> id="MathJax-Span-16"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Main;">2</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left:
>> >> 0.549em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-17">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-18">
>> >>                                       <span class="mn"
>> >> id="MathJax-Span-19"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Main;">2</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                               </span>
>> >>                             </span>
>> >>                             <span class="mo" id="MathJax-Span-20"
>> >>                             style="font-family: MathJax_Main;
>> >> padding-left:
>> >> 0.306em;">=</span>
>> >>                             <span class="mo" id="MathJax-Span-21"
>> >>                             style="font-family: MathJax_Main;
>> >> padding-left:
>> >> 0.306em;">…</span>
>> >>                             <span class="mo" id="MathJax-Span-22"
>> >>                             style="font-family: MathJax_Main;
>> >> padding-left:
>> >> 0.306em;">=</span>
>> >>                             <span class="msubsup" id="MathJax-Span-23"
>> >> style="padding-left: 0.306em;">
>> >>                               <span style="display: inline-block;
>> >> position:
>> >> relative; width: 1.035em; height: 0px;">
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left:
>> >> 0.003em;">
>> >>                                   <span class="mi" id="MathJax-Span-24"
>> >> style="font-family: MathJax_Math-italic;">ü/span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left:
>> >> 0.61em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-25">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-26">
>> >>                                       <span class="mn"
>> >> id="MathJax-Span-27"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Main;">2</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                                 <span style="position: absolute; clip:
>> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left:
>> >> 0.549em;">
>> >>                                   <span class="texatom"
>> >> id="MathJax-Span-28">
>> >>                                     <span class="mrow"
>> >> id="MathJax-Span-29">
>> >>                                       <span class="mi"
>> >> id="MathJax-Span-30"
>> >>                                       style="font-size: 70.7%;
>> >> font-family:
>> >> MathJax_Math-italic;">k</span>
>> >>                                     </span>
>> >>                                   </span>
>> >>                                 </span>
>> >>                               </span>
>> >>                             </span>
>> >>                           </span>
>> >>                         </span>
>> >>                       </span>
>> >>                     </span>
>> >>                   </nobr>
>> >>                 </span>
>> >>                 <script type="math/tex" id="MathJax-Element-1">
>> >>  \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
>> >> </script>
>> >> </td>
>> >>
>> >> Pandoc Command (less file names)
>> >>
>> >> pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex -s
>> >> -o
>> >>
>> >>
>> >> Actual Latex Output
>> >> \begin{minipage}[t]{0.47\columnwidth}\raggedright\strut
>> >>
>> >> {}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}}
>> >> \strut\end{minipage}\tabularnewline
>> >>
>> >> Expected LaTeX Output (maybe with the minipage commands above)
>> >> \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2}
>> >>
>> >>
>> >> Pandoc --version Output
>> >> pandoc.exe 1.13.2
>> >>
>> >> Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1.
>> >> Syntax highlighting is supported for the following languages:
>> >>     abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex,
>> >> boo,
>> >> c,
>> >>     changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs,
>> >> css,
>> >>     curry, d, diff, djangotemplate, dockerfile, dot, doxygen,
>> >> doxygenlua,
>> >> dtd,
>> >>     eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl,
>> >> gnuassembler,
>> >> go,
>> >>     haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json,
>> >> jsp,
>> >>     julia, latex, lex, lilypond, literatecurry, literatehaskell, lua,
>> >> m4,
>> >>     makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
>> >>     metafont, mips, modelines, modula2, modula3, monobasic, nasm,
>> >> noweb,
>> >>     objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php,
>> >> pike,
>> >>     postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest,
>> >> rhtml,
>> >>     roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
>> >>     sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt,
>> >> xul,
>> >>     yacc, yaml, zsh
>> >> Default user data directory: C:\Users\manderso\AppData\Roaming\pandoc
>> >> Copyright (C) 2006-2014 John MacFarlane
>> >> Web:  http://johnmacfarlane.net/pandoc
>> >> This is free software; see the source for copying conditions.
>> >> There is no warranty, not even for merchantability or fitness
>> >> for a particular purpose.
>> >>
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "pandoc-discuss" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/ac09a73e-8fda-4ea3-ac0f-18520a7102b5%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m-jUVzFTd2A%2BH_Scx6xYSPJjFK0zrfakOZ29RmBgQgp_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pandoc With MathJax
       [not found]                 ` <CALuQ0m-jUVzFTd2A+H_Scx6xYSPJjFK0zrfakOZ29RmBgQgp_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-03-27 19:45                   ` MikeyD
  0 siblings, 0 replies; 6+ messages in thread
From: MikeyD @ 2015-03-27 19:45 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


[-- Attachment #1.1: Type: text/plain, Size: 17850 bytes --]

Might there be a way to just extract the part of the mathjax stuff that is 
is at the end of the entry?  HTML isn't my strong suit, but the as Matthew 
indicated the latex code is embedded in all the mathjax garbage....

<script type="math/tex" id="MathJax-Element-1"> \sigma_{1}^{2} = \sigma_{2
}^{2} = \ldots = \sigma_{k}^{2} </script>




On Thursday, March 12, 2015 at 5:51:00 PM UTC-4, Matthew Pickering wrote:
>
> I don't think that it would be possible to translate the site without 
> quite a bit of work due to the use of tables for layout. 
>
> Someone else on the list might have more experience doing this but 
> using pandoc to pull out the equations and then a more manual editing 
> process might be the best solution. 
>
>
> On Thu, Mar 12, 2015 at 6:03 PM, MikeyD <michael....-BUHhN+a2lJ4@public.gmane.org <javascript:>> 
> wrote: 
> > Would love to do that, but I need the balance of the document formatted 
> for 
> > LaTeX compiling... we are also looking into this in general as part of a 
> > collaboration aimed at making an ePub version of the site available as a 
> > book for people.  Since there is an embedded LaTeX equation, is there a 
> way 
> > to just strip out the crud and then process with pandoc? 
> > 
> > Best, 
> > 
> > M 
> > 
> > On Thursday, March 12, 2015 at 1:18:23 PM UTC-4, Matthew Pickering 
> wrote: 
> >> 
> >> OK -- I just realised you could right click on the Math and get them 
> >> to render using the browsers native MathML support. Chucking pandoc at 
> >> the page still doesn't work (more investigation needed) but attempting 
> >> to convert the Math element you mention gives the following result. 
> >> 
> >> "\\mathit{\\sigma}_{1}^{2} = \\mathit{\\sigma}_{2}^{2} = \\ldots = 
> >> \\mathit{\\sigma}_{k}^{2}" 
> >> 
> >> Which is close to what you want but.. it is better to notice that the 
> >> website already contains the necessary LaTeX embedded in the MathML. 
> >> 
> >> <annotation encoding="application/x-tex">\sigma_{1}^{2} = 
> >> \sigma_{2}^{2} = \ldots = 
> >> \sigma_{k}^{2}</annotation></semantics></math> 
> >> 
> >> So I would recommend bypassing pandoc and just using that. 
> >> 
> >> Hope that helps. 
> >> 
> >> Matt 
> >> 
> >> 
> >> 
> >> On Thu, Mar 12, 2015 at 5:11 PM, Matthew Pickering 
> >> <matthewt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: 
> >> > This website is very strange. It seems like MathJax preprocesses 
> >> > MathML into this weird group of spans rather than relying on a 
> >> > browsers native MathML rendering. Pandoc can handle MathML just fine 
> >> > but I'm afraid there is no support for this garbled input. If you can 
> >> > get hold of the original document source then I feel like you could 
> do 
> >> > much better. 
> >> > 
> >> > Matt 
> >> > 
> >> > On Thu, Mar 12, 2015 at 12:41 PM, MikeyD <michael....-BUHhN+a2lJ4@public.gmane.org> wrote: 
> >> >> K, I've run into a bit of a dead end looking on the distributions, 
> etc. 
> >> >> for 
> >> >> support on a problem.  My intern and I are working to translate the 
> >> >> NIST/SEMATECH Statistics handbook (link) from html to latex.  We are 
> >> >> having 
> >> >> difficulties in getting pandoc to go from html with MathJax back to 
> >> >> LaTeX. 
> >> >> Our example file that we are working with as a test case is the 
> >> >> Levene's 
> >> >> test (link). I found an example of using some additional commands to 
> >> >> clean 
> >> >> things up a little bit, link, but the result doesn't appear to work 
> >> >> properly 
> >> >> in our case.  Code snippets taken from the Levene's test linked 
> above 
> >> >> are 
> >> >> below as well as the pandoc --version output. 
> >> >> 
> >> >> Thanks in advance for the help! 
> >> >> 
> >> >> MathJax Code Snippet 
> >> >> <td> 
> >> >>                 <span class="MathJax" id="MathJax-Element-1-Frame"> 
> >> >>                   <nobr> 
> >> >>                     <span class="math" id="MathJax-Span-1" 
> role="math" 
> >> >> style="width: 8.741em; display: inline-block;"> 
> >> >>                       <span style="display: inline-block; position: 
> >> >> relative; width: 8.498em; height: 0px; font-size: 103%;"> 
> >> >>                         <span style="position: absolute; clip: 
> >> >> rect(3.037em 
> >> >> 1000.003em 4.554em -999.997em); top: -4.002em; left: 0.003em;"> 
> >> >> 
> >> >> 
> >> >>                           <span class="mrow" id="MathJax-Span-2"> 
> >> >>                             <span class="msubsup" 
> id="MathJax-Span-3"> 
> >> >>                               <span style="display: inline-block; 
> >> >> position: 
> >> >> relative; width: 1.035em; height: 0px;"> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> >> >> 0.003em;"> 
> >> >> 
> >> >> 
> >> >>                                   <span class="mi" 
> id="MathJax-Span-4" 
> >> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> >> >> 0.61em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-5"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-6"> 
> >> >>                                       <span class="mn" 
> >> >> id="MathJax-Span-7" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Main;">2</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> >> >> 0.549em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-8"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-9"> 
> >> >>                                       <span class="mn" 
> >> >> id="MathJax-Span-10" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Main;">1</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                               </span> 
> >> >>                             </span> 
> >> >>                             <span class="mo" id="MathJax-Span-11" 
> >> >>                             style="font-family: MathJax_Main; 
> >> >> padding-left: 
> >> >> 0.306em;">=</span> 
> >> >>                             <span class="msubsup" 
> id="MathJax-Span-12" 
> >> >> style="padding-left: 0.306em;"> 
> >> >>                               <span style="display: inline-block; 
> >> >> position: 
> >> >> relative; width: 1.035em; height: 0px;"> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> >> >> 0.003em;"> 
> >> >>                                   <span class="mi" 
> id="MathJax-Span-13" 
> >> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> >> >> 0.61em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-14"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-15"> 
> >> >>                                       <span class="mn" 
> >> >> id="MathJax-Span-16" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Main;">2</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> >> >> 0.549em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-17"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-18"> 
> >> >>                                       <span class="mn" 
> >> >> id="MathJax-Span-19" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Main;">2</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                               </span> 
> >> >>                             </span> 
> >> >>                             <span class="mo" id="MathJax-Span-20" 
> >> >>                             style="font-family: MathJax_Main; 
> >> >> padding-left: 
> >> >> 0.306em;">=</span> 
> >> >>                             <span class="mo" id="MathJax-Span-21" 
> >> >>                             style="font-family: MathJax_Main; 
> >> >> padding-left: 
> >> >> 0.306em;">…</span> 
> >> >>                             <span class="mo" id="MathJax-Span-22" 
> >> >>                             style="font-family: MathJax_Main; 
> >> >> padding-left: 
> >> >> 0.306em;">=</span> 
> >> >>                             <span class="msubsup" 
> id="MathJax-Span-23" 
> >> >> style="padding-left: 0.306em;"> 
> >> >>                               <span style="display: inline-block; 
> >> >> position: 
> >> >> relative; width: 1.035em; height: 0px;"> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.401em 1000.003em 4.19em -999.997em); top: -4.002em; left: 
> >> >> 0.003em;"> 
> >> >>                                   <span class="mi" 
> id="MathJax-Span-24" 
> >> >> style="font-family: MathJax_Math-italic;">ü/span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -4.366em; left: 
> >> >> 0.61em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-25"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-26"> 
> >> >>                                       <span class="mn" 
> >> >> id="MathJax-Span-27" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Main;">2</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                                 <span style="position: absolute; 
> clip: 
> >> >> rect(3.34em 1000.003em 4.19em -999.997em); top: -3.698em; left: 
> >> >> 0.549em;"> 
> >> >>                                   <span class="texatom" 
> >> >> id="MathJax-Span-28"> 
> >> >>                                     <span class="mrow" 
> >> >> id="MathJax-Span-29"> 
> >> >>                                       <span class="mi" 
> >> >> id="MathJax-Span-30" 
> >> >>                                       style="font-size: 70.7%; 
> >> >> font-family: 
> >> >> MathJax_Math-italic;">k</span> 
> >> >>                                     </span> 
> >> >>                                   </span> 
> >> >>                                 </span> 
> >> >>                               </span> 
> >> >>                             </span> 
> >> >>                           </span> 
> >> >>                         </span> 
> >> >>                       </span> 
> >> >>                     </span> 
> >> >>                   </nobr> 
> >> >>                 </span> 
> >> >>                 <script type="math/tex" id="MathJax-Element-1"> 
> >> >>  \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2} 
> >> >> </script> 
> >> >> </td> 
> >> >> 
> >> >> Pandoc Command (less file names) 
> >> >> 
> >> >> pandoc -f html+tex_math_dollars+tex_math_single_backslash -t latex 
> -s 
> >> >> -o 
> >> >> 
> >> >> 
> >> >> Actual Latex Output 
> >> >> \begin{minipage}[t]{0.47\columnwidth}\raggedright\strut 
> >> >> 
> >> >> 
> {}\hyperdef{}{MathJax-Element-1-Frame}{}{\hyperdef{}{MathJax-Span-1}{}{{{\hyperdef{}{MathJax-Span-2}{}{\hyperdef{}{MathJax-Span-3}{}{{{\hyperdef{}{MathJax-Span-4}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-5}{}{\hyperdef{}{MathJax-Span-6}{}{\hyperdef{}{MathJax-Span-7}{}{2}}}{}}{\hyperdef{}{MathJax-Span-8}{}{\hyperdef{}{MathJax-Span-9}{}{\hyperdef{}{MathJax-Span-10}{}{1}}}{}}}}\hyperdef{}{MathJax-Span-11}{}{=}\hyperdef{}{MathJax-Span-12}{}{{{\hyperdef{}{MathJax-Span-13}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-14}{}{\hyperdef{}{MathJax-Span-15}{}{\hyperdef{}{MathJax-Span-16}{}{2}}}{}}{\hyperdef{}{MathJax-Span-17}{}{\hyperdef{}{MathJax-Span-18}{}{\hyperdef{}{MathJax-Span-19}{}{2}}}{}}}}\hyperdef{}{MathJax-Span-20}{}{=}\hyperdef{}{MathJax-Span-21}{}{\ldots{}}\hyperdef{}{MathJax-Span-22}{}{=}\hyperdef{}{MathJax-Span-23}{}{{{\hyperdef{}{MathJax-Span-24}{}{σ{}}{}}{\hyperdef{}{MathJax-Span-25}{}{\hyperdef{}{MathJax-Span-26}{}{\hyperdef{}{MathJax-Span-27}{}{2}}}{}}{\hyperdef{}{MathJax-Span-28}{}{\hyperdef{}{MathJax-Span-29}{}{\hyperdef{}{MathJax-Span-30}{}{k}}}{}}}}}{}}}{}}} 
>
> >> >> \strut\end{minipage}\tabularnewline 
> >> >> 
> >> >> Expected LaTeX Output (maybe with the minipage commands above) 
> >> >> \sigma_{1}^{2} = \sigma_{2}^{2} = \ldots = \sigma_{k}^{2} 
> >> >> 
> >> >> 
> >> >> Pandoc --version Output 
> >> >> pandoc.exe 1.13.2 
> >> >> 
> >> >> Compiled with texmath 0.8.0.1, highlighting-kate 0.5.11.1. 
> >> >> Syntax highlighting is supported for the following languages: 
> >> >>     abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, 
> bibtex, 
> >> >> boo, 
> >> >> c, 
> >> >>     changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, 
> cs, 
> >> >> css, 
> >> >>     curry, d, diff, djangotemplate, dockerfile, dot, doxygen, 
> >> >> doxygenlua, 
> >> >> dtd, 
> >> >>     eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, 
> >> >> gnuassembler, 
> >> >> go, 
> >> >>     haskell, haxe, html, ini, isocpp, java, javadoc, javascript, 
> json, 
> >> >> jsp, 
> >> >>     julia, latex, lex, lilypond, literatecurry, literatehaskell, 
> lua, 
> >> >> m4, 
> >> >>     makefile, mandoc, markdown, mathematica, matlab, maxima, 
> mediawiki, 
> >> >>     metafont, mips, modelines, modula2, modula3, monobasic, nasm, 
> >> >> noweb, 
> >> >>     objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, 
> php, 
> >> >> pike, 
> >> >>     postscript, prolog, pure, python, r, relaxng, relaxngcompact, 
> rest, 
> >> >> rhtml, 
> >> >>     roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, 
> >> >>     sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, 
> xslt, 
> >> >> xul, 
> >> >>     yacc, yaml, zsh 
> >> >> Default user data directory: 
> C:\Users\manderso\AppData\Roaming\pandoc 
> >> >> Copyright (C) 2006-2014 John MacFarlane 
> >> >> Web:  http://johnmacfarlane.net/pandoc 
> >> >> This is free software; see the source for copying conditions. 
> >> >> There is no warranty, not even for merchantability or fitness 
> >> >> for a particular purpose. 
> >> >> 
> >> >> 
> >> >> 
> >> >> -- 
> >> >> You received this message because you are subscribed to the Google 
> >> >> Groups 
> >> >> "pandoc-discuss" group. 
> >> >> To unsubscribe from this group and stop receiving emails from it, 
> send 
> >> >> an 
> >> >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> >> >> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> >> >> To view this discussion on the web visit 
> >> >> 
> >> >> 
> https://groups.google.com/d/msgid/pandoc-discuss/fc10b210-0fd7-49e6-838a-463f2edc8efb%40googlegroups.com. 
>
> >> >> For more options, visit https://groups.google.com/d/optout. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "pandoc-discuss" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> > To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/pandoc-discuss/ac09a73e-8fda-4ea3-ac0f-18520a7102b5%40googlegroups.com. 
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/086d0a0a-f20a-435f-967c-a7bff2d66f6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 35133 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-27 19:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 12:41 Pandoc With MathJax MikeyD
     [not found] ` <fc10b210-0fd7-49e6-838a-463f2edc8efb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-12 17:11   ` Matthew Pickering
     [not found]     ` <CALuQ0m-tbNzJvjkCLsMiLDywvEsR6arXAywFVg5azhf+aRC5HQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-12 17:18       ` Matthew Pickering
     [not found]         ` <CALuQ0m-H+S4sL+5QtxZXi4jh0BnpbP+Q6VWmh_Z=mQo_hZmh7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-12 18:03           ` MikeyD
     [not found]             ` <ac09a73e-8fda-4ea3-ac0f-18520a7102b5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-12 21:50               ` Matthew Pickering
     [not found]                 ` <CALuQ0m-jUVzFTd2A+H_Scx6xYSPJjFK0zrfakOZ29RmBgQgp_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-27 19:45                   ` MikeyD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).