Hi Zhihao,

Rasmus <ras...@gmx.us> writes:
> Hi Zhihao,
> Zhihao Ding <zhihao.d...@imm.ox.ac.uk> writes:
>> Could anyone give me some advice on how to position figures side by side in 
>> PDF output?
>> I am trying to write a report, while my figures were all originally produced 
>> individually.  I’d like 
>> to put them, mostly two, sometimes three, side by side sharing a same 
>> caption and label. 
>> Below is the syntax I am using now, which can only do one figure. 
> Does this thread answer your question?  It would give you individual
> subcaptions, but you need not use them.
>      https://lists.gnu.org/archive/html/emacs-orgmode/2014-11/msg00548.html
> Otherwise you could use e.g. imagemagick to stick together figures.

As an alternative you could use a table.
+ easy
+ orgmode only (should work across backends)
- no scaling of images
- it is a table for latex (i.e. will appear in list of tables, etc.)

Here is a short example for the table approach and an imagemagick-based
solution as proposed by Rasmus.

--8<---------------cut here---------------start------------->8---
* generate images                                                  :noexport:
#+name: image1
#+begin_src R :results graphics :file img1.pdf

#+results: image1

#+name: image2
#+begin_src R :results graphics :file img2.pdf

#+results: image2

* export side-by-side

** table
#+caption: stitching side-by-side using tables
| [[file:img1.pdf]] | [[file:img2.pdf]] |

** using imagemagick

*** function                                                       :noexport:
#+name: sidebyside
#+begin_src sh :session none :results file replace :var im1="im1.png" :var 
im2="im2.png" :var outname="out.png"
  convert "$im1" "$im2" +append "$outname"
  echo "$outname"

*** test
#+name: combinedfig
#+call: sidebyside(im1="img1.pdf", im2="img2.pdf") :results file

#+caption: stitching side-by-side using imagemagick
#+results: combinedfig
--8<---------------cut here---------------end--------------->8---


Reply via email to