I am trying to change the style of block quote formatting in org-mode export to PDF via LaTeX.

Using this answer, I defined a new LaTeX environment called fancyquotes. I am successfully able to create block quotes with this styling by creating a special block:

#+BEGIN_fancyquotes
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
#+END_fancyquotes

This successfully creates the desired TeX output:

\begin{fancyquotes}
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
\end{fancyquotes}

However, for compatibility with org-mode export to HTML, I would prefer to use not a special block, but rather standard quote blocks:

#+BEGIN_QUOTE
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
#+END_QUOTE

The problem is that, by default, the above gets exported using the quote label:

\begin{quote}
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
\end{quote}

How do I direct org-mode to automatically export standard quote blocks to my newly defined new LaTeX environment and apply the labels \begin{fancyquotes} and \end{fancyquotes}? In other words, how do I redefine org-mode quote blocks in LaTeX export, changing it from the default label quote to the label fancyquotes?

Bonus question: For the fancyquotes LaTeX environment I defined, how do I specify the shadequoteauthor in my org-mode source?)

Interesting question. I put together this start based on this part of the manual. How you set this up will depend on how you want to use it. Based on my experiments, it seems easier to define a new exporter, like the manual suggests, than it is to redefine the latex one.

(defun my-org-latex-quote-block (quote-block contents info)
  "Transcode a QUOTE-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the block.  INFO is a plist
holding contextual information."
  (org-latex--wrap-label
   quote-block
   (format "\\begin{fancyquotes}\n%s\\end{fancyquotes}" contents)))

(org-export-define-derived-backend 'my-latex 'latex
  :translate-alist '((quote-block . my-org-latex-quote-block)))

You can then test the export with

(org-export-to-buffer 'my-latex "*Org MY-LATEX Export Results*")

This only does a dump to a buffer, but illustrates the basic idea.

Update:

I initially thought just redefining org-latex-quote-block should work, but it wasn't for me. I know why now. I have org set up to use async by default, which runs a separate emacs process with the default versions of the org functions. Turning off async makes this work too. To use this with async you would have to redefine the function in your org-export-async-init-file.

(defun org-latex-quote-block (quote-block contents info)
  "Transcode a QUOTE-BLOCK element from Org to LaTeX.
    CONTENTS holds the contents of the block.  INFO is a plist
    holding contextual information."
  (org-latex--wrap-label
   quote-block
   (format "\\begin{fancyquotes}\n%s\\end{fancyquotes}" contents)))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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