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

  • 2
    are you aware of #+verse environment? I.e. #+begin_verse ... #+end_verse? – wvxvw Jun 15 '17 at 13:26
  • See the solution to this emacs SE question.. use of a custom NEWLINE macro. – Kaushal Modi Jun 15 '17 at 19:03
  • ^^ I have used that but somehow It doesn't give the spacing I want – Praharsh Suryadevara Jun 16 '17 at 3:55
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
| improve this answer | |
4

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

| improve this answer | |
0

what about the followings both to LaTeX and HTML.

something \\
\\
\\
poem
| improve this answer | |
  • This does not work it has the same problem – Praharsh Suryadevara Jun 16 '17 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. – RUserPassingBy Jun 16 '17 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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