From: Florian Lindner <mailinglists@xgm.de>
To: emacs-orgmode@gnu.org
Subject: Re: Add caption to babel-generated images
Date: Tue, 30 Aug 2016 12:40:51 +0200 [thread overview]
Message-ID: <nq3nri$pve$1@blaine.gmane.org> (raw)
In-Reply-To: <87a8fuin1u.fsf@saiph.selenimh>
Am 30.08.2016 um 12:11 schrieb Nicolas Goaziou:
> Hello,
>
> Florian Lindner <mailinglists@xgm.de> writes:
>
>> I have this code block:
>>
[...]
>> When exporting to latex it nicely compiles into \includegraphics[width=.9\linewidth]{rbf-gaussian-4.pdf}.
>>
>> Now I want to have this \includegraphics in a figure environement including a label (to reference it) and a caption.
>>
>> How can do this best?
>
>> I have found:
>> http://emacs.stackexchange.com/questions/12150/add-caption-to-an-image-generated-by-a-code-block
>>
>> but it doesn't work for me.
>
> What did you write? What doesn't work?
This org mode document
#+NAME: fig:org_fig
#+BEGIN_SRC python :exports results :results file
import matplotlib.pyplot as plt, numpy as np
x = np.linspace(-2, 2, 1000)
plt.plot(x, np.exp(-np.power(4*x, 2)), label="shape-parameter=4")
for i in range(-4, 5): plt.axvline(1/6 * i, ymax = 0.1, ls = "-.", color="r")
plt.grid()
plt.savefig('rbf-gaussian-4.pdf')
return "rbf-gaussian-4.pdf"
#+END_SRC
#+CAPTION: Org Fig
#+LABEL: fig:org_fig
Exports to:
\begin{document}
\maketitle
\tableofcontents
\includegraphics[width=.9\linewidth]{rbf-gaussian-4.pdf} \\
% Emacs 24.5.1 (Org mode 8.2.10)
\end{document}
Additionally, when evaluating it's changed to:
[...]
#+END_SRC
#+RESULTS: fig:org_fig
[[file:rbf-gaussian-4.pdf]]
#+CAPTION: Org Fig
#+LABEL: fig:org_fig
Splitting off the caption and label.
Best,
Florian
next prev parent reply other threads:[~2016-08-30 11:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 9:27 Add caption to babel-generated images Florian Lindner
2016-08-30 10:11 ` Nicolas Goaziou
2016-08-30 10:40 ` Florian Lindner [this message]
2016-08-30 11:04 ` Georgiy Tugai
2016-08-30 11:54 ` Florian Lindner
2016-08-30 12:02 ` Florian Lindner
2016-08-30 11:55 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='nq3nri$pve$1@blaine.gmane.org' \
--to=mailinglists@xgm.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.