Re: [O] position figures side by side in PDF output

2015-05-21 Thread Zhihao Ding
Thanks a lot Andreas and Rasmus! 
The solution using the subcaption package works best for me. 

Best, 
Zhihao



 On 20 May 2015, at 22:03, Andreas Leha andreas.l...@med.uni-goettingen.de 
 wrote:
 
 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
  plot(1:10)
 #+end_src
 
 #+results: image1
 [[file:img1.pdf]]
 
 #+name: image2
 #+begin_src R :results graphics :file img2.pdf
  plot(1:5)
 #+end_src
 
 #+results: image2
 [[file:img2.pdf]]
 
 * 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
 #+end_src
 
 *** test
 #+name: combinedfig
 #+call: sidebyside(im1=img1.pdf, im2=img2.pdf) :results file
 
 #+caption: stitching side-by-side using imagemagick
 #+results: combinedfig
 [[file:out.png]]
 --8---cut here---end---8---
 
 Regards,
 Andreas



Re: [O] position figures side by side in PDF output

2015-05-20 Thread Rasmus
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.

—Rasmus

-- 
Need more coffee. . .




Re: [O] position figures side by side in PDF output

2015-05-20 Thread Andreas Leha
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
  plot(1:10)
#+end_src

#+results: image1
[[file:img1.pdf]]

#+name: image2
#+begin_src R :results graphics :file img2.pdf
  plot(1:5)
#+end_src

#+results: image2
[[file:img2.pdf]]

* 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
#+end_src

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

#+caption: stitching side-by-side using imagemagick
#+results: combinedfig
[[file:out.png]]
--8---cut here---end---8---

Regards,
Andreas