3

I want to emphasize a particular bit of text that contains a poem. The way I'm trying to do that is by inserting multiple line breaks

something \\ \\ \\ poem

However in html it renders the same way

something \ \ \ poem

How do I insert multiple line breaks to emphasize a piece of text in org mode

3
  • 2
    are you aware of #+verse environment? I.e. #+begin_verse ... #+end_verse?
    – wvxvw
    Commented Jun 15, 2017 at 13:26
  • See the solution to this emacs SE question.. use of a custom NEWLINE macro. Commented Jun 15, 2017 at 19:03
  • ^^ I have used that but somehow It doesn't give the spacing I want Commented Jun 16, 2017 at 3:55

3 Answers 3

4

The \\ works only in LaTeX.

Try this:

something
#+HTML: <br>
#+HTML: <br>
#+HTML: <br>
poem

An even better solution that would work for different exports would be to define your own NEWLINE macro. [Source].

#+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:|@@
something {{{NEWLINE}}}{{{NEWLINE}}}{{{NEWLINE}}}
poem
5

Please check your setting of org-export-preserve-breaks value. The following is in-buffer setting of the variable.

#+OPTIONS: \n:t

The following code become enabled in ox-html.el when the variable is t.

(setq output
    (replace-regexp-in-string
     "\\(\\\\\\\\\\)?[ \t]*\n"
     (concat (org-html-close-tag "br" nil info) "\n") output))

This means \\ at end of line only export to <br>.

Therefore,

something \\
\\
\\
poem

will export to:

something<br>
<br>
<br>
poem

Please see https://orgmode.org/manual/Export-settings.html

0
0

what about the followings both to LaTeX and HTML.

something \\
\\
\\
poem
2
  • This does not work it has the same problem Commented Jun 16, 2017 at 5:54
  • Oh, my! I don't know why, but both of newline in LaTeX, and <br> in HTML are exported and handled well in my Mac OS X environment, by just putting "\\". I thought this is so natural, which is not, and I can't figure it out yet. Commented Jun 16, 2017 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.