7

C-u C-u C-c C-x C-l or (org-toggle-prefix-fragment) with the double prefix argument used to toggle the display of LaTeX fragments across the whole buffer whether they were inside of #+BEGIN_LaTeX blocks or not. Now that behavior seems to have changed, as only LaTeX snippets outside of blocks are rendered. This isn't that big of a deal since export works as expected. However, I did like the old behavior. Is there a variable I need to set to restore the previous behavior? Alternatively, I'd like to typeset the equation and then have it generate an image file which gets saved to the buffer and inserted inline in the same way as the babel source blocks allow. Is that possible?

Below I give an example of how it works now:

example

  • 2
    NOTE: for Org 8.3.4 and newer, the syntax for delimiting LaTeX blocks is #+BEGIN_EXPORT latex and #+END_EXPORT (see here) – Mark Jun 30 '16 at 15:08
1

Now that behavior seems to have changed, as only LaTeX snippets outside of blocks are rendered.

Depends where the active point is. Here's the excerpt from the documentation for org-toggle-latex-fragment:

If the cursor is on a LaTeX fragment, create the image and overlay it over the source code, if there is none. Remove it otherwise. If there is no fragment at point, display all fragments in the current section.

With prefix ARG, preview or clear image for all fragments in the current subtree or in the whole buffer when used before the first headline. With a double prefix ARG C-u C-u preview or clear images for all fragments in the buffer.

I'd like to typeset the equation and then have it generate an image file which gets saved to the buffer and inserted inline in the same way as the babel source blocks allow. Is that possible?

Yes, just enclose them org-babel blocks like so:

#+name: hello-world
#+BEGIN_SRC latex :exports results :file test.png
\LaTeX
#+END_SRC

The second example in the LaTeX Source Code Blocks in Org Mode documentation shows how to embed latex generated graphics as png file in an org file.

  • Unfortunately, that latex source block returns the image file wrapped in a latex block. – wdkrnls Sep 7 '15 at 0:23
  • 1
    I found that this header worked: #+begin_src latex :results output raw graphics :file img/test.png – wdkrnls Sep 7 '15 at 0:24
  • 1
    That documentation says it will render all fragments in the buffer with the double prefix. That used to be true. Now it only previews fragments outside of #+BEGIN_LaTeX blocks. – wdkrnls Sep 7 '15 at 0:28
  • Is it possible to resize these images using the header so as to allow for both high resolution and fixed width in both the org buffer and the exported PDF? – wdkrnls Sep 7 '15 at 1:02
  • @wdkrnls I'm able to get it to work with just ... :results raw :file test.png, so at least for my setup the output and graphics args to :results are unnecessary – Daniel Kessler Jul 28 '16 at 20:05

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.