4

In the past, I have exported org-mode source code blocks into LaTeX floating environments, without any problems.

At some point (I have no idea when), this behavior has changed for me.

  1. The org manual says :float t is the default if the source block has a caption, but I get no \begin{figure} in the exported output.

    #+name: a
    #+caption: abc
    #+BEGIN_SRC SuperCollider -i
    abc.play;
    #+END_SRC
    

    -->

    \lstset{language=SuperCollider,label=a,caption={abc},captionpos=b,numbers=none}
    \begin{lstlisting}
    abc.play;
    \end{lstlisting}
    
  2. Source code blocks aren't processing #+ATTR_LATEX, whether it comes before the name and caption or immediately before #+BEGIN_SRC.

  3. If I try to force a float using #+BEGIN_FIGURE, I can't find a way to attach a placement string. #+ATTR_LATEX appears to be ignored.

Tried with org-mode v8.3.5.

[1] http://orgmode.org/manual/LaTeX-specific-attributes.html#LaTeX-specific-attributes

  • 1
    I got #3 working: #+ATTR_LATEX: :options [th]. #1 and #2, still no idea. – James Harkins Aug 3 '16 at 20:28
  • For me, using org-mode 8.3.4, #+ATTR_LATEX: :placement [th] works for #3, although I put this just above the #RESULT header created when running the source block (using C-c C-c) and I didn't add any manual #+BEGIN_FIGURE. – ph0t0nix Dec 5 '16 at 14:48
3

I use the following attribute in org file and it works with org-mode v8.2.10.

There are many bugs or incompatible updates in org-mode v8.3.5, so I suggest you to try it with v8.2.10.

#+CAPTION: example
#+LABEL: fig:example-fig
#+ATTR_LATEX: :placement [H]
[[file:example.png]]
  • 1
    That is for an image link. My question is about source code blocks. Also, I had originally been using 8.2-something when I saw the problem. I updated, thinking maybe it had been fixed, but the behavior didn't change. – James Harkins Aug 5 '16 at 16:30

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.