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 ms5.migadu.com with LMTPS id gAoIDn4bTWNOuQAAbAwnHQ (envelope-from ) for ; Mon, 17 Oct 2022 11:08:14 +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 aGEVDX4bTWMShQEAG6o9tA (envelope-from ) for ; Mon, 17 Oct 2022 11:08:14 +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 EA48ADB21 for ; Mon, 17 Oct 2022 11:08:13 +0200 (CEST) Received: from localhost ([::1]:35230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okM6W-0004Pq-Jl for larch@yhetil.org; Mon, 17 Oct 2022 05:08:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okM2X-0004Mn-Iw for emacs-orgmode@gnu.org; Mon, 17 Oct 2022 05:04:05 -0400 Received: from mout02.posteo.de ([185.67.36.66]:37977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okM2U-0007k9-0a for emacs-orgmode@gnu.org; Mon, 17 Oct 2022 05:04:04 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 776BE240105 for ; Mon, 17 Oct 2022 11:03:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665997439; bh=TntRPhtZ6TQoRlxZOWt6aNHVYBGzMouaiNyd/2EKqcs=; h=From:To:Cc:Subject:Date:From; b=krGimSGFAmGrDe6oXMNOryC9xT4luQYQ89/PaASGBjhJz2md5iUd4Ao87TdutjWY/ sJxv0W+LKh+rD15EPH0znoW7QDnB3qKtt+v9mTM8KgcZzH6yvipa1rr9EqFD6Im2QL Jpu09czfvphH5v5iygMvo8qWbvBHjGjii2GjPSTuuq+lh3L8lzYkNWPJOPG7Bcq+ZQ YbWYNFZGIZlTMNvbaiKtkUzCB9oFH8CBqiA1JNxQ9UhYy3p7xhZjII6yS3og0hGp7X 8hGLnRG+1h6oILzC8LLnOTrOX6WsB/g8m7aaWD3ddWT4X3/OmTyt7bzpif/BZB2SDK onsZcF+4sFEjw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MrWJ919Qzz9rxN; Mon, 17 Oct 2022 11:03:52 +0200 (CEST) From: Ihor Radchenko To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= , Daniel Fleischer Cc: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: Line breaks and brackets in LaTeX export (was: [bug] `org-latex-line-break-safe' breaks the export of verse blocks to LaTeX) In-Reply-To: <87a65vitbz.fsf_-_@posteo.net> References: <875ygk6a8z.fsf@posteo.net> <87a65vitbz.fsf_-_@posteo.net> Date: Mon, 17 Oct 2022 09:04:39 +0000 Message-ID: <87edv6izx4.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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, RCVD_IN_MSPIKE_H2=-0.001, 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=1665997694; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=rudmQgK59P6vqQgyQIF4ml5R0WlK+QdTmeSIUUfEK6A=; b=P64IvbKd0o8tJFrxWfsATBYEO6H4SXSnYK8KsaKhxZnJtobI4eaNHtnDyXLFDFGn5Xf+Qh 9KTQQmPT6t7BMWnF8kUp7kTX9/51No2xXJRCrCKP9YTEVEfWUGQcE3K1ZH6s3B84vZDVmS QDLxrpQuLVOrhneRK0x1F8QX8ekhfuUUMhXYPV7WYiwAfHaRVkVJ+uPoZF+AJGYhyJeY8X XFvnyO/bOCc85z5ayVYANaPVT1sE3GgqxeGcqGiGTjY7b2vukybpvQGGnx9EF+8lmYu17r jtetKoHmti2mMmxeu1Ybz8l4lbA9Z+jCQR+CjblWgUHMVc7kUiCjoC8B2I8yTQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665997694; a=rsa-sha256; cv=none; b=TTdVqSmXRni5jh0Tuh/k6MziA2urcJZ61fQhP6sPxYlc6RjKVC6Du9KsRz49YbXmPPm+XY RS7BbW7NTSOEjFkmbyMCp4v5fUVxfdtI6mXmS2bsCyROaCifohDwCRHCyTusSTPUbkPhWG sc5dDm051hOtpfhPwpnQUiVJefjFsVt2103p0johU+igClQgKIuGGOHpRbgLlHJQUR1bHN +LzeZ/SbvbcTY2vHWue7hV7IG14NVB6q/Rh5g0dbUIVGjicO8JL4v2wd2vSg0PNr7l4SR5 X+5Rlfd72ZuPJMWhMNQeunnT3+96NWNvDWV4A8piauWRkb/dmyfI3buyFqcyNg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=krGimSGF; 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.42 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=krGimSGF; 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: EA48ADB21 X-Spam-Score: -3.42 X-Migadu-Scanner: scn1.migadu.com X-TUID: qPz3cl2xLQS6 Juan Manuel Mac=C3=ADas writes: > 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. I tried to add the safe version of page break everywhere where there is a risk of a page break followed by square brackets. The key point: A valid Org file must be exported to a valid LaTeX file. If you know a selective solution, patches are welcome. (I am also CCing Daniel). I see no issue with defcustom in general, but can you explain what practical problems it is going to solve? I am not talking about aesthetics of the exported LaTeX. > 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} Won't it make it impossible to use @@latex:\\@@ @@latex:[1em]@@ deliberately? Note that we may also replace \\\empty with a single custom command. It will look a bit cleaner. Not sure if it is any different from your approach. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at