A highlighting system to explain equations and their components easily
pip install eqhl==0.2
A tool for explaining equations.
pip install eqhl
An Equation
object contains a list of Term
and HLTerm
.
HLTerm
is an equation term that displays a tool tip and is highlighted when hovered over.
It takes two arguments, the first is the LaTeX math to be displayed via KaTeX, the second is the tooltip to display.
Highlight color is chosen automatically from six pre-defined colors that are cycled through.
A Term
only takes LaTeX math and is used for un-emphasized characters and terms, such as equal signs.
To create an Equation
, pass a list of Term
and HLTerm
as follows:
newtons_second = Equation([HLTerm(r'\vec{F}', 'Force'), Term('='), HLTerm('m', 'Mass'), HLTerm(r'\vec{a}', 'Acceleration')])
Note the usage of r'raw string literals'
to avoid LaTeX backslash commands being interpreted as an escape character.
There are four things you need to do to put an equation on your webpage:
renderMathInElement(document.body);
, more info here.eqhl.css
somewhere appropriate and add it to your document's <head>
: <link type="text/css" rel="stylesheet" href="eqhl.css">
The recommended way to customize is to install the sassc
SASS compiler, edit eqhl.sass
and then run make
.
Color variables can be changed at the top of the file.
Without SASS, edit eqhl.css
and modify colors directly.