From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YOIAHEFmrWMmZwEAbAwnHQ (envelope-from ) for ; Thu, 29 Dec 2022 11:04:49 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2A8LHEFmrWMPQAEA9RJhRA (envelope-from ) for ; Thu, 29 Dec 2022 11:04:49 +0100 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 510ED28988 for ; Thu, 29 Dec 2022 11:04:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAplt-0002By-2H; Thu, 29 Dec 2022 05:04:21 -0500 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 1pAplq-00028B-Cf for emacs-orgmode@gnu.org; Thu, 29 Dec 2022 05:04:18 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAplo-0001Kj-BS for emacs-orgmode@gnu.org; Thu, 29 Dec 2022 05:04:18 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 9136E240165 for ; Thu, 29 Dec 2022 11:04:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1672308253; bh=ebTIXN1B7sdSrkesT7uVzgvbnfv5SHr4HHx5JT5+Glc=; h=From:To:Cc:Subject:Date:From; b=Aur8ief8hXeYupCkD3d+0IyWPiOsolQME8QGSh/cI7ctvaInW+Kj8gOicRdAl70Xg EUXT6ULEFsWKPHVZ9SxQvb/32vCX1kFI1OYABV/wXR4SXV8U/NbHGPAaO81XQf626t t4x4MC0hA6WwaRVVHMH9SemjCxcDDgkOTUM7qNkLil5iEeqVZcaPhg+MAah4dRA22O UXZnegGwIUR0Z8a+iCH4lvD5lyfr8HwFEM4I65VkyWyDqm5dndK6tGJyEJjhROB6yk uTX0fp7efOBkCA5YZ5evzNBIyScQwEqW9RtPJzYy80ouPsPSg655euGW/sgHrwqtMt HUZcA/pdIgu/g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NjPB21qJVz9rxD; Thu, 29 Dec 2022 11:04:10 +0100 (CET) From: Ihor Radchenko To: alain.cochard@unistra.fr Cc: emacs-orgmode@gnu.org Subject: Re: Problems with LaTeX export for $x\text{foo $x$}$-like construts? In-Reply-To: <25516.19256.621545.995694@gargle.gargle.HOWL> References: <25516.19256.621545.995694@gargle.gargle.HOWL> Date: Thu, 29 Dec 2022 10:04:00 +0000 Message-ID: <87wn6av84v.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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=1672308289; a=rsa-sha256; cv=none; b=mjIoNYdnUcCEUf5jLyhkONQv03jS1tkMEOGGvcaB19JjUV+gLgGzKa98TwYlQtE96D2b2H a5LKIGRrwBH/uBaUrKoQSmiHtrA7o3Kn1h7igJo5LI0oi4G9++5kA0a49xGjZWpCow3ZMq xzzW7bjpTqiKHJnQD1MmlBQ0/iszWjQ7KFragy7YGAxW4pbnvyUu+b1Ge11md8mUj4RKjS CSsR97Rhh26RBNBTcaQSv+1vrVuUXfRCUMkTdA9HqNBs/YMOpfKAvMLLqCCtt56PG6FjLw BFesd8RPrvj+pvcyQ7vUDyb+giOKp84dDjklpPoSJyW6nA3H4G8pT+Ndx83sLw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Aur8ief8; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672308289; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vhq+W8DWC5dKc8B2CrZdEVTCB2xq0kHSR/Q3TRdjLU4=; b=XU2KPalElJMVM1H4Q076NcofNuGblTnIMiCr2srmaAuc7M5aFiP64jbFeEwfBELIR42bYu LeckvLq+PoF0tvxyJxPBO/OdiIa3cT7RR6gnadXakvEskhD8n4OrZJlrxpp0z8ufbcFw7K +qIf4DRJzI4rQQToH+6xl/NPkTKOTNjtPY3YetEa9hEMNFrQE3/4LQ7KKglyw7aptvxXlc JyCp/ovpE3GMTSLNJXj7I5/Xr6+2ydoX9/IZYrrxzTIrAC+Do4lA2DYTYNSkNGGHRtO4lo q8x7CeSoaPTEaK+xTzUAAkMRL8xRYot1dFF4ok/Pxx0A7xK+wza3J+eact4Ing== X-Spam-Score: -7.76 X-Migadu-Queue-Id: 510ED28988 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Aur8ief8; 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"; dmarc=pass (policy=none) header.from=posteo.net X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -7.76 X-TUID: +jbrqNpzBE6S Alain.Cochard@unistra.fr writes: > Version used: release_9.6-149-g554935 > > With an org file containing only > > #+begin_export latex > $x \text{foo $y$}$ > > \(x \text{foo \(y\)}\) > > $x \text{foo \(y\)}$ > > \(x \text{foo $y$}\) > #+end_export > > the pdf generated upon latex export gives as expected, i.e., with 'x' > and 'y' in mathematical font. This is to be expected because of how Org parser works. In particular, $-style math is tricky because Org allows "$" both as math delimiter and also as standalone symbol. There are trade-offs. For the \(...\), it is because Org parser does not understand nesting: it takes first opening \( and match it with the first closing \) - thus what you observe. Unfortunately, I do not see an easy solution without hitting parser performance. Our general approach is to avoid forward-parsing as much as possible with an exception to paired brackets (because Elisp allows parsing paired brackets fast using C-level code). However, AFAIK, there is no easy way to parse brackets that are not single symbols. "\(" is impossible to match using `scan-lists'. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at