emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* position figures side by side in PDF output
@ 2015-05-20 16:30 Zhihao Ding
  2015-05-20 16:45 ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: Zhihao Ding @ 2015-05-20 16:30 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi there, 

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. 

     #+BEGIN_CENTER
     #+CAPTION[My short Caption]: my long caption
     #+NAME: fig:label
     #+ATTR_LATEX: :options page=1 :width \textwidth
    [[/path/to/my/figure1]]
     #+END_CENTER

Thanks a lot!

Zhihao


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: position figures side by side in PDF output
  2015-05-20 16:30 position figures side by side in PDF output Zhihao Ding
@ 2015-05-20 16:45 ` Rasmus
  2015-05-20 21:03   ` Andreas Leha
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2015-05-20 16:45 UTC (permalink / raw)
  To: emacs-orgmode

Hi Zhihao,

Zhihao Ding <zhihao.ding@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. . .

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: position figures side by side in PDF output
  2015-05-20 16:45 ` Rasmus
@ 2015-05-20 21:03   ` Andreas Leha
  2015-05-21  8:45     ` Zhihao Ding
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Leha @ 2015-05-20 21:03 UTC (permalink / raw)
  To: emacs-orgmode

Hi Zhihao,

Rasmus <rasmus@gmx.us> writes:
> Hi Zhihao,
>
> Zhihao Ding <zhihao.ding@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: position figures side by side in PDF output
  2015-05-20 21:03   ` Andreas Leha
@ 2015-05-21  8:45     ` Zhihao Ding
  0 siblings, 0 replies; 4+ messages in thread
From: Zhihao Ding @ 2015-05-21  8:45 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode@gnu.org

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.leha@med.uni-goettingen.de> wrote:
> 
> Hi Zhihao,
> 
> Rasmus <rasmus@gmx.us> writes:
>> Hi Zhihao,
>> 
>> Zhihao Ding <zhihao.ding@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-21  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20 16:30 position figures side by side in PDF output Zhihao Ding
2015-05-20 16:45 ` Rasmus
2015-05-20 21:03   ` Andreas Leha
2015-05-21  8:45     ` Zhihao Ding

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).