From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id UOHEHU88TGNdnwAAbAwnHQ (envelope-from ) for ; Sun, 16 Oct 2022 19:15:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 4NvBHU88TGORmwAA9RJhRA (envelope-from ) for ; Sun, 16 Oct 2022 19:15:59 +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 2C4B1FF7D for ; Sun, 16 Oct 2022 19:15:59 +0200 (CEST) Received: from localhost ([::1]:59468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ok7Ez-0001D1-M9 for larch@yhetil.org; Sun, 16 Oct 2022 13:15:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok7Dr-0001Ci-Kg for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 13:14:47 -0400 Received: from mout01.posteo.de ([185.67.36.65]:38409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok7Dp-00018w-7t for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 13:14:46 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id F2B02240029 for ; Sun, 16 Oct 2022 19:14:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665940483; bh=noDHTWzmF+E/Iu2u9giRX1F2LbRctDj1vWvb249GNag=; h=From:To:Cc:Subject:Date:From; b=BmDLS92ifYhOeZI4ST1r2Cmqzi96xCBx1ZeZE4ZJ8duPbJoItLcFssqu8P7Z9O3O6 NHWae2d2lBJJlyZx9sTWW4pR0+B8M/dRxx13fW3GOSEsRl0lUri25YyuhzdCEZPBD0 yKrg8LjB2sza2M8EWU6eJH4fOAFQXshoaM92UN1rrfdwMvp7qn0zW+1UfG7nHs0zI7 MOq7I7n0oi8ClbAmaAtmvIHp09LQrMZbxLKwczY1FgMNubgVfssdCrw+z0cRpsnhbc 14PdJ+FIU2k9kj2QtfNX+6O0bbGKZv+ua+0MJB5PNSI0I2wcHxA2SYWtPG5+hfe5MB ookxiVCGz/2Pw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mr6Dy2p1Tz9rxB; Sun, 16 Oct 2022 19:14:42 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Line breaks and brackets in LaTeX export (was: [bug] `org-latex-line-break-safe' breaks the export of verse blocks to LaTeX) References: <875ygk6a8z.fsf@posteo.net> Date: Sun, 16 Oct 2022 17:14:40 +0000 In-Reply-To: (Max Nikulin's message of "Sun, 16 Oct 2022 22:04:48 +0700") Message-ID: <87a65vitbz.fsf_-_@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de 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, RCVD_IN_DNSWL_NONE=-0.0001, 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665940559; 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=hr9r3G/ntzEfTy6M87Gw/KcEyBFwKktlaroP0DD+p3A=; b=OsBvSW3G2zpm/h9KfCDj1jEvTrp1Zf3NU7Ex+bvZyKK5eO8XHHM2f/T0BxtiZuQGsc1RIC +tSU1H0P3LiZN6YnJInESH/+gUkBqh224EYLiBzJkJ0iBR8TlLcyxQcmTZAvSig8oGgSfy UbY7brjvhcNoN+k1dYfPnY/kriPl7NF0myzuhdqK+jOl7oC8UJWBhkeiO6/0zacXeS/IaR aM02muCbNkvFdDpuEeZX72ZfyV1OKpUTCAPsyw4QwhOM3kDbZVFmXy7VhaNskgDeZUk7Vn cgAYfonR8mKUBCmkA6QmV0a+vtNKJb4TdAsNE2LjlOtAw22G89vyYC3aNYE5/g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665940559; a=rsa-sha256; cv=none; b=V4RjqOR75Q5UzCIhUfqb8mg61c+Ey5KZMX308pJC/7Xb65N32BdzX3x62pFHohBQb4xYKy sTWz/ONpMsGRwahqc/kP3IImE+mnA2V2wTV+xu5IN7E77NYE9jvlhmOtFu6qKK3/5TjWtO PdWiFGI3bX+dfUfaF13vjuFBLiFsRwUxp8GDh0dhMMeRaijGSrjMe/c3wxXasBzlGF+Ngk GwToFGcx6HhN+PRfQlqnGiZgZZJg0/LRmvlYccDnVG2LTrtWpD/A/nu3KQ3We5D45EmeAh FFnrrCQgUyL9pemGl+/aLvWmmwO5I0NWs+bpwwhJVb4GF6h4csBc09EHvk8asQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BmDLS92i; dmarc=pass (policy=none) header.from=posteo.net; 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: -3.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=BmDLS92i; dmarc=pass (policy=none) header.from=posteo.net; 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: 2C4B1FF7D X-Spam-Score: -3.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: ZgXcdrEpdZEF Max Nikulin writes: > In my opinion Org has to apply a general solution merely because a table > may be result of evaluation of an org-babel code block. I may be wrong, > but I suspect that some users do not care what is the intermediate > format when they need a PDF file. > >> And finally, I think that applying a general solution to this problem is >> something that should be done(IMHO) in LaTeX and not in Org, > > Org has a bit more information concerning context of square brackets. > They may be just text of a table cell or contents of an export snippet. > In a LaTeX file they are just square brackets and there is no way to > distinguish them. > > I believe, it is a design flaw in LaTeX that the \\ command does not > have a counterpart with no optional * and [] arguments. For humans \\ is > enough, but it is fragile when LaTeX is used as an intermediate export > format. A part of the problem is that all 3rd party packages should be > adapted for the robust \\ sibling. Likely it may be solved by additional > pass in the exporter code but it will significantly increase its > complexity. I have no idea what is appropriate place to discuss such > issue with LaTeX developers. The solution of adding \relax or \empty is a good one. The problem is when it is applied massively and indiscriminately, bearing in mind that it is to prevent a problem that is, frankly, very rare. \empty is unlikely to have any side effects, but still, I don't like Org making these decisions for me and adding LaTeX code that I didn't ask for, in form or quantity. Isn't it possible to be more selective, like Pandoc does (I think), and add what needs to be added only when the problem is present? I don't know if the Pandoc thing has already been mentioned in past discussions, because these days I haven't been paying attention to the list. In any case, I would prefer: a) a selective solution; and if a) is not possible, at least b) a defcustom. This is an example I came up with of how it could be fixed selectively in LaTeX (big, big caveat: it's just a proof of concept and likely to produce errors in other contexts. I think if a LaTeX package to fix this isn't already out, it is either because the problem is very rare and the solution for particular cases is known, or because there are drawbacks inherent to LaTeX that I can't figure out right now): \makeatletter \def\my@protectlbrack{ \@ifnextchar{[}{\relax}{} \@ifnextchar{*}{\relax}{} } \let\old@break\\ \def\\{% \old@break\my@protectlbrack} %% for tables \let\old@tabularcr\@tabularcr \def\@tabularcr{% \old@tabularcr\my@protectlbrack} % for use the old commands \newcommand\oldbreak{\old@break} \newcommand\oldbreakt{\old@tabularcr} \makeatother \begin{document} lorem\\ [ipsum] lorem\\ *ipsum \begin{tabular}{cccc} a & a & a & a \\ [a] & a & a & a \\ *a & a & a & a \\ \end{tabular} \end{document}