Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 12:28
    SushantGautam commented #939
  • 11:25
    SushantGautam commented #939
  • 11:24
    SushantGautam commented #939
  • 11:24
    SushantGautam commented #939
  • 11:24
    SushantGautam commented #939
  • 11:24
    SushantGautam commented #939
  • 10:52
    dependabot[bot] edited #941
  • 10:52
    dependabot[bot] synchronize #941
  • 10:52
    dependabot[bot] edited #941
  • 10:52
    dependabot[bot] synchronize #937
  • 10:52
    dependabot[bot] edited #941
  • 10:52
    dependabot[bot] edited #937
  • 10:52
    dependabot[bot] synchronize #942
  • 10:52
    dependabot[bot] synchronize #935
  • 10:51
    dependabot[bot] synchronize #922
  • 10:51
    dependabot[bot] synchronize #923
  • 10:51
    dependabot[bot] edited #942
  • 10:51
    dependabot[bot] edited #935
  • 10:51
    dependabot[bot] synchronize #918
  • 10:51
    dependabot[bot] synchronize #936
Arno Gourdol
@arnog

Bug Fixes

  • A \chi13 (0.1em) gap between the nucleus and the above element was missing
    in OverUnder atoms (\overset, etc...).
  • On Safari iOS, correctly display the keyboard toggle glyph.
  • #907 When using renderMathInElement() or renderMathInDocument(),
    formulas containing styling information would get too aggressively coalesced,
    dropping some styling.
  • #910 Fixed an issue introduced in 0.61.0 where some content would not get
    rendered when calling renderMathInElement() or renderMathInDocument().
Arno Gourdol
@arnog
I've discovered an issue loading mathlive from a CDN in some browsers that prevented the fonts from loading properly. Since that's a pretty serious problem, I'm pushing an update with a fix. Say hello to mathlive 0.63

New Features

  • #788 Added virtualKeyboardState property to indicate if the virtual
    keyboard is currently visible or hidden. The property can also be modified to
    show or hide the virtual keyboard.
  • In read-only mode, do not attempt to load the sounds and do not allow the
    virtual keyboard to be shown.
  • Export version (previously available as MathLive.version).
  • #199 Added infty and int inline shortcuts.

Bug Fixes

  • #708 Pressing on the bottom part of the virtual keyboard keycap did not
    trigger the key action.
  • The asset directory (fonts/sounds) was not properly located in some browsers
    when using a CDN to load Mathlive.
  • Correctly focus the mathfield when the virtual keyboard is invoked.
