emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Org syntax: \[ \] as block element instead of inline object


From: Max Nikulin
Subject: Org syntax: \[ \] as block element instead of inline object
Date: Sat, 2 Oct 2021 15:17:18 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

I like Timothy's idea that \[ \] markup should behave like block-level element rather than inline object. On the other hand, Nicolas convinced me that the problem is not only with filling paragraphs in Emacs using M-q and it requires change of Org grammar. That is why I do not think that suggested patch should be applied.

Although Org has its own syntax, \[ \] constructs are added for LaTeX snippets, so unless there is a strong reason, such construct should not be a surprise for users familiar with LaTeX.

As it pointed out by Nicolas, the following is a compatibility issue with such change.

The following will be invalid Org structure, however the problem is hidden in the case of exporting to LaTeX:
A \[
  1 \ne 2,
\] B

It should be typed as

A
\[ 1 \ne 2, \]
B

or

A
\[
  1 \ne 2,
\]
B

On 02/10/2021 03:41, Nicolas Goaziou wrote:

I wonder, why it is not a block element. As far as I know, the only
difference (even in the context of Org) between \(...\) and \[...\]
is, that the former denotes inline math and the latter denotes a math
block. And at least exporting to HTML (with MathJax) and LaTeX results
in a block equation for \[...\].

That's not true. Only some export back-ends can tell the difference
between \(...\) and \[...\], so in the context of Org, they are the
same.

Is there a valid use case for that backends, so they should not consider \[ \] as a block-level element? Otherwise I would tell that it is a bug in that backend and in Org parser.

Do you have a short summary or a pointer why \[...\] has been choosen
to be an inline element?

Yes: habit. Also, I don't think LaTeX treats it as a block element.
E.g.,

     text
     \[1+1=3\]
     text

is a single paragraph in LaTeX.

It is a single LaTeX paragraphs assembled in vertical mode from parts created in horizontal or math mode. Splitting text into lines (in horizontal mode) is performed for each part of paragraph independently. So LaTeX paragraph is more like "greater element" than just "element". There is no of similar concept in HTML + CSS, there are blocks and inline parts. Formatting like paragraph indents and vertical spacing between paragraphs may be achieved with CSS rules.

Visually formatted paragraph may contain several block-level elements.

P.S. Examples of HTML vs. LaTeX paragraphs in Org export that were not intuitive for me:
https://list.orgmode.org/orgmode/sd9h2q$t9a$1@ciao.gmane.io/T/#u




reply via email to

[Prev in Thread] Current Thread [Next in Thread]