-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve math parsing #118
Comments
By the way, should them be added to Logseq's doc?... |
I came across this because of seeing what I think is too-aggressive math parsing. In the US, we often need to write about finances, so:
It would be great if logseq could somehow figure out that this should not be parsed as math -- maybe if the trailing (second) |
@garyo IIRC your example can be handled correctlu in logseq? Because there is a space before the second $ |
Yes, you're right. I've gotten into the habit of prefixing all my
but if I add spaces, then it's OK (no math mode, the
Was this improved some time recently? I find a lot of One case that could still be improved is if there is emphasis around the dollar figure:
That currently in logseq still switches into math mode. |
This is the behavior since the very beginning, but I proposed to change it in this issue. Now I think this behavior makes some sense.
IMHO it's almost impossible to handle this case (or other similar complicated ones) correctly. Otherwise math mode won't work correctly. In theory, maybe we can add an config option to opt-out math mode (or maybe only double |
current situation
types:
Latex_Environment
&Displayed_Math
Latex_Fragment Inline/Display
syntax:
$content$
, TeX delimiters for inline math ->Latex_Fragment Inline
$$content$$
, TeX delimiters for displayed math$$
appears at the start of a line ->Displayed_Math
$$content$$
in one line, no other content later$$content$$ content
Inline math gets displayed in a block when placed at the start of a line logseq#4066Latex_Fragment Display
\( content \)
, LaTeX delimiters for inline math ->Latex_Fragment Inline
\[ content \]
, LaTeX delimiters for displayed math ->Latex_Fragment Display
\begin{env} content \end{env}
, LaTeX environment->Latex_Environment
My improvement ideas
Allow multi-line for all
Latex_Fragment
. And allow$ content $
I'm actually interested why they don't support multi-line now. Is there a design consideration?
By the way, I don't understand why
\(\)
and\[\]
don't support multi-line text, since they useend_string
.(Instead,
$
usetake_while (fun x -> x <> '$' && x <> '\r' && x <> '\n')
, which banned\n
explicitlyRemove
Displayed_Math
since it's confusing. And in Logseq, letLatex_Fragment Display
rendered in display mode.For
$$
, If there's nothing before the starting$$
and nothing after the ending$$
, parse it intoLatex_Fragment Display
. OtherwiseLatex_Fragment Inline
.i.e.,
and
are displayed math. But
and
is equivalent to
$a$b
For reference (and also an aternative), Typora's behavior:
$$
and$
can both be multi-lineThe first two examples above are both inline math.
The text was updated successfully, but these errors were encountered: