emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Small suggestion] on exporting verse blocks to LaTeX and vertical space


From: Juan Manuel Macías
Subject: [Small suggestion] on exporting verse blocks to LaTeX and vertical spaces
Date: Tue, 15 Dec 2020 18:21:13 +0100

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]