GithubHelp home page GithubHelp logo

allanchain / logseq-live-math Goto Github PK

View Code? Open in Web Editor NEW
33.0 1.0 1.0 1.06 MB

Type LaTeX in live mode!

License: Apache License 2.0

HTML 1.75% TypeScript 84.48% CSS 13.49% Shell 0.28%
logseq logseq-plugin math mathlive

logseq-live-math's Introduction

Logseq Live Math

Type LaTeX in live mode!

GitHub release total downloads

logseq-live-math integrates MathLive into Logseq, providing a better experience using Logseq with a lot of math.

live-math-demo.mp4

Tip

The above video is accelerated. Some shortcuts in the video are customized. It also uses logseq-display-math to render inline math in display style. Check it out for math render style, KaTeX macros, and more!

Features

  • ⌨️ Easy and convenient ways to trigger the MathLive input
    1. Using Control+Shift+M shortcut. Can rebind in Logseq settings

      It's recommended because it can both

      • create new math
      • edit existing math (just by placing input caret inside the math expression)
    2. Using the /math command

    3. Type $$. Can be disabled

    4. Select existing formula with the mouse (e.g. $\frac12$). Can be disabled

  • 📝 Edit LaTeX formula with MathLive, rich, intuitive, and fast
  • 🔄 Update the LaTeX formula in the block in real-time
  • 🔙 Press Enter to confirm
  • 🎨 Well-configured MathLive theme to match Logseq custom theme
  • 🔧 Configurable MathLive keybindings and inline shortcuts

Install

This plugin is available on the plugin marketplace. The simplest way to install it is from the marketplace.

You can also download the zip file under the release page, unzip it somewhere and Click Load unpacked plugin, and select the folder where the plugin code was unzipped. You may need to go to "Settings -> Advanced" to enable "Developer mode".

FAQ

How is this plugin different from the darwis-mathlive-plugin?

darwis-mathlive-plugin also integrated MathLive to Logseq, but it’s working in a different way which is not very convenient for me, as it’s not automatically converted to LaTeX and only supports display math.

How to disable the double-dollar trigger and select-and-edit?

Go to the settings page and disable them.

For select-and-edit, it's also possible to require a modifier key to be pressed. For example, if you configured the key to be Shift, then you need to hold the Shift key while selecting, so that the popup will show. If not holding the key, nothing will happen.

How to switch between display math ($$) and inline math ($)?

If you want to change the default style, go to the settings page and switch preferDisplay.

