This is a JS+CSS tool for making HTML behave and look like LaTeX.
See a live Example here.
Include the following in the head of your HTML doc:
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- MathJax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML"></script>
<!-- HTMLTeX -->
<script src="https://PeterEFrancis.com/HTMLTeX/HTMLTeX.js"></script>
<link rel="stylesheet" href="https://PeterEFrancis.com/HTMLTeX/HTMLTeX.css">
Create an element in the body of the HTML doc that you would like to make look like LaTeX. Then include this script at the bottom of the page. Make sure the first argument to the HTMLTeX
constructor is your intended LaTeX element.
<script type="text/x-mathjax-config">
new HTMLTeX(document.getElementById('LaTeX'), MathJax).render(
// options
);
</script>
render()
can take an optional JSON with the following optional keys:
highlight_links
: (true/false)
The benefit of HTMLTeX is the easy use of new and modified HTML tags. The list below describes the possible tag attributes and their purpose.
<tableofcontents>
display the table of contents (sections)<section>
create section header
<definition>
, <lemma>
, <theorem>
, <proposition>
, <corollary>
<example>
, <remark>
<example-modal>
example modal environment (requires bootstrap jquery)
outside: (true/false) set button to be outside the body text ```
```
<proof>
proof environment
<ref>
in-page reference link
<references>
references section<item>
reference in the references section
<br>
line break (extra line)<hr>
horizontal line (grey)<table>
<cite>
in-page citation link