emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)]
Date: Sat, 11 Mar 2023 10:38:25 +0000	[thread overview]
Message-ID: <87zg8jwp26.fsf@localhost> (raw)
In-Reply-To: <tufdb6$11h2$1@ciao.gmane.io>

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

Max Nikulin <manikulin@gmail.com> writes:

>>    [previous object <max(n1,n2) spaces>]
>
> Yes, you do.
>
> I expected some complications due to newline characters (not line break 
> markup objects), but they are not included in :post-blank and 
> represented as "\n" string objects.

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.

> Actually there is an issue with newline characters and ox-latex. 
> Stripping footnotes splits single paragraphs into 2 ones:
>
> ---- >8 ----
> #+options: f:nil
> First
> [fn::foot]
> Second
> ---- 8< ----
>
> So newlines should be handled somehow. Earlier I faced a similar issue with
> @@comment:export snippets@@
> and ox-latex.

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-latex-paragraph-Ensure-that-paragraphs-are-not-s.patch --]
[-- Type: text/x-patch, Size: 1455 bytes --]

From 92800f77ea6389b531c4d96cc4b32ed5557aa47a Mon Sep 17 00:00:00 2001
Message-Id: <92800f77ea6389b531c4d96cc4b32ed5557aa47a.1678531087.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 11 Mar 2023 11:34:45 +0100
Subject: [PATCH] org-latex-paragraph: Ensure that paragraphs are not split by
 empty lines

* lisp/ox-latex.el (org-latex-paragraph): If export creates single
paragraph contents with empty lines, remove the empty lines to ensure
that we retain a single paragraph.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tufdb6$11h2$1@ciao.gmane.io
---
 lisp/ox-latex.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index b84fe89db..f31d94da2 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2980,7 +2980,14 @@ (defun org-latex-paragraph (_paragraph contents _info)
   "Transcode a PARAGRAPH element from Org to LaTeX.
 CONTENTS is the contents of the paragraph, as a string.  INFO is
 the plist used as a communication channel."
-  contents)
+  ;; Ensure that we do not create multiple paragraphs, when a single
+  ;; paragraph is expected.
+  ;; Multiple newlines may appear in CONTENTS, for example, when
+  ;; certain objects are stripped from export, leaving single newlines
+  ;; before and after.
+  (replace-regexp-in-string
+   (rx (1+ (0+ space) "\n")) "\n"
+   contents))
 
 
 ;;;; Plain List
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2023-03-11 10:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 10:07 [BUG] No space after footnote with org-export-with-footnotes set to nil [9.6.1 ( @ /Users/test/.emacs.d/elpa/28.0/develop/org-9.6.1/)] Andrea Lazzarini
2023-03-03 14:44 ` Max Nikulin
2023-03-03 15:47   ` Ihor Radchenko
2023-03-03 16:47     ` Max Nikulin
2023-03-04 15:43       ` Andrea Lazzarini
2023-03-05 12:06       ` Ihor Radchenko
2023-03-05 12:32         ` Andrea Lazzarini
2023-03-05 12:42           ` Ihor Radchenko
2023-03-05 12:54             ` Andrea Lazzarini
2023-03-05 13:01               ` Ihor Radchenko
2023-03-06 12:18                 ` Max Nikulin
2023-03-07 13:59                   ` Ihor Radchenko
2023-03-08 15:14                     ` Max Nikulin
2023-03-09 12:43                       ` Ihor Radchenko
2023-03-09 15:04                         ` Max Nikulin
2023-03-10 12:08                           ` Ihor Radchenko
2023-03-10 14:03                             ` Max Nikulin
2023-03-11 10:38                               ` Ihor Radchenko [this message]
2023-03-13 15:17                                 ` Max Nikulin
2023-03-14 12:19                                   ` Ihor Radchenko
2023-03-27 14:16                                 ` Ihor Radchenko
2023-04-14 11:47                                   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg8jwp26.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).