On 11/03/2023 17:38, Ihor Radchenko wrote:

Newlines are tricky. They may or may not be significant.
For example, in CJK paragraphs, newlines are to be stripped.

I think that a reasonable thing to do could be not adding newlines if
the previous object is a plain string ending with a newline.

It is in agreement with my expectation that the fix should not be LaTeX-specific. That is why I raised the issue in this thread.

This is latex-specific.
See the attached tentative fix.

Reported-by: Max Nikulin <maniku...@gmail.com>
Link: https://orgmode.org/list/tufdb6$11h2$1...@ciao.gmane.io

and Max Nikulin to emacs-orgmode. Re: Comments break up a paragraph when writing one-setence-per-line. Sun, 3 Oct 2021 18:34:10 +0700. https://list.orgmode.org/sjc4fk$76r$1...@ciao.gmane.io

+  (replace-regexp-in-string
+   (rx (1+ (0+ space) "\n")) "\n"
+   contents))

What I do not like with this regexp is that it matches every newline character, not only blank lines:

(replace-regexp-in-string
 (rx (1+ (0+ space) "\n")) "[n]"
 "a   \nb")
"a[n]b"

If you still believe that a fix should be for LaTeX only then I would consider extra "\n": (rx "\n" (1+ (0+ space) "\n"))

I have realized that the following is a kind of pitfall in Org syntax:

#+macro: comment
Another
{{{comment(Paragraph separator! Do you expect it?)}}}
paragraph.


Reply via email to