I use a custom LaTeX environment that creates a quotation box on export. A sample code looks like this:

* Org-mode heading

Here is a witty quote from a witty chap:


Witty quote!


To maintain readability of the org-file itself, I would rather use something like this:

* Org-mode heading

Here is a witty quote from a witty chap:

** Witty quote :ignore:
:PREFIX: \begin{fancyquote}
:POSTFIX: \end{fancyquote}

    Witty quote!

On export the LaTeX code in PREFIX and POSTFIX is then wrapped around the content of the heading, the heading itself not being exported.

Any ideas?


Use special blocks:

 Something very witty!
  • The # at the line start was swallowed up for the begin and end directives. – éric Aug 12 '17 at 7:16
  • I accept this as a better answer than mine, because my link solution is less useful when dealing with a lot of content within the environment. Thanks for pointing out this feature. – Singulaere Entitaet Aug 12 '17 at 7:29

I. The custom link type approach

One can define a custom link type, for example latexenv with org-add-link-type that wraps a specified latex environment around the text:

  1. Definition of the new link type with a babel code block:

    #+name: latex-env
    #+begin_src emacs-lisp   
     "latexenv" nil
       (lambda (path desc format)
         (when(eq format 'latex)
          (format "\\begin{%s}%s\\end{%s}" path desc path))))
  2. Use the link type with the desired LaTeX environment, for example fancyquote:

    [[latexenv:fancyquote][This text is within the environment fancyquote]]

II. The special block solution

As @éric pointed out in his answer, org-mode allows to use special blocks. Here is an example with a fictional environment fancyquote with parameters:

#+ATTR_LATEX: options: [Here]{There}{That}
Something witty!

This will export to LaTeX as:

  Something witty!

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.