From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oFEqDHmzXGSZYQAASxT56A (envelope-from ) for ; Thu, 11 May 2023 11:20:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EPBYC3mzXGTfXQAAG6o9tA (envelope-from ) for ; Thu, 11 May 2023 11:20:57 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BB04A1A48D for ; Thu, 11 May 2023 11:20:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px2Sz-0002Od-TE; Thu, 11 May 2023 05:20:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px2Sy-0002OU-82 for emacs-orgmode@gnu.org; Thu, 11 May 2023 05:20:04 -0400 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px2Sw-0007fD-8X for emacs-orgmode@gnu.org; Thu, 11 May 2023 05:20:03 -0400 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-ba5ebdc4156so3782094276.3 for ; Thu, 11 May 2023 02:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683796800; x=1686388800; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=vEHo24o4Oeb2o24HQAvPmG7XByjrMihQy5EBAbBfNNM=; b=H/Dd7AUkrgLOYhnWOsvIrmeSPotHwSZGhL3Awq9Nmxw74dZMk3BaVOHgHH3eF/QATt 88ZWAnK+wAwNYol+9oJZ9Rbsltqm78YojDj2zsRhKMFjMuHb3xZQAdph5cJWALbh6ZR1 igb6SjfvE3xpILSVYibDmygYZhl+6aSeYkiRN1qbTbx6GQAhHMZvG0O91wlu+tarYpB8 QAAnDZ7a7QrVaWT4OriYgfWZI/bHV2Em6qX5BtbAws0PuQCJrS5oWqXnavM0Smijjlo8 9FkSg0Bp8ZjGJ8DGS4k0GSk1li4z8UAzMj74LUS7p2HR1gdu9Z1NrN+Y6est+7uuLe2f oLhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683796800; x=1686388800; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vEHo24o4Oeb2o24HQAvPmG7XByjrMihQy5EBAbBfNNM=; b=HsQAeqet1/mt3UKc8Ok4kIRh54+uKz483/K6BJUAp72wDF8WZ5TRlaitmFcS3NQIzl YrT2vgFgI8uNOTAWEG/18cg1Oc0wZHqyiUyymowZY4dAEXylX+efAOjFhDjhUXJ9Snof iJI0E30fYSSmqcxEsazjsEmVau8FV8Xt18cD8YcIIwf5h7GbQSE44P5881XfCUX2ge15 EBKP4elVUEpY3n6PYdVS+iQlwU2nP9PHHkHfAjHs97BFEOV2cCjHe3cg1KQz2a1yPTU/ wCXnnllSAxO0NhfdCWOUrN5+/hMTdsv7guyquTQ0UmX/mqbFVfTbqN7VUl5p6zUnx5P6 QNFQ== X-Gm-Message-State: AC+VfDzPfPdmWfL7fRtMwyThJZ5Yq4aRdW57HCSme0+3uCheHmgSJzaZ 1IEEttRTxVZe3efbhI57uuAz8t7nfPm+TWLWcRXKK7GMS+w= X-Google-Smtp-Source: ACHHUZ7UgifH+wcHZ6VbC929cf5juA9plKEGo+UyHhM6y7GuQDgZmZ7aH2249rfoEUP0R09VGTN21zDqfB12npYMKj4= X-Received: by 2002:a25:41c9:0:b0:b8f:327f:acab with SMTP id o192-20020a2541c9000000b00b8f327facabmr19211217yba.13.1683796800158; Thu, 11 May 2023 02:20:00 -0700 (PDT) MIME-Version: 1.0 From: Gustaf Waldemarson Date: Thu, 11 May 2023 11:19:49 +0200 Message-ID: Subject: [BUG] Wrap LaTeX Fragments in a Span [9.6.2 (release_9.6.2)] To: emacs-orgmode@gnu.org Content-Type: multipart/mixed; boundary="00000000000026126505fb677e9e" Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=gustaf.waldemarson@gmail.com; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683796856; a=rsa-sha256; cv=none; b=VFUiiVz/fCz4z1N+LxcwToT9fDvybrmMlmSqkmy06k5A64j9mfXcF5C/G/XTP8cdm5qRuj HmUbkCO0rGmZt2a2jVO6U0M4dGuRGLTpA3aiL8sxXoWvTqqQftUVEOfwFcrMoMloM9w13+ u+b7WF0h1kagiIxHEXj0hdFKa3f+FSI8CptMucMK5BzjHp4ZujWkv26Ri7nHGamSfhPw+Q +9IHPjOZuHMlrdgKmgHHvfxqD0pVu6xD6PYseZ98ZiOeVDsBfWQTIPWY5dHw233tLMrBhr iArn3DkUwW0mzLfRuUAP1iIbS822pDJSpvjYFZlVQJCU3WdTCpPwldrNKtZhtQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b="H/Dd7AUk"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683796856; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dYwf7eTEdIfBe2wFiBebXBLuCOVdXGQEwTxUJaRD2tw=; b=i2U8bvsJ3FODyJ2RQkfu1A6EyBaZSQf4suDuze5iZOtvuh7a6wiXvRkMQ17QhaXGy05eDU YVdNAZ8mi6Y9Efd2Du+d9BxxRp+c20OvDQTL3P6PFM2TZ3p2gXd7l0mE92tYrzI8MJ1BAe GPKa7viRuQt1vQv8u11lDD0BspO3GbFRcSfbEJHCkSXveVo8T/TT9xhgd8ywM+bIk3fmJy VaFbVEYUjbXz01+GHOK0ORF2BaIK9b+7DSLAe1cXMkxqjhF5Do/f4SdI3GjAeSFE+54plE Fi97eWh0RUsKmv0u7oR8l8aLnxw2oLOUtSGuCJGbf77Mj4CHOH1Z0fzFGKSsPw== X-Migadu-Spam-Score: 1.49 X-Spam-Score: 1.49 X-Migadu-Queue-Id: BB04A1A48D X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b="H/Dd7AUk"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: PzpwTxluKph4 --00000000000026126505fb677e9e Content-Type: multipart/alternative; boundary="00000000000026124d05fb677e9c" --00000000000026124d05fb677e9c Content-Type: text/plain; charset="UTF-8" Hello, The other day I wanted to do some additional styling of LaTeX (MathJax) elements, however, I noticed that none of them were actually captured in any HTML tag or CSS class, making this a bit cumbersome. So I spent a bit of time to look things up and see if this could be fixed and came up with the attached patch, which wraps all LaTeX fragments in a tag. Ideally, one should probably have separate CSS classes for inline fragments and full environments, but I wasn't really able to figure out how to separate those. Also, I don't know if this interferes with anything else, but it seems to work fine in some pretty big org-mode files for me at least. Below is also a simple test org-mode file, in case someone wants to try it out or add more test cases. #+TITLE: LaTeX to HTML Math Tests #+OPTIONS: * Environments This section should contain some supported MathJax environments. \begin{equation} e = mc^{2} \end{equation} \begin{equation*} f = ma \end{equation*} * Inline In this section we are talking about inline math, such as the equations \(e = mc^{2}\) or $f = ma$, which were proposed by some famous person. Best regards, Gustaf Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2023-04-04 Package: Org mode version 9.6.2 (release_9.6.2 @ /home/guswal01/.local/share/emacs/30.0.50/lisp/org/) current state: ============== (setq org-link-elisp-confirm-function 'yes-or-no-p org-directory "/home/guswal01/.config/emacs/org/" org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-log-into-drawer t org-latex-images-centered nil org-persist-after-read-hook '(org-element--cache-persist-after-read) org-export-before-parsing-hook '(org-attach-expand-links) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-archive-hook '(org-attach-archive-delete-maybe) org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-modules '(org-tempo ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) org-mode-hook '(#[0 " \205 --00000000000026124d05fb677e9c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

