* LaTeX export: images subplots
@ 2013-09-12 1:56 Martin Leduc
2013-09-12 2:47 ` John Hendy
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Martin Leduc @ 2013-09-12 1:56 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
Hi all,
I am using org-mode to write a report with several figures. I would like to group some images into a same figure, let say a 2x2 panel. I know that I can directly embed latex code in my org file, for example by using the subfloats (from the latex subfig package).
However, I would prefer to use an org-based solution of inserting the image links in order to keep the convenient way of previewing images right into the buffer with C-c C-x C-v.
The only solution I found is by using tables such as:
#+CAPTION: Insert caption here.
#+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
| [[pathtoimage]] | [[pathtoimage]] |
| [[pathtoimage]] | [[pathtoimage]] |
where the size of the images is controled by p{} and C-cxv is working. However, in the exported TeX file, it is a table, not a figure. Is there a cleaner way to make image panels that would preserve the figure environment in the exported TeX file ?
Thanks a lot,
Martin
[-- Attachment #2: Type: text/html, Size: 1234 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 1:56 LaTeX export: images subplots Martin Leduc
@ 2013-09-12 2:47 ` John Hendy
2013-09-12 3:13 ` Martin Leduc
2013-09-13 11:02 ` Suvayu Ali
2013-09-12 4:45 ` Charles Berry
2013-09-12 10:38 ` Rasmus
2 siblings, 2 replies; 8+ messages in thread
From: John Hendy @ 2013-09-12 2:47 UTC (permalink / raw)
To: Martin Leduc; +Cc: emacs-orgmode@gnu.org
On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> Hi all,
> I am using org-mode to write a report with several figures. I would like
> to group some images into a same figure, let say a 2x2 panel. I know that I
> can directly embed latex code in my org file, for example by using the
> subfloats (from the latex subfig package).
>
> However, I would prefer to use an org-based solution of inserting the image
> links in order to keep the convenient way of previewing images right into
> the buffer with C-c C-x C-v.
>
> The only solution I found is by using tables such as:
>
> #+CAPTION: Insert caption here.
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | [[pathtoimage]] | [[pathtoimage]] |
>
> where the size of the images is controled by p{} and C-cxv is working.
> However, in the exported TeX file, it is a table, not a figure. Is there a
> cleaner way to make image panels that would preserve the figure environment
> in the exported TeX file ?
Just wanted to cite my similar (same?) question from a bit back:
- http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
The only suggest I got was to use the subfig package, which may
actually be something like what you're looking for.
I guess p{width} /could/ work for what I was going for, but I will
often stagger images and my own "captions" via the org table:
#+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
| [[pathtoimage]] | [[pathtoimage]] |
| /blah blah/ | /blah blah/ |
| | |
| [[pathtoimage]] | [[pathtoimage]] |
| /blah blah/ | /blah blah/ |
| | |
I don't like using p{} because everything is left aligned and I like
to center the images and the "caption" text below each one.
Unfortunately, there's no centered equivalent to p{}. Thus, I end up
using \includegraphics[widt]{} manually.
Anyway, sorry if that's off-topic. Just wanted to voice that I have a
use for this general sort of thing as well. Heck, I think even
applying the beamer columns principle to LaTeX article classes would
work and be quite neat.
Thanks,
John
>
> Thanks a lot,
> Martin
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 2:47 ` John Hendy
@ 2013-09-12 3:13 ` Martin Leduc
2013-09-12 3:19 ` John Hendy
2013-09-13 11:02 ` Suvayu Ali
1 sibling, 1 reply; 8+ messages in thread
From: Martin Leduc @ 2013-09-12 3:13 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 3143 bytes --]
Hi John,
this solution using tables was indeed inspired from your post, I am so sorry, I should have refered to it...
I suppose that the feature has not been implemented yet. I am now thinking of generating a panel with imagemagick before including it in the org buffer, for example with
#+begin_src sh
convert +append image1.png image2.png panel.png
#+end_src
and hence
#+CAPTION:
[[panel.png]]
to have the two images side by side both in the buffer (with C-cxv) and the latex pdf (within a figure environment).
Is there a cleaner org solution that I would have missed ?
Thanks again,
Martin
> Date: Wed, 11 Sep 2013 21:47:08 -0500
> Subject: Re: [O] LaTeX export: images subplots
> From: jw.hendy@gmail.com
> To: mart_00@hotmail.com
> CC: emacs-orgmode@gnu.org
>
> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> > Hi all,
> > I am using org-mode to write a report with several figures. I would like
> > to group some images into a same figure, let say a 2x2 panel. I know that I
> > can directly embed latex code in my org file, for example by using the
> > subfloats (from the latex subfig package).
> >
> > However, I would prefer to use an org-based solution of inserting the image
> > links in order to keep the convenient way of previewing images right into
> > the buffer with C-c C-x C-v.
> >
> > The only solution I found is by using tables such as:
> >
> > #+CAPTION: Insert caption here.
> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> > | [[pathtoimage]] | [[pathtoimage]] |
> > | [[pathtoimage]] | [[pathtoimage]] |
> >
> > where the size of the images is controled by p{} and C-cxv is working.
> > However, in the exported TeX file, it is a table, not a figure. Is there a
> > cleaner way to make image panels that would preserve the figure environment
> > in the exported TeX file ?
>
> Just wanted to cite my similar (same?) question from a bit back:
> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
>
> The only suggest I got was to use the subfig package, which may
> actually be something like what you're looking for.
>
> I guess p{width} /could/ work for what I was going for, but I will
> often stagger images and my own "captions" via the org table:
>
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | /blah blah/ | /blah blah/ |
> | | |
> | [[pathtoimage]] | [[pathtoimage]] |
> | /blah blah/ | /blah blah/ |
> | | |
>
> I don't like using p{} because everything is left aligned and I like
> to center the images and the "caption" text below each one.
> Unfortunately, there's no centered equivalent to p{}. Thus, I end up
> using \includegraphics[widt]{} manually.
>
> Anyway, sorry if that's off-topic. Just wanted to voice that I have a
> use for this general sort of thing as well. Heck, I think even
> applying the beamer columns principle to LaTeX article classes would
> work and be quite neat.
>
>
> Thanks,
> John
>
> >
> > Thanks a lot,
> > Martin
> >
> >
[-- Attachment #2: Type: text/html, Size: 3830 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 3:13 ` Martin Leduc
@ 2013-09-12 3:19 ` John Hendy
2013-09-13 3:32 ` Martin Leduc
0 siblings, 1 reply; 8+ messages in thread
From: John Hendy @ 2013-09-12 3:19 UTC (permalink / raw)
To: Martin Leduc; +Cc: emacs-orgmode@gnu.org
On Wed, Sep 11, 2013 at 10:13 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> Hi John,
> this solution using tables was indeed inspired from your post, I am so
> sorry, I should have refered to it...
>
Ha! No problem at all -- small mailing list world :)
> I suppose that the feature has not been implemented yet. I am now thinking
> of generating a panel with imagemagick before including it in the org
> buffer, for example with
>
> #+begin_src sh
> convert +append image1.png image2.png panel.png
> #+end_src
>
> and hence
>
> #+CAPTION:
> [[panel.png]]
What in the wide world of sports!? That's amazing and I can't believe
I've never run into that. Sooo flipping handy. I've been looking for
an easy way to do this with dissimilar ggplot2 plots where facetting
is hard or doesn't make sense as well:
- Like this: http://stackoverflow.com/questions/18046051/setting-individual-axis-limits-with-facet-wrap-and-scales-free-in-ggplot2
That's pretty awesome and I just tried it; works beautifully.
Then again, I think handling images in Org tables would be just
fantastic. Not need for an external program or the compile time.
Perhaps a bit tricky as one would have to infer from some #+attr_latex
property that one wanted to apply some size parameter to every
[option] box of the converted \includegraphics line...
In any case, thanks for this and I'll keep that in mind. Hopefully
others chime in.
John
>
> to have the two images side by side both in the buffer (with C-cxv) and the
> latex pdf (within a figure environment).
>
> Is there a cleaner org solution that I would have missed ?
> Thanks again,
> Martin
>
>> Date: Wed, 11 Sep 2013 21:47:08 -0500
>> Subject: Re: [O] LaTeX export: images subplots
>> From: jw.hendy@gmail.com
>> To: mart_00@hotmail.com
>> CC: emacs-orgmode@gnu.org
>>
>> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc <mart_00@hotmail.com> wrote:
>> > Hi all,
>> > I am using org-mode to write a report with several figures. I would like
>> > to group some images into a same figure, let say a 2x2 panel. I know
>> > that I
>> > can directly embed latex code in my org file, for example by using the
>> > subfloats (from the latex subfig package).
>> >
>> > However, I would prefer to use an org-based solution of inserting the
>> > image
>> > links in order to keep the convenient way of previewing images right
>> > into
>> > the buffer with C-c C-x C-v.
>> >
>> > The only solution I found is by using tables such as:
>> >
>> > #+CAPTION: Insert caption here.
>> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
>> > | [[pathtoimage]] | [[pathtoimage]] |
>> > | [[pathtoimage]] | [[pathtoimage]] |
>> >
>> > where the size of the images is controled by p{} and C-cxv is working.
>> > However, in the exported TeX file, it is a table, not a figure. Is there
>> > a
>> > cleaner way to make image panels that would preserve the figure
>> > environment
>> > in the exported TeX file ?
>>
>> Just wanted to cite my similar (same?) question from a bit back:
>> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
>>
>> The only suggest I got was to use the subfig package, which may
>> actually be something like what you're looking for.
>>
>> I guess p{width} /could/ work for what I was going for, but I will
>> often stagger images and my own "captions" via the org table:
>>
>> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
>> | [[pathtoimage]] | [[pathtoimage]] |
>> | /blah blah/ | /blah blah/ |
>> | | |
>> | [[pathtoimage]] | [[pathtoimage]] |
>> | /blah blah/ | /blah blah/ |
>> | | |
>>
>> I don't like using p{} because everything is left aligned and I like
>> to center the images and the "caption" text below each one.
>> Unfortunately, there's no centered equivalent to p{}. Thus, I end up
>> using \includegraphics[widt]{} manually.
>>
>> Anyway, sorry if that's off-topic. Just wanted to voice that I have a
>> use for this general sort of thing as well. Heck, I think even
>> applying the beamer columns principle to LaTeX article classes would
>> work and be quite neat.
>>
>>
>> Thanks,
>> John
>>
>> >
>> > Thanks a lot,
>> > Martin
>> >
>> >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 1:56 LaTeX export: images subplots Martin Leduc
2013-09-12 2:47 ` John Hendy
@ 2013-09-12 4:45 ` Charles Berry
2013-09-12 10:38 ` Rasmus
2 siblings, 0 replies; 8+ messages in thread
From: Charles Berry @ 2013-09-12 4:45 UTC (permalink / raw)
To: emacs-orgmode
Martin Leduc <mart_00 <at> hotmail.com> writes:
>
>
> Hi all,
> I am using org-mode to write a report with several figures. I would
> like to group some images into a same figure, let say a 2x2 panel. I
> know that I can directly embed latex code in my org file, for
> example by using the subfloats (from the latex subfig package).
> However, I would prefer to use an org-based solution of inserting
> the image links in order to keep the convenient way of previewing
> images right into the buffer with C-c C-x C-v.
> The only solution I found is by using tables such as:
>
> #+CAPTION: Insert caption here.
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | [[pathtoimage]] | [[pathtoimage]] |
>
> where the size of the images is controled by p{} and C-cxv is
> working. However, in the exported TeX file, it is a table, not a
> figure. Is there a cleaner way to make image panels that would
> preserve the figure environment in the exported TeX file ?
I think you are close.
Use
#+BEGIN_SRC org :exports none
#+name: imtable
<insert-your-table-here>
#+END_SRC
This gives you the images in a form you can view and a way to access the
links so you can export them in a different form.
For example,
#+BEGIN_SRC emacs-lisp :var a=imtable :exports results :results raw
(mapconcat (lambda(y)
(mapconcat
(lambda(x) (org-export-string-as x 'latex t)) y "")) a "")
#+END_SRC
exports as
\includegraphics[width=.9\linewidth]{img3070YH.png}
\includegraphics[width=.9\linewidth]img307BjN.png}
\includegraphics[width=.9\linewidth]img307OtT.png}
\includegraphics[width=.9\linewidth]img307b3Z.png}
when the elements in the table are the image paths img*.png as shown.
HTH,
Chuck
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 1:56 LaTeX export: images subplots Martin Leduc
2013-09-12 2:47 ` John Hendy
2013-09-12 4:45 ` Charles Berry
@ 2013-09-12 10:38 ` Rasmus
2 siblings, 0 replies; 8+ messages in thread
From: Rasmus @ 2013-09-12 10:38 UTC (permalink / raw)
To: emacs-orgmode
Martin Leduc <mart_00@hotmail.com> writes:
> The only solution I found is by using tables such as:
>
> #+CAPTION: Insert caption here.
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | [[pathtoimage]] | [[pathtoimage]] |
>
> where the size of the images is controled by p{} and C-cxv is
> working. However, in the exported TeX file, it is a table, not a
> figure. Is there a cleaner way to make image panels that would
> preserve the figure environment in the exported TeX file ?
For now it should be possible to write a filter doing this, tho I'm
not sure a table is the 'correct' way to represent subfigures in Org
(were they to be supported), although it is nice and visual.
John Hendy <jw.hendy@gmail.com> writes:
> The only suggest I got was to use the subfig package, which may
> actually be something like what you're looking for.
subcaption is another possibility. I'm mostly using that these days.
–Rasmus
--
Send from my Emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 3:19 ` John Hendy
@ 2013-09-13 3:32 ` Martin Leduc
0 siblings, 0 replies; 8+ messages in thread
From: Martin Leduc @ 2013-09-13 3:32 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 4865 bytes --]
Thanks for all suggestions. I will probably stick with the solution of generating the panels with imagemagick and then including them as figures [[panel.png]].
Regards,
Martin
> Date: Wed, 11 Sep 2013 22:19:57 -0500
> Subject: Re: [O] LaTeX export: images subplots
> From: jw.hendy@gmail.com
> To: mart_00@hotmail.com
> CC: emacs-orgmode@gnu.org
>
> On Wed, Sep 11, 2013 at 10:13 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> > Hi John,
> > this solution using tables was indeed inspired from your post, I am so
> > sorry, I should have refered to it...
> >
>
> Ha! No problem at all -- small mailing list world :)
>
> > I suppose that the feature has not been implemented yet. I am now thinking
> > of generating a panel with imagemagick before including it in the org
> > buffer, for example with
> >
> > #+begin_src sh
> > convert +append image1.png image2.png panel.png
> > #+end_src
> >
> > and hence
> >
> > #+CAPTION:
> > [[panel.png]]
>
> What in the wide world of sports!? That's amazing and I can't believe
> I've never run into that. Sooo flipping handy. I've been looking for
> an easy way to do this with dissimilar ggplot2 plots where facetting
> is hard or doesn't make sense as well:
> - Like this: http://stackoverflow.com/questions/18046051/setting-individual-axis-limits-with-facet-wrap-and-scales-free-in-ggplot2
>
> That's pretty awesome and I just tried it; works beautifully.
>
> Then again, I think handling images in Org tables would be just
> fantastic. Not need for an external program or the compile time.
> Perhaps a bit tricky as one would have to infer from some #+attr_latex
> property that one wanted to apply some size parameter to every
> [option] box of the converted \includegraphics line...
>
> In any case, thanks for this and I'll keep that in mind. Hopefully
> others chime in.
>
>
> John
>
> >
> > to have the two images side by side both in the buffer (with C-cxv) and the
> > latex pdf (within a figure environment).
> >
> > Is there a cleaner org solution that I would have missed ?
> > Thanks again,
> > Martin
> >
> >> Date: Wed, 11 Sep 2013 21:47:08 -0500
> >> Subject: Re: [O] LaTeX export: images subplots
> >> From: jw.hendy@gmail.com
> >> To: mart_00@hotmail.com
> >> CC: emacs-orgmode@gnu.org
> >>
> >> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> >> > Hi all,
> >> > I am using org-mode to write a report with several figures. I would like
> >> > to group some images into a same figure, let say a 2x2 panel. I know
> >> > that I
> >> > can directly embed latex code in my org file, for example by using the
> >> > subfloats (from the latex subfig package).
> >> >
> >> > However, I would prefer to use an org-based solution of inserting the
> >> > image
> >> > links in order to keep the convenient way of previewing images right
> >> > into
> >> > the buffer with C-c C-x C-v.
> >> >
> >> > The only solution I found is by using tables such as:
> >> >
> >> > #+CAPTION: Insert caption here.
> >> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> >> > | [[pathtoimage]] | [[pathtoimage]] |
> >> > | [[pathtoimage]] | [[pathtoimage]] |
> >> >
> >> > where the size of the images is controled by p{} and C-cxv is working.
> >> > However, in the exported TeX file, it is a table, not a figure. Is there
> >> > a
> >> > cleaner way to make image panels that would preserve the figure
> >> > environment
> >> > in the exported TeX file ?
> >>
> >> Just wanted to cite my similar (same?) question from a bit back:
> >> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
> >>
> >> The only suggest I got was to use the subfig package, which may
> >> actually be something like what you're looking for.
> >>
> >> I guess p{width} /could/ work for what I was going for, but I will
> >> often stagger images and my own "captions" via the org table:
> >>
> >> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> >> | [[pathtoimage]] | [[pathtoimage]] |
> >> | /blah blah/ | /blah blah/ |
> >> | | |
> >> | [[pathtoimage]] | [[pathtoimage]] |
> >> | /blah blah/ | /blah blah/ |
> >> | | |
> >>
> >> I don't like using p{} because everything is left aligned and I like
> >> to center the images and the "caption" text below each one.
> >> Unfortunately, there's no centered equivalent to p{}. Thus, I end up
> >> using \includegraphics[widt]{} manually.
> >>
> >> Anyway, sorry if that's off-topic. Just wanted to voice that I have a
> >> use for this general sort of thing as well. Heck, I think even
> >> applying the beamer columns principle to LaTeX article classes would
> >> work and be quite neat.
> >>
> >>
> >> Thanks,
> >> John
> >>
> >> >
> >> > Thanks a lot,
> >> > Martin
> >> >
> >> >
[-- Attachment #2: Type: text/html, Size: 6325 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: LaTeX export: images subplots
2013-09-12 2:47 ` John Hendy
2013-09-12 3:13 ` Martin Leduc
@ 2013-09-13 11:02 ` Suvayu Ali
1 sibling, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2013-09-13 11:02 UTC (permalink / raw)
To: emacs-orgmode
On Wed, Sep 11, 2013 at 09:47:08PM -0500, John Hendy wrote:
> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc <mart_00@hotmail.com> wrote:
> > Hi all,
> > I am using org-mode to write a report with several figures. I would like
> > to group some images into a same figure, let say a 2x2 panel. I know that I
> > can directly embed latex code in my org file, for example by using the
> > subfloats (from the latex subfig package).
> >
> > However, I would prefer to use an org-based solution of inserting the image
> > links in order to keep the convenient way of previewing images right into
> > the buffer with C-c C-x C-v.
> >
> > The only solution I found is by using tables such as:
> >
> > #+CAPTION: Insert caption here.
> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> > | [[pathtoimage]] | [[pathtoimage]] |
> > | [[pathtoimage]] | [[pathtoimage]] |
> >
> > where the size of the images is controled by p{} and C-cxv is working.
> > However, in the exported TeX file, it is a table, not a figure. Is there a
> > cleaner way to make image panels that would preserve the figure environment
> > in the exported TeX file ?
>
> Just wanted to cite my similar (same?) question from a bit back:
> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
Actually this might be easier than we might think.
AFAIK, there is already a feature of writing matrices with tables (sorry
no citation). Maybe that can adapted for images?
Hope this helps,
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-09-13 11:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 1:56 LaTeX export: images subplots Martin Leduc
2013-09-12 2:47 ` John Hendy
2013-09-12 3:13 ` Martin Leduc
2013-09-12 3:19 ` John Hendy
2013-09-13 3:32 ` Martin Leduc
2013-09-13 11:02 ` Suvayu Ali
2013-09-12 4:45 ` Charles Berry
2013-09-12 10:38 ` Rasmus
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).