From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gE1xDIY812TkewEASxT56A (envelope-from ) for ; Sat, 12 Aug 2023 10:02:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aLJMDIY812TrLAEAauVa8A (envelope-from ) for ; Sat, 12 Aug 2023 10:02: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 AC69651EB7 for ; Sat, 12 Aug 2023 10:02:13 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KwZC49kK; 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=1691827334; 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=qnQN1WSaZouzGdPC/NeEVFf8UbiLIand0eb9d98NuPY=; b=Zg18mbIOpqfz2Zvp3Uuoop7/Ay7EkGTku86z67QLV1dKl8G8vknuNArpAivPvkBEoNiN+v RulI1U33Qhcrg9nlO2iuLE+2HBzBE3vumXOAGsD1Old+aAFtj88lYD65Dg/HzQflP2wnT6 kW8SAhGvOU/SdFUFKAN4jMsDTcwCIaW8eBlCtAKnIngBzeAs3V7CJKU68fwpfsh7IHx2M+ qGLp6SsKxy+qt4JtTq0oKjrTIGap8QPShotUGvRbzoYHdjJ/b3k7/5LRWjWy5EmkTAugDO 6OOGDXRRF7cjbsAjmPU3sbuz6S8H5NTsTCrg8iAMarMR+VTCe7NJWb+w5xaKuA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KwZC49kK; 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-Seal: i=1; s=key1; d=yhetil.org; t=1691827334; a=rsa-sha256; cv=none; b=aoVLcHJrWb+a4CWJ4hof3Lw8UKny8w43PBBIfBtSLcDXHrhjV7as/TQuXlXN46w5miuwEG 0WkDEWrdHjUNlrltYJByMW3VQEVkryLIUV8dpO6s34HCeLEXDHbdZhvq82v37f9h2DqnfA amCjdmo5CRRVeYCYalFNkdITvdbWxUKc++R72o3ohiZ/0U8rDYe9YtejjWY9TF5YxMAvO2 GRYV4yq/DrHhwQR9slbVSBRblV54bZODozHNOiGljKOp8DkeC99YzTlTL5mH/bPky/Bd0J t6ICTDdtXJDDNGOpSEH85iUuMnwd5viGIOerNSM4O4kYEbnUWMBUzLxAyKcOmg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUjTv-0000Un-AF; Sat, 12 Aug 2023 03:56:19 -0400 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 1qUjTt-0000SR-85 for emacs-orgmode@gnu.org; Sat, 12 Aug 2023 03:56:17 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUjTq-00022S-8q for emacs-orgmode@gnu.org; Sat, 12 Aug 2023 03:56:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E8EE6240101 for ; Sat, 12 Aug 2023 09:56:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1691826970; bh=4tQYyeHT8wpuXP73izPXilbZJ+BOLlfx4HOR7+99BvM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=KwZC49kKC1Kk5Z3ZApxjdywlvOYO+cg7QhVxNn8HJtIm4aHOyCEQkcOFQxNarsN3a laLlWkmdgOqjHXFP0Pu4TC0IwI2SMEPCaUpTnlLLyfQOt3wnStX6MJUFYlgLd/fP15 VUq3efZQz9mT0JnLJzt4lBkHxo1IESYcbGuzIJPeyOg26hu1slsjMdw2LM8DKOKYxZ qrcQ0nUjYhV+blZDzaUTOHigPH8hex0xkeVbo8CvCwZpoFHlPEhtIWkGkJIhOq4AWA 13Td0Y/wtNQKlHaFXxGEDmJ+bhl6oGke3z3C4fErCvGZZOg51jLuBt2F8mXC/L/TcD xThXWBOdhi+9w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RNCf20m06z9rxF; Sat, 12 Aug 2023 09:56:09 +0200 (CEST) From: Ihor Radchenko To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= Cc: orgmode Subject: Re: [patch] ox-latex.el: fix blank lines behavior in verse block In-Reply-To: <87ttt59zsx.fsf@posteo.net> References: <87tttcml75.fsf@posteo.net> <87edkf6px1.fsf@localhost> <87350ug413.fsf@posteo.net> <87o7jgejhl.fsf@localhost> <87pm3wfvzx.fsf@posteo.net> <87il9nb62q.fsf@localhost> <871qgbb2q6.fsf@posteo.net> <874jl5526t.fsf@localhost> <87ttt59zsx.fsf@posteo.net> Date: Sat, 12 Aug 2023 07:56:36 +0000 Message-ID: <877cq04rt7.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: -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_H5=0.001, RCVD_IN_MSPIKE_WL=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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: AC69651EB7 X-Migadu-Scanner: mx1.migadu.com X-Spam-Score: -9.02 X-Migadu-Spam-Score: -9.02 X-TUID: 81xR9xpZc+Ga Juan Manuel Mac=C3=ADas writes: > How about this (pre-)patch? With the `:literal' attr., the content of the > block is exported "as is", with all manual formatting preserved. Looks reasonable in general. Of course, we will also need to document the new attribute. > I have made some modifications in the horizontal and vertical spaces (in > case :literal is used)... Makes sense to me. > + (vwidth (if (not lit) > + (if versewidth (format "\\settowidth{\\versewidth}{%s}\n" versewi= dth) "") > + "")) Can just do (if (and versewidth (not lit)) (format ...) "") > + (linreset (if (not lit) > + (if lin "\n\\poemlines{0}" "") > + ""))) (if (and lin (not lit)) ...) > (concat > (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" > + ;; into a normal space, calculated with `\fontdimen2\font'. > + ;; One or more blank lines between lines are exported as a > + ;; single blank line. If the `:literal' attribute is used, > + ;; CONTENTS is exported as is, with no environment, preserving > + ;; line breaks and vertical and horizontal spaces. > + (format (if (not lit) > + "%s\\begin{verse}%s\n%s\\end{verse}%s" > + "%s%s\n%s%s") In the case of lit vwidth and attr are always empty. So, you are inserting an extra newline in front. Is it intentional? > + (concat "\\(" > + (regexp-quote org-latex-line-break-safe) > + "\n\\)" > + "\\(^[ \t]*" > + (regexp-quote org-latex-line-break-safe) > + "\n" > + "\\)+") > + (concat "^[ \t]*" (regexp-quote org-latex-line-break-safe) "$")) May also use rx for better readability. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at