As a first approximation, you can use a table:
#+CAPTION: Original vs. Boxed
| [[./test-images/ex1.jpg]] | [[./test-images/ex2.jpg]] |
The caption is above, it is labeled "Table 1", but both of these can be fixed: the first by setting org-html-table-caption-above
to nil
, the second with an export filter.
EDIT: here's a complete example with the added filters:
* foo
#+CAPTION: Original vs. Boxed
| [[./test-images/ex1.jpg]] | [[./test-images/ex2.jpg]] |
* Code :noexport:
#+name: set
#+begin_src elisp
(defun my/html-filter-image-width(text backend info)
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string "<img src" "<img width=\"500px\" src" text)))
(defun my/html-filter-fix-caption(text backend info)
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string ">Table " ">Figure " text)))
(add-to-list 'org-export-filter-link-functions #'my/html-filter-image-width)
(add-to-list 'org-export-filter-table-functions #'my/html-filter-fix-caption)
(setq org-html-table-caption-above nil)
#+end_src
#+name: reset
#+begin_src elisp
(setq org-export-filter-link-functions (delete #'my/html-filter-image-width org-export-filter-link-functions))
(setq org-export-filter-table-functions (delete #'my/html-filter-fix-caption org-export-filter-table-functions))
(setq org-html-table-caption-above t)
#+end_src
You have to watch out that the regexps don't match unintended portions of the buffer.
I like putting code in code blocks in a special Code
section that's marked noexport
, at the end of the file , but there are other ways of doing it (e.g. you can define the functions in your init file, but set the variables through the file local variables mechanism.)
When you open the file, do C-c C-c
on the first code block to set up everything, then C-c C-e h h
to export. Note that the variables are global, so you might want to run the second code block before you kill the buffer to reset the values to what they were before (assuming that you have not changed the default value of org-html-table-caption-above
which is t
).
pdflatex
, but this question wasn't about that.