3

I have been experimenting with producing small document snippets in LaTeXML - slowly building up to more complex documents, and one of the first stumbling points has been the inclusion of greek characters. I am observing that when the html file is opened in internet explorer or is opened by right click -> edit (opens in MS word) the greek characters are inserted but immediately followed by the code that produced them. Almost identical to the individual elements observed in the tabular presentation of greek characters listed here: http://web.ift.uib.no/Teori/KURS/WRK/TeX/sym1.html In opera however no symbol appears, just the \alpha etc.

doc.Tex file (contents below) is compiled using a bat file with the command:

latexml --includestyles --noparse --dest=doc.xml doc.tex | latexmlpost --dest=doc.html doc.xml

on a windows machine with miktex and strawberry perl

\documentclass[letter]{report}
\begin{document}
\chapter{Math Test}
  \section{A few Greek characters}
    $\alpha$
    $\beta$
    $\gamma$
    $\Gamma$
    $\delta$
    $\Delta$
    $\pm$
    How did these display?
\end{document}

Produced HTML Code: Unfortunately the option and the 4 space tags are not preventing the parsing of the code when I paste it in, so I might need an edit here to show the code in it's unparsed form.

<!DOCTYPE html><html>
<head>
<title></title>
<!--Generated on Mon Dec 22 13:10:57 2014 by LaTeXML (version 0.8.0) http://dlmf.nist.gov/LaTeXML/.-->

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="LaTeXML.css" type="text/css">
<link rel="stylesheet" href="ltx-report.css" type="text/css">
</head>
<body>
<div class="ltx_page_main">
<div class="ltx_page_content">
<section class="ltx_document">
<section id="Ch1" class="ltx_chapter">
<h1 class="ltx_title ltx_title_chapter">
<span class="ltx_tag ltx_tag_chapter">Chapter 1 </span>Math Test</h1>

<section id="Ch1.S1" class="ltx_section">
<h1 class="ltx_title ltx_title_section">
<span class="ltx_tag ltx_tag_section">1.1 </span>A few Greek characters</h1>

<div id="Ch1.S1.p1" class="ltx_para">
<p class="ltx_p"><math id="Ch1.S1.p1.m1" class="ltx_Math" alttext="\alpha" display="inline"><semantics><mi>α</mi><annotation encoding="application/x-tex">\alpha</annotation></semantics></math><math id="Ch1.S1.p1.m2" class="ltx_Math" alttext="\beta" display="inline"><semantics><mi>β</mi><annotation encoding="application/x-tex">\beta</annotation></semantics></math><math id="Ch1.S1.p1.m3" class="ltx_Math" alttext="\gamma" display="inline"><semantics><mi>γ</mi><annotation encoding="application/x-tex">\gamma</annotation></semantics></math><math id="Ch1.S1.p1.m4" class="ltx_Math" alttext="\Gamma" display="inline"><semantics><mi mathvariant="normal">Γ</mi><annotation encoding="application/x-tex">\Gamma</annotation></semantics></math><math id="Ch1.S1.p1.m5" class="ltx_Math" alttext="\delta" display="inline"><semantics><mi>δ</mi><annotation encoding="application/x-tex">\delta</annotation></semantics></math><math id="Ch1.S1.p1.m6" class="ltx_Math" alttext="\Delta" display="inline"><semantics><mi mathvariant="normal">Δ</mi><annotation encoding="application/x-tex">\Delta</annotation></semantics></math></p>
</div>
<div id="Ch1.S1.p2" class="ltx_para">
<p class="ltx_p"><math id="Ch1.S1.p2.m1" class="ltx_Math" alttext="\pm" display="inline"><semantics><mo>±</mo><annotation encoding="application/x-tex">\pm</annotation></semantics></math></p>
</div>
<div id="Ch1.S1.p3" class="ltx_para">
<p class="ltx_p">How did these display?</p>
</div>
</section>
</section>
</section>
</div>
<footer class="ltx_page_footer">
<div class="ltx_page_logo">Generated  on Mon Dec 22 13:10:57 2014 by <a href="http://dlmf.nist.gov/LaTeXML/">LaTeXML <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAYAAAD5YeaVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wKExQZLWTEaOUAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAdpJREFUKM9tkL+L2nAARz9fPZNCKFapUn8kyI0e4iRHSR1Kb8ng0lJw6FYHFwv2LwhOpcWxTjeUunYqOmqd6hEoRDhtDWdA8ApRYsSUCDHNt5ul13vz4w0vWCgUnnEc975arX6ORqN3VqtVZbfbTQC4uEHANM3jSqXymFI6yWazP2KxWAXAL9zCUa1Wy2tXVxheKA9YNoR8Pt+aTqe4FVVVvz05O6MBhqUIBGk8Hn8HAOVy+T+XLJfLS4ZhTiRJgqIoVBRFIoric47jPnmeB1mW/9rr9ZpSSn3Lsmir1fJZlqWlUonKsvwWwD8ymc/nXwVBeLjf7xEKhdBut9Hr9WgmkyGEkJwsy5eHG5vN5g0AKIoCAEgkEkin0wQAfN9/cXPdheu6P33fBwB4ngcAcByHJpPJl+fn54mD3Gg0NrquXxeLRQAAwzAYj8cwTZPwPH9/sVg8PXweDAauqqr2cDjEer1GJBLBZDJBs9mE4zjwfZ85lAGg2+06hmGgXq+j3+/DsixYlgVN03a9Xu8jgCNCyIegIAgx13Vfd7vdu+FweG8YRkjXdWy329+dTgeSJD3ieZ7RNO0VAXAPwDEAO5VKndi2fWrb9jWl9Esul6PZbDY9Go1OZ7PZ9z/lyuD3OozU2wAAAABJRU5ErkJggg==" alt="[LOGO]"></a>
</div></footer>
</div>
</body>
</html>

