我正在尝试使用内嵌图像(例如,用于通过gnuplot绘制数据),并且遇到了问题:图像在默认情况下始终以links插入。我需要做一些按键操作,以“强制” emacs显示内联的[[actual image,而不仅仅是文件链接。
例如我从gnuplot代码开始:#+BEGIN_SRC gnuplot :file plot.png
plot sin(x)
#+END_SRC
当我在此代码块上按C-c C-c
时,它会运行,并以链接到图像文件的形式显示结果:
#+RESULTS: [[file:plot.png]]
C-c C-x C-v
(org-toggle-inline-images)-链接确实被替换为内联图像M-x org-redisplay-inline-images
-链接确实被图像替换了(org-display-inline-images t t)
,将显示图像但是我不想按下任何特殊的按钮:默认情况下,我希望图像以嵌入式方式显示。我发现并尝试了以下变量:
(setq org-startup-with-inline-images t)
配置中的[.emacs
#+STARTUP: inlineimages
标头(setq org-display-inline-images t)
P.S。我在MacOS X上使用GNU Emacs v26.1,组织模式为v9.1.9-65,如果需要的话]
P.P.S。尽管这似乎是我的emacs / orgmode版本中的错误,并且我尚未报告,但与此同时,我发现了以下技巧:(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
(感谢ob-ipython作者)-它为我解决了问题现在。也许对其他人有用
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /home/xyz/.emacs.d/elpa/org-plus-contrib-20190415/)
复制:使用
emacs -Q
启动Emacs 26.3。- M-x
通过load-library
RETorg
RET- M-x
Gnuplot
将org-babel-load-languages
添加到customize-option
。加载gnuplot.el
- 打开具有以下内容的组织文件,然后在源代码块上按
- C-c C-c
。gnuplot.el
我有一个与您在问题中建议的解决方案类似的解决方案,但有所区别。在大型组织文档中重新显示图像可能需要一些时间。因此,只有在源块具有结果参数
时,我才这样做#+STARTUP: inlineimages Some text. #+BEGIN_SRC gnuplot :file plot.png :results graphics plot sin(x) #+END_SRC
: