组织导出:相当于'#+ ATTR_LATEX :: HTML 0.9 \ textwidth'的HTML

时间:2017-08-27 13:30:34

标签: html css emacs latex org-mode

如何将从org-mode导出的图像的图像宽度设置为html的倍数,即我希望HTML等效于以下latex-export选项:

#+ATTR_LATEX: :width 0.9\textwidth

MME:

#+CAPTION: Example image
#+ATTR_LATEX: :width 0.9\textwidth
[[file:image.jpg]]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.  Nulla posuere.  Donec vitae dolor.  Nullam tristique diam non turpis.  Cras placerat accumsan nulla.  Nullam rutrum.  Nam vestibulum accumsan nisl.

#+ATTR_HTML: :width content这样的东西不起作用。

1 个答案:

答案 0 :(得分:2)

以下似乎仍然有效,虽然IIUC width标记的<img>属性已被弃用(在HTML方面,而不是组织方面):

#+CAPTION: Example image
#+ATTR_HTML: :width 90%
[[file:images/img1.png]]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.  Nulla posuere.  Donec vitae dolor.  Nullam tristique diam non turpis.  Cras placerat accumsan nulla.  Nullam rutrum.  Nam vestibulum accumsan nisl.

这是用CSS做到这一点的一种方法:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/image-width.css" />

#+CAPTION: Example image
[[file:images/img1.png]]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Donec hendrerit tempor tellus.  Donec pretium posuere tellus.  Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.  Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.  Nulla posuere.  Donec vitae dolor.  Nullam tristique diam non turpis.  Cras placerat accumsan nulla.  Nullam rutrum.  Nam vestibulum accumsan nisl.

css/image-width.css文件包含以下内容:

img  { width: 90%; }