# Greek Characters in LaTeXML

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>
<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">
<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>[/itex]<math id="Ch1.S1.p1.m2" class="ltx_Math" alttext="\beta" display="inline"><semantics><mi>β</mi><annotation encoding="application/x-tex">\beta</annotation></semantics>[/itex]<math id="Ch1.S1.p1.m3" class="ltx_Math" alttext="\gamma" display="inline"><semantics><mi>γ</mi><annotation encoding="application/x-tex">\gamma</annotation></semantics>[/itex]<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>[/itex]<math id="Ch1.S1.p1.m5" class="ltx_Math" alttext="\delta" display="inline"><semantics><mi>δ</mi><annotation encoding="application/x-tex">\delta</annotation></semantics>[/itex]<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>[/itex]</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>[/itex]</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></footer>
</div>
</body>
</html>


rendering of html by firefox

• can you add the resulting html in a code block to your question – David Carlisle Dec 22 '14 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 '14 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 – David Carlisle Dec 24 '14 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? – David Carlisle Dec 24 '14 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 '14 at 0:54

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>
<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">

• 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 '14 at 23:59
• @EngBIRD yes the edited file with the mathjax reference will work fine in IE – David Carlisle Dec 25 '14 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 '14 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 – David Carlisle Dec 25 '14 at 3:17

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

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 >
<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">
>

id="x1-10001"></a>Math Test</h2>
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"
>
<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" />