如何始终显示嵌入式图像?

问题描述 投票:3回答:1

我正在尝试使用内嵌图像(例如,用于通过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),将显示图像
  • 依此类推(这些选项来自Emacs org-display-inline-imagesInline images in org-mode问题)

    但是我不想按下任何特殊的按钮:默认情况下,我希望图像以嵌入式方式显示。我发现并尝试了以下变量:

      (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作者)-它为我解决了问题现在。也许对其他人有用

  • image emacs org-mode
    1个回答
    0
    投票
    我可以用以下方法重现该问题:

    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。
    1. M-xload-libraryRETorgRET
    2. 通过
    3. M-x
    4. Gnuplotorg-babel-load-languages添加到customize-option加载gnuplot.el
    5. 打开具有以下内容的组织文件,然后在源代码块上按
    6. C-c C-c
    gnuplot.el
    我有一个与您在问题中建议的解决方案类似的解决方案,但有所区别。

    在大型组织文档中重新显示图像可能需要一些时间。因此,只有在源块具有结果参数#+STARTUP: inlineimages Some text. #+BEGIN_SRC gnuplot :file plot.png :results graphics plot sin(x) #+END_SRC

    时,我才这样做

    graphics

    © www.soinside.com 2019 - 2024. All rights reserved.