From: Thibault Marin <thibault.marin@gmx.com>
To: "Vitus Schäfftlein" <vitusschaefftlein@live.de>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: ox-html: exporting LaTeX-environments
Date: Tue, 12 Apr 2022 01:15:50 -0400 [thread overview]
Message-ID: <87lewax3rt.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <AM0PR04MB564988345CDA0E3275F65BBDA8EA9@AM0PR04MB5649.eurprd04.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2623 bytes --]
Hi Vitus, list.
My memory is quite fuzzy on this and I won't have a chance to take a
deep look until later, but I will try to share the information I have.
On Mon, 11 Apr 2022 19:38:13 +0000 (9 hours, 37 minutes, 37 seconds ago), Vitus Schäfftlein <vitusschaefftlein@live.de> wrote:
Dear org-mode mailing list,
[...]
3. Any LaTeX environment name foo is changed to foo* (except it already ends with an
asterisk). For example, \begin{tabular} is changed to \begin{tabular*}; same for
\end{tabular}. But tabular* differs from tabular in needing an extra width-argument, so
the export won’t work properly.
I had submitted a patch trying to address this
(https://list.orgmode.org/87h7ok3qi2.fsf@dell-desktop.WORKGROUP/, I have
attached a new version rebased on main to this message). It never made
it in and I failed to follow-up. This patch (or something similar)
could help with this issue. It basically only adds the star for math
environments (using org-html--math-environment-p)
[...]
Now the newline commands \n before and after %s are exported as whitespace. Just replacing
\n%s\n by %s (that is, leaving the newlines out) solves the problem. HTML ignores newlines
anyway.
This seems to work better indeed; the \n's were just cosmetic.
[...]
1 Create a new variable ox-html-latex-environments-no-number of the form ("foo"
"bar" "baz" ...), which contains all environments that should not receive equation
numbers.
I don't know whether org-html--math-environment-p (as used in the
attached patch) is sufficient to determine whether we need to add a star
to the environment or if we need another variable (in my use cases,
testing for a match environment is sufficient but it may not be the case
in general).
[...]
I don’t know how to express in elisp what is in brackets, though. Does this make sense to you? I
am a beginner with elisp, so I can only state the ideas I have but not implement them (yet).
This can be made to work if there is a consensus that we want to add a
ox-html-latex-environments-no-number variable (I can try to help with
that if needed, even though my elisp isn't great)
[...]
(let ((formula-link
(org-html-format-latex
(org-html--unlabel-latex-environment latex-frag)
processing-type info)))
The patch should address that, I would be curious to see if you
encounter additional problematic cases after applying it.
Thanks for resurrecting this and for your help detecting and fixing the issues.
Best,
thibault
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-Fix-automatic-numbering-of-non-math-.patch --]
[-- Type: text/x-diff, Size: 1294 bytes --]
From 61a27c4816a0dae1072f851cc67ea48cec2d362c Mon Sep 17 00:00:00 2001
From: thibault <thibault.marin@gmx.com>
Date: Tue, 12 Apr 2022 00:45:18 -0400
Subject: [PATCH] lisp/ox-html.el: Fix automatic numbering of non-math
environment
* ox-html.el (org-html-latex-environment): Prevent addition of * to
non-math environments. Added * is used for math environments to
replace latex equation numbering by org labels for html linking.
---
lisp/ox-html.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 81ef002a0..0968e2199 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2945,7 +2945,9 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((assq processing-type org-preview-latex-process-alist)
(let ((formula-link
(org-html-format-latex
- (org-html--unlabel-latex-environment latex-frag)
+ (if (eq nil (org-html--math-environment-p latex-environment))
+ latex-frag
+ (org-html--unlabel-latex-environment latex-frag))
processing-type info)))
(when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
(let ((source (org-export-file-uri (match-string 1 formula-link))))
--
2.33.0
next prev parent reply other threads:[~2022-04-12 5:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 19:38 ox-html: exporting LaTeX-environments Vitus Schäfftlein
2022-04-12 5:15 ` Thibault Marin [this message]
2022-04-15 10:23 ` AW: " Vitus Schäfftlein
2022-04-20 18:46 ` WG: " Vitus Schäfftlein
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=87lewax3rt.fsf@dell-desktop.WORKGROUP \
--to=thibault.marin@gmx.com \
--cc=emacs-orgmode@gnu.org \
--cc=vitusschaefftlein@live.de \
/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).