From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KLfDDF6GVGJ6QAAAgWs5BA (envelope-from ) for ; Mon, 11 Apr 2022 21:49:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UCFiCV6GVGJ5UAAAauVa8A (envelope-from ) for ; Mon, 11 Apr 2022 21:49:50 +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 AF1629F4A for ; Mon, 11 Apr 2022 21:49:49 +0200 (CEST) Received: from localhost ([::1]:56766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ne02m-00028x-QR for larch@yhetil.org; Mon, 11 Apr 2022 15:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ne02N-00028k-7j for emacs-orgmode@gnu.org; Mon, 11 Apr 2022 15:49:23 -0400 Received: from mail-oln040092075049.outbound.protection.outlook.com ([40.92.75.49]:24582 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ne02L-0006cY-5d for emacs-orgmode@gnu.org; Mon, 11 Apr 2022 15:49:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JVOX5yQaCaF8YeptHtrcqwH4S9Wame2zMenYkCPGeKqSDRfS1OaTo6u6rM+u8660BEarePVwOYUQI41vl+gk7IZjZlolco4Q1nZ9p41TFaz3YygsVqSUzZdqabQjiKO82v08TsNrrzLBUrgbXZ/7CJSpOFDqrK96y6wQmrP1Is63+yiHWDiOFQl19POI8k4p4VDbtuwZYx5dTEVwcKrAK6E1VhdBRSv+3IdwGskkDlGHIvABEBJMzZRmeFVVTJ8qJx6FAu9H6mif5eaS4iSOTlUb1tDpYOyIAxc6kT3y++VYS98QbixU1o5z3Epbd2RyMWRJSykA5yEIWO46GttlMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/Hppz1PErS5tivi/t0Wn0dhLoqebTm+gL+wbQluUJi8=; b=THVHgCN9s3peGwengIEo30nhi4xAQZNh2PjGqkasxN8YMpMEeXisZUyO78QjA+VrEI7RWNccWvhqP9Vlag+sFCs6bC8Fmkg2bFtSNveH+G46xclxy0S2LII2AtvJ5T2A6HN/XquZ4Fws0df3zuqZGi90lye4KLy7HUM68A0JLq1otQ0+0MWaa5EbllXltvIzRrAHGeGSTRFvn8JvOaBXc1KPEIsHKGuqdzyPMJpp7yL0i5zbD6SYsm5Kr7+uwy9dimYcwudVKm35qbDF+FM+BJ1nUJAjywKKGgRdQeZEdbGLFxfxUxmAVDtc6uQXKNC1rn6Dfm3UKr5wCJs4iJGODQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AM0PR04MB5649.eurprd04.prod.outlook.com (2603:10a6:208:12a::21) by AM0PR04MB5972.eurprd04.prod.outlook.com (2603:10a6:208:120::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.30; Mon, 11 Apr 2022 19:38:14 +0000 Received: from AM0PR04MB5649.eurprd04.prod.outlook.com ([fe80::5994:7147:dc2c:bfaa]) by AM0PR04MB5649.eurprd04.prod.outlook.com ([fe80::5994:7147:dc2c:bfaa%3]) with mapi id 15.20.5144.030; Mon, 11 Apr 2022 19:38:14 +0000 From: =?windows-1250?Q?Vitus_Sch=E4fftlein?= To: "emacs-orgmode@gnu.org" Subject: ox-html: exporting LaTeX-environments Thread-Topic: ox-html: exporting LaTeX-environments Thread-Index: AQHYTdupT0bZsziPkUufbTt6UunTUQ== Date: Mon, 11 Apr 2022 19:38:13 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-tmn: [c28G9JBp1FcGEgQCsGeAsZ2kt2AdrTIx] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb38af94-8b67-4160-f700-08da1bf2d1ae x-ms-traffictypediagnostic: AM0PR04MB5972:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CqeF+dX4t1MjZiNU2DrUUp9hQq05RVlqpHlzZdaVUifeaLyCwMQo5sCeeRcJ3wOCFuJkFv1dK6AK67BgGBGncxn3aejdkEo0SYEgNfZhwyJYq/mWIxYHN8tkrl7/kc7ANZGRx7/vN+c/G9CEADVHzfp44sAqPRY+sbcl6kxQc5FX1dIo9FBn31/PIF7dtkf0F+6O+7yGufUM2sJLMUYTZQRRzpg8mXJluwGXGBZoXDTCQlUxxVgQQcmx1FKI0F1WzbFPlgq8ADWljW0OsRf5Pv5TonyI0Gy7OQUbc02URGEZiT5Ej26uE2ttk+Tv6wtzFgBH7ON7ek9FZk8YiCv18E1GT6dFoAi0Z/QigBvEN22MESfQc5EYOOG0kjYbt/gzyJaXSA5UjdMrqhjQplnbzL3IsUk3YUFUg0iWa+sCtqqtUzTo5MZ1lUWLInitDrrcim+3iSZxllGlZpTCV+iK+zIljixnsjyD9pGDVBFTvS3uG2AeJd0m8gZPpzffzbxBAi/zp6ksytBaEGCMeDpYuqXOtq4uANmAFF+RIGI4B6fLT80QZoz68GJVJyfkOHlBr/FRRgd2YhpVXCLHc5SV2w7xcc3v1spm5MXw9QyPvw58JG5/RQg6XIs5Im6VdQRy x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?windows-1250?Q?gwiJQ7+I9yWAMEyXrEMc5tSQrkI4gZEOWWIOxSAuxkyKgcIApGC581+h?= =?windows-1250?Q?nudfC8qhOgCAnTl8gb+tTWwlSAwFMKjacWIAkMuF4IoN8/9/gNYTXcKb?= =?windows-1250?Q?BYOHIAToz2YQIhPqxsPir7zyGPJ2pal37sCv8DaAkwp+4xO0+6OAGIJW?= =?windows-1250?Q?yU65brDvZkEAzZ9DXNe8l/hMn4Ju8ylhWIDAJMqRYJZ9SJgGqWeVWdrh?= =?windows-1250?Q?G+oqEbqAG+I3gA9kD/GwE9VBRJmw7BpFMp+yZhpUEeUEddX8efs+ZLLt?= =?windows-1250?Q?YcWTZCOR6gH6+kvCvifY4QuIbys5W5qWSHbgGfxtscMlPxXk3x5Gkoc0?= =?windows-1250?Q?bjp90PBB/QD8OnrhZShLPzkC5lF9cvIgGWe8bjMOIJWfwsO56EDkk+yA?= =?windows-1250?Q?ImtBicWwcVOHNUEIGBnKcXo9JeisLzv3LlaiQZaCnxtm93ohh4TKUhbd?= =?windows-1250?Q?7kf+phKmu2oZ6kFJhaI9SBEFaM4kuR8X43yHqjhky2sDkh3QysC2m7Kk?= =?windows-1250?Q?DUqo+3mp4bQJfROCp1PvLQaCAM+pDdZVYD18X49MzG30wSk3ciXIK7R8?= =?windows-1250?Q?eryqyPWgyiFWabJnzVpybIKXW1zlBalzdO+vx9on+8Y2YwZsPaTAr6p5?= =?windows-1250?Q?KAb6CB4CbBbUC2qcBYmbJag192iw5h3Zz1HJmRuQYWlf5PhallLk2bu4?= =?windows-1250?Q?oFHfyAPKBtWt07NkqYATb+enrZshlg7lqnUig+vCbYYUsh/4SebSKswo?= =?windows-1250?Q?gBzwyhRjSRV7AjOcaFmVlcA2BIpLt5C87NcUSH5s3osBKxKm4MhdoIIP?= =?windows-1250?Q?La216WGWX9zvhqcuC7HghZX3f83XXA1GWcOhaSp1qo0mY8qZtWjiGnGg?= =?windows-1250?Q?6RtCcbD5IhPFyOW6bqtLqQpGx/W+pLDcix8t2IY2kKG5u2g4aL+mr9MY?= =?windows-1250?Q?hAthSdqdN9F0LDIRQZ9kKWUmkOQQxgdzkoQ5Vy02KbnkWnrZ4uDvDxca?= =?windows-1250?Q?RmztVF9KVDI6bQGOcTBkfshe/xWJdwQMHO0j0TuYyGPaJESEa+e1R1MD?= =?windows-1250?Q?aXefqd/CHVW49njx8IZTJHib/u+9cV2GmZOw0osE3g3KUrX3qbvpsAfU?= =?windows-1250?Q?Omb0HsmGqfyfd9g+UMI40t2Ht4KpwGCsWaxCYZxRDr8KDolqNeU5eY2i?= =?windows-1250?Q?Zypki7q8l1TBbfwnxiU/N24fvWSP/I01vBQTWARO8pyV8n4xx4JDbbAe?= =?windows-1250?Q?VL5jUd9Qw88ee5CHRdLqbJjK0/d6eXRx/DA2QJKis5MA/Mqh97qfe35B?= =?windows-1250?Q?4s7Cl6HMJK6e2MANRCrtRidFndHOvJ0z69iOcYXIT32W6rAcjNxDbKKY?= =?windows-1250?Q?We3APe7mduJllYOShdZgu9D/uX8GgTb53qvwSbo0otvTaO8zfpqr2yDh?= =?windows-1250?Q?oOtOZ7ZRDnzOeQWpbRsHJlHX7cEqIGmeFjdPfT0eAass4kye9JSenRaA?= =?windows-1250?Q?qjldru5k6XCIKf6/eFJw5PzltqdEQzxrYzP3L6owgJrEm2DDTTE=3D?= Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-03a34.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5649.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: bb38af94-8b67-4160-f700-08da1bf2d1ae X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2022 19:38:13.9661 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5972 Received-SPF: pass client-ip=40.92.75.49; envelope-from=vitusschaefftlein@live.de; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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: , Cc: "thibault.marin@gmx.com" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649706589; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/Hppz1PErS5tivi/t0Wn0dhLoqebTm+gL+wbQluUJi8=; b=PwQ9sUKif0+ft+1uQZDcv0neSQqvIuyK23DYODDbs/3vapfBTjTJmQy693QSW+WK924UlC drP78XVV8Kob9QUcnilm7o+7pLXF3oJMQVQDer8o0k4+xfiKTvjoFQUTlzqEoQZ2X7+lFc ojOBJb2pIHEUXnRmgNaxkLMFnO02a0YqR3KIXODUPJl+6Wsvq7CyJcNeMYTezjLYy6ONRe 12VP2eEr79tLqfQL3mdtpsnGWGeRLVk86KLbNrd9aKkIstNGclw+DCCu1Ky1XUsS2VguRd RNwtzLT7PuKhLJ65sTLFKUmp2L3oqYJWJoiMaHsQ/4dfIUrQggReTBytvU8zfA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1649706589; a=rsa-sha256; cv=pass; b=IPm7q+j+1EaaORXctQbOeSjVHJzbDB+j55JDGmcn9untlm7awX1xJVii/4bnMXoCiUKsn1 d9JIefbHxqSGCmXjPp68D8kzKlSf5HCy6qvDOj9VXrs7n9aPwMOY5bhjUXEDc3m2bpUsbg v3Zacz9+iWDNZqnRioKzg4oNYO9uSiMYz9LKdc27ISz/r5qcrgLxelRkoIJRBFZ0xtjPBN 8mL8zNva0p6oLPhfTKP2/CbzLrVZ5uVi+lqkMAozrusOCnJ4R4yJ09Rehw599J+bYG1uaq 8ATq3IDlOR+boxN2AzA6qaDdtHxdtaMG2gUwYEbxUF6lbzTBcJOc4tF88pKDIw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=live.de (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-Migadu-Spam-Score: 0.63 Authentication-Results: aspmx1.migadu.com; dkim=none; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=live.de (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-Migadu-Queue-Id: AF1629F4A X-Spam-Score: 0.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: sEm4rLm5MBIZ Dear org-mode mailing list, first of all I want to express my appreciation for your work and the effort= s you put into getting org-mode together! You guys are awesome. I=92m writing to you because I am setting up my blog, for which I need fully-fledged LaTeX support, so I am inserting my code via svg images. Ther= e are quite some problems to get it working, though, and I am giving my best to try and repo= rt the issues I found. All of them regard ox-html. Most of what I wrrite can be found in this gith= ub discussion:=20 https://github.com/kaushalmodi/ox-hugo/discussions/618. 1. The current code in ox-html does not support equation numbers in parenth= eses. If you add span.equation-label:before { content: '('; } span.equation-label:after { content: ')'; } to your css file, strings of the form ( no ) are produced instead of string= s of the form (no); for example, you get ( 1 ) instead of (1). 2. Any environment (except in-line-math) gets an equation number. But some = environments should not have (html) equation numbers, like tcolorbox. 3. Any LaTeX environment name foo is changed to foo* (except it already end= s with an asterisk). For example, \begin{tabular} is changed to \begin{tabular*}; sa= me for \end{tabular}. But tabular* differs from tabular in needing an extra width= -argument, so the export won=92t work properly. I have put quite some elbow-grease into possible solutions, which I would l= ike to share with you. I am an emacs lisp beginner with background only in philosophical logic, so= bear with me. Changing (1) is simple. org-html--wrap-latex-environment produces the html = span class equation-label, where the equation number is then inserted. Specifically, i= t adds this string: "\n\n%s\n" 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 i= gnores newlines anyway. Changing (2) seems to be doable, too, and I think I know how to do it in th= eory: 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. 2 Change org-html--latex-environment-numbered-p. It is currently defined li= ke this: (defun org-html--latex-environment-numbered-p (element) "Non-nil when ELEMENT contains a numbered LaTeX math environment. Starred and \"displaymath\" environments are not numbered." (not (string-match-p "\\`[ \t]*\\\\begin{\\(.*\\*\\|displaymath\\)}" (org-element-property :value element)))) Now we need to adjust the regular expression in such a way that if element = has \begin{foo} or \begin{bar} etc. (that is, the environment name is a member of ox-html-latex-environments-no-number), it also returns nil. I think this is= doable. I thought about adding something like (not (or ; starred or display math (string-match-p "\\`[ \t]*\\\\begin{\\(.*\\*\\|displaymath\\)}" (org-element-property :value element)) ; environment of ox-html-latex-environments-no-number (string-match-p (format "\\begin{%s}" [any element of ox-html-latex-env= ironments-no-number]) (org-element-property :value element)) )) I don=92t know how to express in elisp what is in brackets, though. Does th= is make sense to you? I am a beginner with elisp, so I can only state the ideas I have but not impl= ement them (yet). As to (3): Which images receive label numbers is controlled by this part of org-html-latex-environment: (let ((formula-link (org-html-format-latex (org-html--unlabel-latex-environment latex-frag) processing-type info))) As you can see, at the moment, org-html--unlabel-latex-environment is appli= ed to every latex-frag. So we would again need a variable org-html--latex-environments-leave-unlabelled of the same form as above who= se members are all latex environments which should not be unlabelled. Then, we= could implement a condition like (let ((formula-link (org-html-format-latex ; if latex-frag is one of org-html--unlabel-latex-environment (if (string-match-p (format "\\begin{%s}" [any element of org-html--latex-environm= ents-leave-unlabelled]) latex-frag) ; then do not apply org-html-format-latex to latex-frag (org-html-format-latex latex-frag) ; else do apply org-html--unlabel-latex to latex-fra= g (org-html--unlabel-latex-environment latex-frag) processing-type info))) It would be great if you could have a look at my solutions. The code surely= is awful, but the ideas behind it might be of value to you. If you could tell me how to solve these= problems (or add a commit which addresses them), this would be awesome! I am planning to do an= in-depth guide on how to write full-fledged LaTeX in html using svg images created with ox= -html, and this is the last step I need for everything to work smoothly. Warm Regards, Vitus