emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Small suggestion] on exporting verse blocks to LaTeX and vertical spaces
@ 2020-12-15 17:21 Juan Manuel Macías
  0 siblings, 0 replies; only message in thread
From: Juan Manuel Macías @ 2020-12-15 17:21 UTC (permalink / raw)
  To: orgmode

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

Hi,

When exporting a verse block to LaTeX, each empty line between
'stanzas' results in the command =\vspace*{1em}=, which is fine.

However, I would dare to suggest that, in order to be more consistent
with the LaTeX `verse' environment (both the one that comes by
default and the one provided by the verse.sty package) the separation
between stanzas should be marked with:

- the last line of the stanza without =\\=
- + one (at least) empty line

which is the correct (or at least the most common) way to separate the
stanzas within this environment, since each stanza is still a
paragraph whose lines are cut off. Thus, we could also redefine
globally the \stanzaskip length provided by the verse.sty package
(i.e. \setlength{\stanzaskip}{1.2em plus .2em minus .5em}, etc.).

For example, with this (the number of white lines does not matter):

#+begin_src org
  ,#+begin_verse
  Lorem ipsum dolor sit amet
  consectetuer adipiscing elit
  Lorem ipsum dolor sit amet
  consectetuer adipiscing elit

  Lorem ipsum dolor sit amet
  consectetuer adipiscing elit
  Lorem ipsum dolor sit amet
  consectetuer adipiscing elit
  ,#+end_verse
#+end_src

we should get:

#+begin_src latex
\begin{verse}
Lorem ipsum dolor sit amet\\
consectetuer adipiscing elit\\
Lorem ipsum dolor sit amet\\
consectetuer adipiscing elit

Lorem ipsum dolor sit amet\\
consectetuer adipiscing elit\\
Lorem ipsum dolor sit amet\\
consectetuer adipiscing elit\\
\end{verse}
#+end_src

Perhaps replacing these lines in =org-latex-verse-block=

#+begin_src emacs-lisp
(replace-regexp-in-string
	     "^[ \t]*\\\\\\\\$" "\\vspace*{1em}"
#+end_src

with something like this

#+begin_src emacs-lisp
(replace-regexp-in-string
	     "\\(\\\\\\\\\n\\)+\\([ \t]*\\\\\\\\\\)+" "\n"
#+end_src

?

(On the other hand, I also think that vertical spaces between groups
of lines in verse blocks should always be exported to any format as
a single fixed space, regardless of how many empty lines there are).

Regards,

Juan Manuel


[-- Attachment #2: Type: text/html, Size: 0 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-15 17:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 17:21 [Small suggestion] on exporting verse blocks to LaTeX and vertical spaces Juan Manuel Macías

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).