-
Notifications
You must be signed in to change notification settings - Fork 29
Description
current situation
types:
- rendered in display mode:
Latex_Environment
&Displayed_Math
- rendered in inline mode:
Latex_Fragment Inline/Display
syntax:
-
$content$
, TeX delimiters for inline math ->Latex_Fragment Inline
- cannot start/end with a space (defined behavior) Confusing behavior of LaTeX with trailing space logseq#4170
- cannot be multi-line
-
$$content$$
, TeX delimiters for displayed math$$
appears at the start of a line ->Displayed_Math
- can be multi-line
- good cases
- Used like codeblocks
- Only
$$content$$
in one line, no other content later
- bad case:
$$content$$ content
Inline math gets displayed in a block when placed at the start of a line logseq#4066
- otherwise ->
Latex_Fragment Display
- cannot be multi-line
-
\( content \)
, LaTeX delimiters for inline math ->Latex_Fragment Inline
- cannot be multi-line
-
\[ content \]
, LaTeX delimiters for displayed math ->Latex_Fragment Display
- cannot be multi-line
-
\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
explicitly -
Remove
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.,
$$a
b$$
and
$$a$$
are displayed math. But
$$a
$$b
and
$$a$$b
is equivalent to $a$b
For reference (and also an aternative), Typora's behavior:
$$
and$
can both be multi-line- displayed math only when used like codeblocks, i.e.,
$$
a
$$
The first two examples above are both inline math.