The other day I wanted to do some additional= styling of LaTeX (MathJax)
elements, however, I noticed that none of th= em were actually captured in any
HTML tag or CSS class, making this a bi= t cumbersome.

So I spent a bit of time to look things up and see if = this could be fixed and
came up with the attached patch, which wraps all= LaTeX fragments in a <span
class=3D"equation"> tag. Ide= ally, one should probably have separate CSS classes
for inline fragments= and full environments, but I wasn't really able to figure
out how t= o separate those.

Also, I don't know if this interferes with any= thing else, but it seems to work
fine in some pretty big org-mode files = for me at least.

Below is also a simple test org-mode file, in case = someone wants to try it out
or add more test cases.


#+TITLE: = LaTeX to HTML Math Tests
#+OPTIONS:

* Environments

This se= ction should contain some supported MathJax environments.

\begin{equ= ation}
=C2=A0 e =3D mc^{2}
\end{equation}
\begin{equation*}
=C2= =A0 f =3D ma
\end{equation*}

* Inline

In this section we a= re talking about inline math, such as the
equations \(e =3D mc^{2}\) or = $f =3D ma$, which were proposed by some
famous person.


Best regards,
Gustaf


Emacs =C2=A0: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-g= nu, GTK+ Version 3.24.20, cairo version 1.16.0)
=C2=A0of 2023-04-04
P= ackage: Org mode version 9.6.2 (release_9.6.2 @ /home/guswal01/.local/share= /emacs/30.0.50/lisp/org/)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D
(setq
=C2=A0org-link-elisp-confirm-function 'y= es-or-no-p
=C2=A0org-directory "/home/guswal01/.config/emacs/org/&q= uot;
=C2=A0org-bibtex-headline-format-function #[257 "\300 \236A\20= 7" [:title] 3 "\n\n(fn ENTRY)"]
=C2=A0org-log-into-drawer= t
=C2=A0org-latex-images-centered nil
=C2=A0org-persist-after-read-h= ook '(org-element--cache-persist-after-read)
=C2=A0org-export-before= -parsing-hook '(org-attach-expand-links)
=C2=A0org-cycle-tab-first-h= ook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)=C2=A0org-archive-hook '(org-attach-archive-delete-maybe)
=C2=A0or= g-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-fun= ction
=C2=A0org-ascii-format-drawer-function #[771 " \207" [] = 4 "\n\n(fn NAME CONTENTS WIDTH)"]
=C2=A0org-cycle-hook '(o= rg-cycle-hide-archived-subtrees org-cycle-show-empty-lines
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-cycle-optimize-window= -after-visibility-change org-cycle-display-inline-images)
=C2=A0org-pers= ist-before-read-hook '(org-element--cache-persist-before-read)
=C2= =A0org-modules '(org-tempo ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus = ol-info ol-irc ol-mhe ol-rmail
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0ol-eww)
=C2=A0org-mode-hook '(#[0 " \205
--00000000000026124d05fb677e9c-- --00000000000026126505fb677e9e Content-Type: text/x-patch; charset="US-ASCII"; name="0001-ox-html-Wrap-LaTeX-fragments-in-a-span.patch" Content-Disposition: attachment; filename="0001-ox-html-Wrap-LaTeX-fragments-in-a-span.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lhiwpfy90 RnJvbSA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