如何在组织模式下调整图像大小

use*_*995 34 html resize export image org-mode

是否有一般方法来定义链接图像的大小(百分比或像素)org-mode

说我的.org文件中有以下链接:

[[~/images/example.jpg]]
Run Code Online (Sandbox Code Playgroud)

这JPG是太大,所以如果我将其导出为HTML或LaTeX或打开它org-modeC-c C-o i将只能看到图像的一部分.

yPh*_*hil 45

Org 8.0开始,"属性行现在采用plists ":

#+attr_html: :width 100px
#+attr_latex: :width 100px
[[~/images/example.jpg]]
Run Code Online (Sandbox Code Playgroud)


Ada*_*dam 16

根据Jacobo的评论,将以下内容添加到init.el文件中:

(setq org-image-actual-width nil)
Run Code Online (Sandbox Code Playgroud)

然后在组织模式下,您可以将其用于JPG和PNG的内联预览.似乎不适用于SVG(不知道为什么)

#+ATTR_ORG: :width 100
[[~/images/example.jpg]]
Run Code Online (Sandbox Code Playgroud)

如果你想为内联预览和html输出调整大小:

#+ATTR_HTML: width="100px"
#+ATTR_ORG: :width 100
[[~/images/example.jpg]]
Run Code Online (Sandbox Code Playgroud)


bzg*_*bzg 12

#+ATTR_HTML: width="100px"
[[~/images/example.jpg]]
Run Code Online (Sandbox Code Playgroud)

  • 为了使其工作,您需要在.emacs文件中设置它:`(setq org-image-actual-width nil)`.[解释其他可能的值和行为](http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01388.html)在这篇帖子中给org-mode的邮件列表 (7认同)

zky*_*ony 9

这是在 emacs Org 模式下调整图像大小以进行预览(而不是导出)的方法。通常,

  1. 我们希望在需要时将图像设置为特定宽度,例如 249px。
  2. 我们想要设置一个默认的图像宽度,这样我们就不需要+attr_html为每个图像指定 - 这会很乏味。

org-image-actual-width这可以通过如下配置来实现:

(setq org-image-actual-width (list 550))
Run Code Online (Sandbox Code Playgroud)

然后,在你的.org文件中,如果你有

#+attr_html :width 249
[[~/images/example1.jpg]]
Run Code Online (Sandbox Code Playgroud)

那么图像将以宽度 249px 显示在预览中。对于另一张未指定的图像+attr_*,将应用默认宽度 550px。

[[~/images/example2.jpg]]
Run Code Online (Sandbox Code Playgroud)

您可以从org-mode 源代码的文档中看到此行为:

When set to a number in a list, try to get the width from any
#+ATTR.* keyword if it matches a width specification like
  #+ATTR_HTML: :width 300px
and fall back on that number if none is found.
Run Code Online (Sandbox Code Playgroud)

我发现很难理解“列表中的数字意味着什么”,所以我查看了实现,确实,类似的东西(list 550)有效。


Ali*_*oth 5

这是一个有关如何使用百分比来调整图像大小的示例(组织模式9.0.5版)

#+CAPTION: Weight space                                                                                                                                     
#+ATTR_HTML: :alt neural network :title Neural network representation :align right                                                                          
#+ATTR_HTML: :width 50% :height 50%                                                                                                                         
https://i.stack.imgur.com/nzHSl.jpg
Run Code Online (Sandbox Code Playgroud)