gpt4 book ai didi

emacs - 如何将 ditaa 或点 block 导出为标题图(LaTeX)?

转载 作者:行者123 更新时间:2023-12-01 02:13:41 25 4
gpt4 key购买 nike

我有一个带有标题 ditaa 和点图的 org-mode 文档。当我导出到 LaTeX 时,生成的图像不会放在 figure 中环境,未给出 \caption ,并且没有给出 \label .其他源代码块导出正常。

我怎样才能解决这个问题?

这是一个示例 org-mode 文档:

* 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:

我在 Emacs 24.3.1 上使用 org-mode 8.2.10。

最佳答案

要让它工作,你需要有一个 #+RESULTS: #+BEGIN_SRC 下的部分 block 和标题,而不是:

* 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:

关于emacs - 如何将 ditaa 或点 block 导出为标题图(LaTeX)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27073114/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com