2014-11-22 82 views
4

我有一个组织模式的文件,标题为ditaa和点数字。当我导出到LaTeX时,生成的图像不会放在figure环境中,而不是\caption,而不是\label。其他源代码块导出正常。如何将ditaa或点块导出为标题图形(LaTeX)?

我该如何解决这个问题?

下面是一个例子组织模式文件:

* Plain source code works 

#+CAPTION: This works 
#+LABEL: fig:works 
#+BEGIN_SRC 
this is a test 
#+END_SRC 

The above (Figure [[fig:works]]) is a figure with some source code. When 
exported to LaTeX, it is placed inside a ~figure~ environment and 
given a caption and label as expected. 

* Ditaa doesn't work 

#+CAPTION: Foo 
#+LABEL: fig:foo 
#+BEGIN_SRC ditaa :file foo.png :cmdline -E 
           /-----\ 
----------------------------->| foo |<----------------------------- 
           \-----/ 
#+END_SRC 

The above (Figure [[fig:foo]]) is a ditaa figure. When exported to LaTeX, 
the image is not inside a ~figure~ environment, it is missing the 
caption, and there is no ~\label~. 

* Dot doesn't work 

#+CAPTION: Bar 
#+LABEL: fig:bar 
#+BEGIN_SRC dot :file bar.png 
digraph foo { 
    asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -> b; 
} 
#+END_SRC 

The above (Figure [[fig:bar]]) is a dot figure. When exported to LaTeX, 
the image is not inside a ~figure~ environment, it is missing the 
caption, and there is no ~\label~. 

#+OPTIONS: toc:nil author:nil 
#+TITLE: 
#+DATE: 

我使用的组织模式8.2.10上的Emacs 24.3.1。

回答

3

得到它的工作,你需要有#+BEGIN_SRC块和标题下#+RESULTS:节改为:

* Plain source code 

#+CAPTION: This works 
#+LABEL: fig:works 
#+BEGIN_SRC 
this is a test 
#+END_SRC 

See Figure [[fig:works]]. 

* Ditaa 

#+BEGIN_SRC ditaa :file foo.png :cmdline -E 
           /-----\ 
----------------------------->| foo |<----------------------------- 
           \-----/ 
#+END_SRC 

#+CAPTION: Foo 
#+LABEL: fig:foo 
#+RESULTS: 
[[file:foo.png]] 

See Figure [[fig:foo]]. 

* Dot 

#+BEGIN_SRC dot :file bar.png 
digraph foo { 
    asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -> b; 
} 
#+END_SRC 

#+CAPTION: Bar 
#+LABEL: fig:bar 
#+RESULTS: 
[[file:bar.png]] 

See Figure [[fig:bar]]. 

#+OPTIONS: toc:nil author:nil 
#+TITLE: 
#+DATE: 
+0

但这对LaTeX的输出工作,但遗憾的是它不也为HTML输出工作。另外请注意,如果您进行了“C-C C-C”评估,它将会破坏任何现有的##结果块,以及您之前添加的任何##CAPTION和##LABEL。 – harpo 2015-01-09 03:25:06

+0

在撰写此评论时,HTML输出似乎已被修复 – bubak 2016-06-24 07:50:29