Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Reference documentation and guides at cortexjs.io/mathlive.
Try it at mathlive.io.
To add a mathfield element in your page use a <math-field>
tag.
It works just like a <textarea>
or <button>
. You can manipulate the
mathfield using methods of the element and listen for events to be notified when
its internal state changes.
<!DOCTYPE html>
<html lang="en-US">
<body>
<math-field>f(x)=</math-field>
<script src="https://unpkg.com/mathlive/dist/mathlive.min.js"></script>
</body>
</html>
This project is licensed under the MIT License.
0.64.0 2021-05-09
The FontSize
type is now an integer between 1 and 10. It previously was
size1
, size2
, etc... The default font size is 5
, the smallest is 1
.
However, when using applyStyle()
, the size can still be specified with
size1
, etc... The following size values can also be used: tiny
,
scriptsize
, footnotesize
, small
, normal
or normalSize
, large
,
Large
, LARGE
, huge
, Huge
.
Previously, named colors (yellow
, red
...) mapped to the dvips
color set.
They can now map to different values to improve their legibility. To ensure
that a particular color is used, specify the colors as a hex triplet
(#dd2233
). See also the colorMap
option.
The following color names are recommended: they will map to values that have been optimized for legibility as a foreground or background color, they cover all the hues of the color circle and have been adjusted to provide similar apparent brightness and intensity:
orange
, yellow
, lime
, green
, teal
, blue
, indigo
,
purple
, magenta
black
, dark-grey
, grey
, light-grey
, white
The background of fractions, radicals and parentheses group (\left
/\right
commands) is now highlighted when they contain the caret. This makes it easier
to distinguish some cases when the cursor is at the edge of the element and
could be either inside or outside. The appearance of the highliting can be
controlled with the <del>--contains-highlight
</del>
--contains-highlight-background-color
CSS variable. Set it to transparent
to restore the previous behavior.
colorMap
option. To map a color name such as "yellow" to a custom RGB
color, set the colorMap
or backgroundColorMap
option to a function that
takes the color name as an argument and return a matching CSS RGB string.
Return undefined
to proceed with the default mapping.
In macro dictionary, added option to expand or not the macro when using the
latex-expanded
output format (when copying to the clipboard, for example).
Added the \overunderset{}{}{}
command.
Added the \lparen
and \rparen
delimiters.
Added the \mod
, \pmod
and \bmod
commands, defined as macros.
Added support for dashed column separators in matrix, using ":" in the matrix preamble. See the arydshln package.
Added support for optional below argument to \stackrel
and \stackbin
as
per the
stackrel package
When using renderMathInDocument()
or renderMathInElement()
, ASCII Math
format can be used. The default delimiters for ASCII Math are
"" (backtick) and can be changed with the
asciiMath.delimitersoption. To turn off this conversion and revert to the previous behavior, call
renderMathInDocument({
asciiMath: null })`
Substantial rewrite of the stacked layout algorithm (fractions, superscripts,
etc...). The previous algorithm did not work correctly when mixing absolute
sizing commands (\Huge
) and relative ones (\scriptstyle
) and had various
issues and inconsistencies with what TeX produced. The result is now close to
TeX.
Display the placeholder symbol using the caret color.
Added the --smart-fence-opacity
and --smart-fence-color
CSS variables.
In the layout of superscript/subscript and accents, use the correct font metrics for spacing and layout (previously, the font metric for the base size was always used). This may result in very slightly different placement of superscripts, subscripts and limits (but closer to TeX).
Fixed cases where the inter-atom spacing was incorrect (when spacing atoms or super/subscripts were used with a binary atom, or when some other atom types were used, such as BoxAtom and more).
When pasting from the clipboard, recognize text bracketed with
\begin{math}
...\end{math}
or \begin{displaymath}
...\end{displaymath}
as LaTeX (in addition to $
, $$
, \[
...\]
and \(
...\)
which were
recognized before). Also, recognize text that may contain a LaTeX expression
surrounded by regular text (i.e. "if $x > 0$").
When pasting ASCIIMath, recognize more expression using standard functions such as the trig functions.
Recognize text content surrounded with "`" (backtick) delimiters as ASCII Math.
When copying to the clipboard, roundtrip verbatim latex when available, i.e. the content of the clipboard will be exactly what has been pasted in if the formula has not been edited.
The default color mapping function now returns different values when used as a line color or as a background color. This improves the legibility of colors. See MathLive Guide: Customizing.
Paste operations are now undoable.
Avoid generating unnecessary empty span for limits and other constructs.
Avoid repeating color attributes on child elements by lifting them to an appropriate parent. As a consequence, when a background color is applied it is displayed more uniformly than previously.
Reduced the size of the font-metrics table.
Increased the number of automated and static tests.
+-
) was incorrect, as well as
some other combinations.\sqrt
, \placeholder
and many other atoms when a mathstyle
is applied with commands such as \textstyle
, \scriptstyle
, etc...\widehat
).renderMathInDocument()
and the document contained a
mathfield with a value that contained exclusively an environment, the
mathfield would not render (the \begin{}
would be incorrectly rendered by
renderMathInDocument()
).renderMathInElement()
or renderMathInDocument()
use the same
default letterShapeStyle
as when using a mathfield, that is, french
if the
locale is French, tex
otherwise.getValue('latex')
will return exactly what was input.\exponentialE
: when a superscript/subscript was
applied to a macro, the latex output would become blank.\scriptstyle
would crash.skipBoundary
atom.\sqrt[\placeholder{}}{x}
\rule{}{}
) were not clickable and did not appear selected.\char
command when using latex-expanded
format.FAQs
A web component for math input
The npm package mathlive receives a total of 39,945 weekly downloads. As such, mathlive popularity was classified as popular.
We found that mathlive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.