Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Less-than" symbol in html to represent relation between quantities

Motivation

I'm working with a larger amount of equations in a document, written originally in HTML+MathML. The need to have the output in PDF too emerged and I started to use Pandoc to convert the document into md, then to latex, from which pdflatex could make a conventional and professional pdf output. Unfortunately some MathML editors couldn't handle well complicated formulas, and for this reason I embedded latex into html leading to the problem of the less-than and greater-than symbols.

MVE

The less-than < (and greater-than >) symbols cannot be used in a html document in a naive way to represent relation between quantities. The following document represents the relation correctly with MathJax (and even by converting to latex with pandoc), but validation by W3C Validator fails the test against HTML.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>The smaller problem</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
</head>

<body>
\[0     <  \infty \]
</body>
</html>

What workarounds (solutions?) can you suggest to handle this problem?

like image 451
DanielTuzes Avatar asked Mar 18 '26 02:03

DanielTuzes


1 Answers

I substituted all "less-than" < symbols with their named "&amplt;" entity inside latex notations. Even though they are not valid latex codes anymore, MathJax represents them correctly, and Pandoc converts them to < correctly too.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>The smaller problem</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
</head>

<body>
\[ 0 &lt; \infty \]
</body>
</html>
like image 55
DanielTuzes Avatar answered Mar 19 '26 17:03

DanielTuzes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!