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 kNC/NLQyTGM2ywAAbAwnHQ (envelope-from ) for ; Sun, 16 Oct 2022 18:35:00 +0200 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 CLfANLQyTGNFdgEA9RJhRA (envelope-from ) for ; Sun, 16 Oct 2022 18:35:00 +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 729DB26769 for ; Sun, 16 Oct 2022 18:35:00 +0200 (CEST) Received: from localhost ([::1]:33296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ok6bJ-0004wS-Qk for larch@yhetil.org; Sun, 16 Oct 2022 12:34:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok6Zw-0004wF-Uf for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 12:33:32 -0400 Received: from mout02.posteo.de ([185.67.36.66]:32815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok6Zu-000426-Iv for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 12:33:32 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 76F49240106 for ; Sun, 16 Oct 2022 18:33:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665938006; bh=zUAXGpUFm00w1LiQAlE4WrVsejaXcqscZT53FWrNQxU=; h=From:To:Cc:Subject:Date:From; b=MXI7KngZC9HHAHJOqjqjncdWb9f6dQiXC/emIB2Q0HRkRofDhQ/SAdwoUvlNoTyRi /J5agKGF20Xp3hhiwA1tbb+LDXWDylobQ9770AASZVc9VIqMgmOyeUOKjqu2MO+jop Ne7hN4ArdQvmcBCAD9X0f/4AyGoHfLGKOlj790jXoFHJsl0ynrWWNSlbytFiDltOIR aMtA+iBb3R6+rbi49aHjgHoEJE606R197/OdMtJPKCVlIIxmbmme9Xa6PiY3ZiTIoe ao7Al+9cAS86QbZtCpnNLnq7iaT53OMbGXyYnFhqMVolcd7F5dgQmMkxu5S3q+x8OP aq3NPk1jW4NNA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mr5KJ6TqRz9rxY; Sun, 16 Oct 2022 18:33:24 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Verse block and separations (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 16:33:22 +0000 In-Reply-To: (Max Nikulin's message of "Sun, 16 Oct 2022 22:04:48 +0700") Message-ID: <87h703iv8t.fsf_-_@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.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, 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=1665938100; 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=g5BAG18N23fzr90erMzDJGTTKsnbxoYEAKEmR4N5WFk=; b=IDvQmq1wzYfD+fGRcSQj16z5CuGJFNW0mswcbkST/gEt8Nh4aaZGLmcIbJBabasJoe2g17 kH3mxO4vPPj4FavdeG/YFmeRy+ffgGgWeKJR1GbDu516Mb4JxYf6gK5A69WmSk3hmsuZM3 Cx24iQ3BLPUtjVrMWijKgMmt0P92pQz4Acu7tcsKMAvV2/azmPcTdEtpd8I6ZmfNRkywVC Ndik8399iQ4NDSew8SxiPwZZXCrUaUFgkAP1ervsGgLRRLD1H6AfyxFtj8Rr1OLC6Ootgt S+N8NpAkDeqpiWAscNDoGvwdFySrFvczk6y7P+qzg3cJIrItm2wfMObD6Hcl7Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665938100; a=rsa-sha256; cv=none; b=kHTI5HcAj1sSeEmbQdVe6/A48KI0XG9jwV7Jw3a1XPVcy8roqy0UaPdbvyFr6YM98eIBUX SzwSDsZOCEtvfmhCqdofBlI25i9UgGpv4Dy3Wf31ebuDqHOUJByr/cAbhsU7UiOwEO4h0t k4UKHQULn5MVIINVwj1nZ2kMvaC0Jj0CD4oivui8L9+CfWtrLBY1Bq4mV2H4jdniA9+OqW CEbRZvKOWIVlp+mE0pQLCxoAfvqnROdUeVAT/0IMeXwqMOB3P8bIFbQlbMLXkXj6PByb/n 5GdouA04zaegRXo+t2cOBRcJogndwgifltcrFwto141I0gkzZ8Jv3gtn6rNpwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=MXI7KngZ; 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: -5.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=MXI7KngZ; 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: 729DB26769 X-Spam-Score: -5.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: pfTCbI+X2hTJ Max Nikulin writes: > The following is irrelevant to the recent changes. I have tried > > ---- >8 ---- > text > > #+begin_verse > > a b > c d > > e f > g h > #+end_verse > > ---- 8< ---- > > With the fix Ihor committed today I have got > > ---- >8 ---- > text > \begin{verse} > \vspace*{1em} > a b\\\empty > c d\\\empty > \vspace*{1em} > e f\\\empty > g h\\\empty > \end{verse} > ---- 8< ---- > > My expectation was > ---- >8 ---- > \begin{verse} > a b\\\empty > c d > > e f\\\empty > g h > \end{verse} > ---- 8< ---- > > I am surprised that \vspace is added instead of empty line between > stanzas. Is there a reason to override LaTeX defaults? If such reason > exists would not it better to add > > \parskip=1em plus 0.5em minus 0.25em\relax > > before first verse line? Is hard coded rigid vertical space acceptable > when high quality output is desired? \vspace before first line looks > like a bug. Frankly speaking, nested calls of `replace-regexp-in-string' > makes the code hard to read. > > P.S. I have not found exact citation, but I noticed a mention: Lamport > expected that verse environment would get negative feedback from poets. First of all, I'm afraid that in my previous post I mixed up two different issues: the verse block bug and my personal opinions about the new added constant. I should have separated these topics, sorry. I answer here what you comment about the verse blocks and later I will open a different thread for the other issue. Yes, you're right: that \vspace is the normal behavior of the block when exporting to LaTeX, and it is certainly not quite correct. In LaTeX, both the out-of-the-box verse environment and the one provided by the 'verse' package (which, typographically speaking, is the correct way to represent verses in LaTeX) do not add a \vspace between stanzas. In the LaTeX input the separation between stanzas is expressed by an (at least) empty line. In fact, that space can be controlled by the verse package with the stanzaskip \length. I remember that I commented on this anomaly here on the list, a long time ago, but I can't find the original message... In my init I have redefined the verse block like this, so that there is a white line between stanzas, not \vspace (I have also added some things for the verse package, so that the numbering of verses is not broken). So your example would produce a white line under \begin{verse}, not the current \vspace, which would be irrelevant to LaTeX. But this is only a hack: (defun org-latex-verse-block (verse-block contents info) "Transcode a VERSE-BLOCK element from Org to LaTeX. CONTENTS is verse block contents. INFO is a plist holding contextual information." (let* ((lin (org-export-read-attribute :attr_latex verse-block :lines)) (latcode (org-export-read-attribute :attr_latex verse-block :latexcode)) (cent (org-export-read-attribute :attr_latex verse-block :center)) (attr (concat (if cent "[\\versewidth]" "") (if lin (format "\n\\poemlines{%s}" lin) "") (if latcode (format "\n%s" latcode) ""))) (versewidth (org-export-read-attribute :attr_latex verse-block :versewidth)) (vwidth (if versewidth (format "\\settowidth{\\versewidth}{%s}\n" versewidth) "")) (linreset (if lin "\n\\poemlines{0}" ""))) (org-latex--wrap-label verse-block ;; In a verse environment, add a line break to each newline ;; character and change each white space at beginning of a line ;; into a space of 1 em. Also change each blank line with ;; a vertical space of 1 em. (format "%s\\begin{verse}%s\n%s\\end{verse}%s" vwidth attr (replace-regexp-in-string "^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m))) (replace-regexp-in-string "\\(\\\\\\\\\n\\)+\\([ \t]*\\\\\\\\\\)+" "\n" (replace-regexp-in-string "\\([ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n" (setq contents (if lin (replace-regexp-in-string "\\(\n\\)+\\([ \t]*\n\\)+" "\\\\\\\\!\n\n" contents) contents)) nil t) nil t) nil t) linreset) info)))