xugo
@xugo:matrix.org
[m]
Hi guys. Please tell me what I'm doing wrong?
When I typing the exponent the formula is not displayed in the output. https://prnt.sc/129qz2u
Although this works correctly in examples. https://prnt.sc/129r0bg
Thanks!
https://codepen.io/Xugo/pen/PoWvXyw
Arno Gourdol
@arnog
Hmmm... I don't think you're doing anything wrong, it looks like a bug. The example on mathlive.io may be using an older version that doesn't have that bug.
A sort of workaround would be to use getValue('latex-expanded')...
Arno Gourdol
@arnog
OK, I have a fix for this issue. It would happen when a macro (such as \exponentialE) is insert in the formula, then modified with a superscript/subscript (which happens when it is inserted via the virtual keyboard)
xugo
@xugo:matrix.org
[m]
Thank you!
zoranpopovic
@zoranpopovic
image.png
it seems that new options plonkSound and keypressSound can't accept null, at least when types are checked...
Arno Gourdol
@arnog
yes, I forgot to update the public type definition. I have fixed this a while ago, but I need to push a new version with the fix.
stefnotch
@stefnotch
One thing I've noticed for quite a while with mathlive is how equations seem to shake around when moving the cursor. Is that a 'unfixable' issue, since it's some browser specific rendering stuff or is that an issue I should totally report on GitHub?
(Huh, Gitter doesn't like the webm format. Oh well, downloading the video and playing it still works)
stefnotch
@stefnotch
To answer my own question, it's totally fixable. Just use box-shadow instead of borders. So, something like this should work
.ML__caret:after {
 content:"";
 border:none;
 border-radius:2px;
 border-right:0px solid var(--caret);
 margin-right:0px;
 box-shadow: 0px 0px 0px 1px var(--caret);
 width:0px;
 ...
Arno Gourdol
@arnog
ah, that's a good find.
I think using 'box-sizing: content-box' should work as well
what browser/OS are you seeing the "shaking" with?
stefnotch
@stefnotch
Firefox 88, Windows 10
stefnotch
@stefnotch
I haven't had any luck getting box-sizing: content-box to work. Maybe I haven't tried the right combination of CSS magic though
Arno Gourdol
@arnog
I've just pushed to main a pretty significant update to the layout algorithm. It should be closer to what TeX produces, especially when it comes to scriptstyle.
mathlive-0.64.jpg
stefnotch
@stefnotch
Woah, that's amazing 🥳 I definitely didn't expect there to be so many subtle little things that one has to watch out for
Arno Gourdol
@arnog
Yeah... working out through this has been a bit of a slog, but I'm glad it's done.
and debugging all those things are infuriating. The way TeX's algorithm work, so many things influence or depend on other things that when something goes wrong trying to figure out and how to fix it without breaking something else is... a challenge.
if you do get the chance, and if you're setup to do so, this latest version includes changes to the box-sizing. If you can try out and see if it fixes the "dancing caret" issue that would be great. Otherwise, we can always switch to your suggestion.
Arno Gourdol
@arnog
mathlive 0.64 has been posted to npm

Breaking Changes

  • 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:

    • colors: orange, yellow, lime, green, teal, blue, indigo,
      purple, magenta
    • shades of grey: black, dark-grey, grey, light-grey, white

New Features

  • The background of fractions, radicals and parentheses group (\left/\right
    commands) is now highlited 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 --contains-highlight 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 theasciiMath.delimiters` option.

Layout Improvements

  • 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 inconsistenceis 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).

Clipboard Improvements

  • When pasting from the clipboard, recognize text bracketed with
    \begin{math}...\end{math} or \begin{displaymath}...\end{displaymath}
    as LaTeX (in additon 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.

Other Improvements

  • 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.

Architecture

  • 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.

Bug Fixes

  • The size and spacing of fractions in superscript did not match the TeX layout.
  • Correctly apply TeX inter-atom spacing rules as per TeXBook p. 270. The
    spacing of two consecutive binary atoms (e.g. +-) was incorrect, as well as
    some other combinations.
  • Correctly render \sqrt, \placeholder and many other atoms when a mathstyle
    is applied with commands such as \textstyle, \scriptstyle, etc...
  • Correctly render selection rectangle of accent commands (\widehat).
  • If a document called 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()).
  • When using renderMathInElement() or renderMathInDocument() use the same
    default letterShapeStyle as when using a mathfield, that is, french if the
    locale is French, tex otherwise.
  • Fixed verbatim latex: when the value of the mathfield is set, if it is not
    modified, getValue('latex') will return exactly what was input.
  • Fixed latex output of \exponentialE: when a superscript/subscript was
    applied to a macro, the latex output would become blank.
  • Math characters with a bold italic style were displayed in regular italic.
  • An input consisting of only \scriptstyle would crash.
  • Allow navigation inside an empty skipBoundary atom.
  • After a copy (command/control+C) command, the content of clipboard was
    incorrect if the end of the selection included some content in text mode.
  • When rendering a placeholder in static mode, use a non-breaking space instead
    of nothing, which helps preserve a more accurate layout in some cases (for
    example in \sqrt[\placeholder{}}{x}
  • Rules (e.g. from \rule{}{}) were not clickable and did not appear selected.
  • Correctly roundtrip \char command when using latex-expanded format.
stefnotch
@stefnotch

if you do get the chance, and if you're setup to do so, this latest version includes changes to the box-sizing. If you can try out and see if it fixes the "dancing caret" issue that would be great. Otherwise, we can always switch to your suggestion.

So, simply the latest version from npm (0.64), right? I tried it out, it looks really neat and is a lot more 'stable'. However, it still dances in some cases

Also, I love the new highlighting. :sparkles:
Arno Gourdol
@arnog
weird... ok, I'll look at it but I'll probably end up applying your suggestion
Glad you like the new highlighting! Let me know if you think it should apply to more kind of atoms. It's very easy to extend.
stefnotch
@stefnotch
Okay, I'll keep the highlighting in mind and will definitely let you know if there are more parts where it should be applied :)
Arno Gourdol
@arnog
The list of supported commands is now available at https://cortexjs.io/mathlive/reference/commands/
and the list of keyboard shortcuts at https://cortexjs.io/mathlive/reference/keybindings/
zoranpopovic
@zoranpopovic
image.png
i don't know if this was new or old but i noticed a weird span nesting with \mright( \mleft)
the parens cause a single span to be created that contains things within.
zoranpopovic
@zoranpopovic
a related question: is there a way to set class cssid or htmlData on parens symbol itself? right now because of the nested spans that mleftright create each of the above are set on the entire paren enclosure, rather than just on open or close symbol.
Arno Gourdol
@arnog
That's odd. Could you share what LaTeX you used?
First, \mleft...\mright should only be used after a function (e.g. \sin), so it's odd that they are used here. I don't know why they would extend to the second closing parentheses either...
That said, both \mleft...\mright and \left...\right right now behave as a single atom, a group, that contains everything in between the opening and closing delimiter. As a result, you can't attach cssId or htmlData to the individual parentheses. This design has some other undesirable side-effects, and I was just coincidentally thinking about fixing it. Unfortunately, the fix is non-trivial and will require a re-architecting of the parsing engine. I've started working on it, though...
Zach Oliver
@ledgerTalk_gitlab
I had some questions about the latex to MathML conversion that MathLive provides. I was trying out the v63.1 release, and I noticed that I had a couple consistent issues when converting between the two formats. Exponential expressions seem to drop the exponent when the base is a number. Example: $$10^x$$ is converted to <mrow><mn>1</mn><mn>0</mn></mrow>. I also noticed that any expression with mathrm or operatorname seem to lose these values. For instance $$\mathrm{i}+3$$ converts to <mrow><mo>+</mo><mn>3</mn></mrow>