rendering of html by firefox

enter image description here

5
  • can you add the resulting html in a code block to your question Dec 22, 2014 at 11:12
  • @DavidCarlisle I attached the html code but I was unable to figure out in the editor how to display the code and not the parsed version.
    – EngBIRD
    Dec 24, 2014 at 0:34
  • 4 spaces work (you can give it a magic comment to force html highlighting) easiest as for tex is to highlight it all then use {} button or type control-k Dec 24, 2014 at 0:40
  • I added an image of your html in a browser to your question (as you can't add images in comments. It looks Ok to me? Dec 24, 2014 at 0:43
  • @DavidCarlisle Must be browser specific then. Probably should have realized that when MSIExplorer and Opera gave different results (I am not a firefox user). Is it possible that there are configurations that limiting for a specific target browser, that LaTeXML could be configured for? The big concern is this was to serve as a MSword render so that track changes and comments could be made as like many others, I have collaborators who refuse latex, and suppress latex markup in word don't quite cut it for more advanced commands tables, figures, gls, and siunitx (etc). Some even rtf can't support.
    – EngBIRD
    Dec 24, 2014 at 0:54

2 Answers 2

3

latexml is generating html using mathml, so needs a mathml enabled browser such as firefox or safari. IE and Chrome sadly do not support mathematics.

The simplest way to enable MatHML in all browsers is to use mathjax, which just means adding the <script> element line as shown below.

Probalby Latexml can be configured to add this while generating the output.

<!DOCTYPE html><html>
<head>
<title></title>
<!--Generated on Mon Dec 22 13:10:57 2014 by LaTeXML (version 0.8.0) http://dlmf.nist.gov/LaTeXML/.-->

<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="LaTeXML.css" type="text/css">
<link rel="stylesheet" href="ltx-report.css" type="text/css">
</head>
4
  • Could I confrim with you that when you say "The simplest way to enable MatHML in all browsers is to use mathjax" that IE should support this? I am inquiring because this is a fix for Opera, but not IE - which indicates to me that the problem is likely on my end in IE. i.e. there may be a missing library or a configuration option that prevents the execution of scripts for security purposes.
    – EngBIRD
    Dec 24, 2014 at 23:59
  • @EngBIRD yes the edited file with the mathjax reference will work fine in IE Dec 25, 2014 at 0:15
  • sorry for the ambiguity, adjusting the html with the script line as you describe only worked for Opera. It still doesn't in IE (unless I am missing a setting or option somewhere).
    – EngBIRD
    Dec 25, 2014 at 0:55
  • @EngBIRD I tested the posted code in firefox IE and Chrome. It works on them all. For IE if the file is on a local disk and you reference javasceript on a remote server it shows a "allow blocked content" dialog. so you have to click Ok the first time. You can avoid that by adding a "mark of the web" comment. but this is a general IE (nis)feature unrelated to the specificss of mathjax Dec 25, 2014 at 3:17
6

Since you've tagged your question with , why don't use htlatex for this purpose?

Running

htlatex doc.tex html

you get the following result

enter image description here

and this is the contents of doc.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html -->
<meta name="src" content="test.tex">
<meta name="date" content="2014-12-22 07:12:00">
<link rel="stylesheet" type="text/css" href="test.css">
</head><body
>

   <h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;1</span><br /><a
 id="x1-10001"></a>Math Test</h2>
   <h3 class="sectionHead"><span class="titlemark">1.1   </span> <a
 id="x1-20001.1"></a>A few Greek characters</h3>
<!--l. 5--><p class="noindent" ><span
class="cmmi-10">&#x03B1; &#x03B2; &#x03B3; </span>&#x0393; <span
class="cmmi-10">&#x03B4; </span>&#x0394; <span
class="cmsy-10">± </span>How did these display?
</body></html>

Instead, if you want xhtml output, run

htlatex doc.tex xhtml

and this will be the contents of doc.html

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,html -->
<meta name="src" content="doc.tex" />
<meta name="date" content="2014-12-22 08:54:00" />
<link rel="stylesheet" type="text/css" href="doc.css" />
</head><body
>

   <h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;1</span><br /><a
 id="x1-10001"></a>Math Test</h2>
   <h3 class="sectionHead"><span class="titlemark">1.1   </span> <a
 id="x1-20001.1"></a>A few Greek characters</h3>
<!--l. 5--><p class="noindent" ><span
class="cmmi-10">&#x03B1; &#x03B2; &#x03B3; </span>&#x0393; <span
class="cmmi-10">&#x03B4; </span>&#x0394; <span
class="cmsy-10">± </span>How did these display? </p>
</body></html> 
1
  • I would rather be using htlatex and indeed the currently presented problem is not an issue when compiled with htlatex. Because of packages and commands incorporated in the current cls file I have, there were considerable incompatibilities which had me investigating alternatives. Full PDF/HTML compatibility may not be practical under any html tool so I will likely need to restrict the scope of individual html documents to small object free document sections. At least until the cause of additional problems is solved.
    – EngBIRD
    Dec 22, 2014 at 18:01

You must log in to answer this question.

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