If you need to switch temporarily, you can click on the title of the popup to switch between Inline Math and Display Math. There is also a keyboard shortcut Ctrl + $ (e.g. with US layout, it's Ctrl + Shift + 4) which does the same job.

Besides, there is smartFormat option, which will choose prefered style according to the context. You can disable it if you don't like it.

How to configure keybindings and inline shortcuts?

If you clicked "Edit settings.json", you will notice this plugin comes with some examples. You can also read the MathLive documentation to learn more.

And don't forget to check out the GitHub Discussion thread! You are encouraged to share your configs there!

How can I input align / split etc.?

If you are using Control + Enter, you will find that MathLive doesn't handle this well (see #21).

As a workaround, you can create an inline shortcut:

"align": "\\begin{align*}\n#? &= #? \\\\\n #? &= #?\\end{align*}",

After typing "align", something like this will show

image

logseq-live-math's People

Contributors

allanchain avatar dependabot[bot] avatar yixuan-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yixuan-wang

logseq-live-math's Issues

[Bug] Livemath doesn't render right inside a cloze

What happened?

A bullet point in Logseq like this doesn't render correctly

$\det M$ = {{cloze $e^{tr\log M}$}}

Either the content is shown correctly rendered but with the cloze deactivated, or the cloze works but the content does not render. This might be a bug for logseq to fix, if you think that's the case, I'm happy to ping them.

Thanks again for this plugin - it does exactly what I need it to!

Logseq Version

0.10.7

Logseq Live Math Version

latest

Quick check

  • There is no existing issue about this bug

Additional context

No response

[Bug] non US keyboard problem (italian)

What happened?

in the plugin pop-up typing \ to write symbols and all doesn't trigger the list to appear, it instead just types it
image

it instead appears when pressing the key ù, which position in the italian layout corresponds to the \ position in the US layout
image
it doesn't always works though, sometimes it just types the ù character
other keys show similar behaviours

Logseq Version

0.10.6

Logseq Live Math Version

1.4.0

Quick check

  • There is no existing issue about this bug

Additional context

No response

Unable to edit with MathLive after block is created

I love this plugin, however, I seem to be unable to edit inserted math. I can use /math to start writing an equation and use [enter] to complete it, but selecting the block again doesn't make the MathLive editor come back as demonstrated in the GIF.

Is this a bug, or am I using the plugin wrong? I use the default theme and only have bullet threadings and tabs as plugins.

[Bug] Floating window for inline math editing shrinks as you type

What happened?

The window for inline math editing shrinks as you type, until it eventually becomes a vertical line.

math

Expected behaviour

The window does not get smaller when typing, instead it expands when the typed line reaches the on-screen keyboard button.

Platform

This happens on both Windows 11 and Kubuntu

Steps to reproduce

  1. Install Logseq
  2. Install Logseq Live Math plugin
  3. Type /math, enter and type again.

Logseq Version

0.10.1, 0.10.0

Logseq Live Math Version

1.3.0

Quick check

  • There is no existing issue about this bug

Additional context

  • No other plugins were enabled
  • Default theme
  • Default config

[Bug] Modular box always change into placeholder

What happened?

Screen.Recording.2024-01-21.at.12.53.04.AM.mov

The mod value box is always put into placeholder rather than the typed value.

Logseq Version

0.10.3

Logseq Live Math Version

1.4.0

Quick check

  • There is no existing issue about this bug

Additional context

No response

Examples of keybindings and inline shortcuts

This plugin is amazing!

Just a single issue I'm having: I couldn't manage to create any single keybinding even while looking at the provided link.

A possible solution would have been to put in the setting JSON an example for possible keybindings and/or inline shortcuts commented out.

Typing parenthesis in text mode results in invalid Latex

Platform

  • Logseq v0.10.0
  • Live Math v1.2.3
  • No other plugins installed

Problem

Trying to type parenthesis in text mode results in invalid Latex. This used to be a problem with old MathLive versions but was fixed a while ago in ac2f460. Furthermore, the problem does not exist in the latest MathLive demo (v0.97.4). Which is quite odd, since Live Math v1.2.3 should be using the same version.

Screenshots

  • Input
    image
  • Output
    image

[FR] Auto replace 'lines' environment with 'gather*'

Currently the lines environment is auto replaced with gather environment which is great since lines is not supported by KaTeX. However, the gather environment adds automatic line numbering which is not reliable in Logseq. Support for gather* environment was added in f59a5f9 upstream (ahead of the current version).

[FR] Add a keyboard shortcut to trigger the plugin

I feel typing /m<Enter every time I want to input math a bit cumbersome, especially when it's just sth short like $x\inX$.

I think we can add a shortcut, like ctrl+m? To trigger the math input like \math.

Closing the mathlive window upon unfocus

It seems that when unfocusing from Math Live - The Math Live window stays open.
This is (in my opinion) a sub-optimal default for two reasons:

  1. This is inconsistent with the logseq app (leaving a block editing will not result in staying in editing mode)
  2. This adds friction- unfocusing is an explicit action meant to change the current editing context, there's no use in adding a requirement for another action to "double-check" if the user was indeed meant to leave the Math-live context.

Add option to determine display mode based on the current line

As of now, changing the display mode is only possible with a mouse click (which takes a lot of time). It would be really nice if the extension can intelligently determine the display mode based on whether the math expression exists on an empty line or not.

  • Display Mode
    $$x^2$$
  • Inline Mode $x^2$

Change are reverted when closing the window after focus lost

When writing some piece of math. If one forgets to press enter before pressing (or moving) to another bullet the mathlive window stays open. This is not a big issue except exiting the window reverts the math block back to what it was prior entering mathlive (instead of leaving it as it is)

A (resonable) possible solution would be to close the mathlive window, saving the change, every time the user presses somewhere outside of the mathlive window.

Selecting text with math might cause mathlive to open

Selecting a block with the following text opens mathlive:

"""
sometext
$$somemath$$
"""

this is problematic since this means one can't (for example) copy-select an entire paragraph if ends with a math environment.
this is true whenever one copies a text with math block on a sperate line

[Bug] multiline math issues

What happened?

issues

It should be \begin{align}\end{align}

Logseq Version

0.10.3

Logseq Live Math Version

1.3.1

Quick check

  • There is no existing issue about this bug

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.