* Size and placement of images in table in PDF export
@ 2012-03-03 0:20 Michael Hannon
2012-03-03 4:02 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: Michael Hannon @ 2012-03-03 0:20 UTC (permalink / raw)
To: Org-Mode List
Greetings. I've got another export question. If I put two small images into
an Org-mode table and export the containing document to HTML, I see the two
images displayed side-by-side in an area of the page that is at least roughly
the actual size of the concatenated images.
If I export the same document to PDF, the two images are again displayed
side-by-side, but image on the left is magnified to take up most of the
horizontal space on the page; the image on the right is also magnified and
runs off the page to the right.
I'm not sure how to provide a simple, self-contained example of this. The
structure of the table is:
| [[./x1.jpg]] | [[./x2.jpg]] |
The images themselves are "small":
$ identify x*.jpg
x1.jpg JPEG 189x142 189x142+0+0 8-bit DirectClass 9.56KB 0.000u 0:00.000
x2.jpg[1] JPEG 190x160 190x160+0+0 8-bit DirectClass 55.6KB 0.000u 0:00.000
If I just print the images from an image viewer, each of them comes out on
paper at about 2.5in (~64 mm) in width.
Is there some way to override the default size/placement of the images in PDF
export?
BTW, this is:
Org-mode version 7.8.03 (release_7.8.03.324.gc4b233)
in Fedora 16, 64-bit.
Thanks,
-- Mike
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Size and placement of images in table in PDF export
2012-03-03 0:20 Size and placement of images in table in PDF export Michael Hannon
@ 2012-03-03 4:02 ` Nick Dokos
2012-04-25 7:08 ` Eric Fraga
0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-03-03 4:02 UTC (permalink / raw)
To: Michael Hannon; +Cc: nicholas.dokos, Org-Mode List
Michael Hannon <jm_hannon@yahoo.com> wrote:
> Greetings. I've got another export question. If I put two small images into
> an Org-mode table and export the containing document to HTML, I see the two
> images displayed side-by-side in an area of the page that is at least roughly
> the actual size of the concatenated images.
>
> If I export the same document to PDF, the two images are again displayed
> side-by-side, but image on the left is magnified to take up most of the
> horizontal space on the page; the image on the right is also magnified and
> runs off the page to the right.
>
> I'm not sure how to provide a simple, self-contained example of this. The
> structure of the table is:
>
> | [[./x1.jpg]] | [[./x2.jpg]] |
>
> The images themselves are "small":
>
> $ identify x*.jpg
> x1.jpg JPEG 189x142 189x142+0+0 8-bit DirectClass 9.56KB 0.000u 0:00.000
> x2.jpg[1] JPEG 190x160 190x160+0+0 8-bit DirectClass 55.6KB 0.000u 0:00.000
>
> If I just print the images from an image viewer, each of them comes out on
> paper at about 2.5in (~64 mm) in width.
>
> Is there some way to override the default size/placement of the images in PDF
> export?
>
The trouble is that the default option says "width=.9\\linewidth" so
if you try to put two of them on the same "line", they end up overflowing
the page. For an image not inside a table, you could reset that with
#+ATTR_LaTeX: width=.4\\linewidth
but this is a rather blunt instrument: for images inside a table, it
applies not only to the images but also to the table (and it ends up
producing a syntactically incorrect latex program - that's probably
a bug in the latex exporter.)
The following variation does work however:
--8<---------------cut here---------------start------------->8---
#+BIND: org-export-latex-image-default-option "width=.4\\linewidth"
* foo
| col1 | col2 |
|--------------+--------------|
| [[./x1.jpg]] | [[./x2.jpg]] |
| | |
--8<---------------cut here---------------end--------------->8---
Of course, if you try to put three images on the line, you'll have to
recalibrate the factor (you can also use absolute dimensions: width=3cm).
There is also this second variation, which uses height, rather than width: the
latex exporter thinks height is not relevant to tables, so it does not
try to give that attribute to the table, just to the images:
--8<---------------cut here---------------start------------->8---
* foo
#+ATTR_LaTeX: height=2cm
| col1 | col2 |
|--------------+--------------|
| [[./x1.jpg]] | [[./x2.jpg]] |
| | |
--8<---------------cut here---------------end--------------->8---
but you can also use the BIND form too:
#+BIND: org-export-latex-image-default-option "height=2cm"
Note btw, that the width in the first case (and the height in the
second case) is the same for both images. AFAICT, there is no way
to give different dimensions to the two images - except for the
following variation.
The third variation allows the two images to have their "natural"
dimensions:
--8<---------------cut here---------------start------------->8---
#+BIND: org-export-latex-image-default-option ""
* foo
| col1 | col2 |
|--------------+--------------|
| [[./x1.jpg]] | [[./x2.jpg]] |
| | |
--8<---------------cut here---------------end--------------->8---
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Size and placement of images in table in PDF export
2012-03-03 4:02 ` Nick Dokos
@ 2012-04-25 7:08 ` Eric Fraga
2012-04-25 7:30 ` Michael Hannon
0 siblings, 1 reply; 4+ messages in thread
From: Eric Fraga @ 2012-04-25 7:08 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Michael Hannon, Org-Mode List
Nick Dokos <nicholas.dokos@hp.com> writes:
> Michael Hannon <jm_hannon@yahoo.com> wrote:
>
>> Greetings. I've got another export question. If I put two small images into
>> an Org-mode table and export the containing document to HTML, I see the two
>> images displayed side-by-side in an area of the page that is at least roughly
>> the actual size of the concatenated images.
>>
>> If I export the same document to PDF, the two images are again displayed
>> side-by-side, but image on the left is magnified to take up most of the
>> horizontal space on the page; the image on the right is also magnified and
>> runs off the page to the right.
[...]
>> Is there some way to override the default size/placement of the images in PDF
>> export?
>>
>
> The trouble is that the default option says "width=.9\\linewidth" so
> if you try to put two of them on the same "line", they end up overflowing
> the page. For an image not inside a table, you could reset that with
>
> #+ATTR_LaTeX: width=.4\\linewidth
By the way, there should be only one \ in this line as org or emacs do
not need the \ escaped in this context.
>
> but this is a rather blunt instrument: for images inside a table, it
> applies not only to the images but also to the table (and it ends up
> producing a syntactically incorrect latex program - that's probably
> a bug in the latex exporter.)
There is indeed a problem with figures inside tables in that the same
construct is used to pass arguments to \includegraphics
and \begin{tabular}. Not ideal at all. We really should have different
constructs for each...
For the above problem from the OP, the best solution in latex directly
would have been to specify the widths of the columns using p{2.5cm}
column formats, say. If that is done, the default width for images,
based on \linewidth, would work just fine as \linewidth is the width of
the text within the actual latex structure (as opposed to \textwidth or
\columnwidth, say). This works because the "p" tabular format changes
\linewidth within that column.
However, it is not possible to specify table attributes *if* you have
images inside the table as the same latex attributes are passed to both
table and images...
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.1.50.1
: using Org-mode version 7.8.06 (release_7.8.06.181.g67694.dirty)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Size and placement of images in table in PDF export
2012-04-25 7:08 ` Eric Fraga
@ 2012-04-25 7:30 ` Michael Hannon
0 siblings, 0 replies; 4+ messages in thread
From: Michael Hannon @ 2012-04-25 7:30 UTC (permalink / raw)
To: Eric Fraga, nicholas.dokos@hp.com; +Cc: Org-Mode List
On Wednesday, April 25, 2012 at 12:08 AM Eric Fraga wrote:
> Nick Dokos <nicholas.dokos@hp.com> writes:
>> Michael Hannon <jm_hannon@yahoo.com> wrote:
>>
>>> Greetings. I've got another export question. If I put two small images
>>> into
>>> an Org-mode table and export the containing document to HTML, I see the two
>>> images displayed side-by-side in an area of the page that is at least
>>> roughly
>>> the actual size of the concatenated images.
>>>
>>> If I export the same document to PDF, the two images are again displayed
>>> side-by-side, but image on the left is magnified to take up most of the
>>> horizontal space on the page; the image on the right is also magnified and
>>> runs off the page to the right.
[...]
>> Is there some way to override the default size/placement of the images in
>>> PDF export?
>>
>>
>> The trouble is that the default option says "width=.9\\linewidth" so
>> if you try to put two of them on the same "line", they end up overflowing
>> the page. For an image not inside a table, you could reset that with
>>
>> #+ATTR_LaTeX: width=.4\\linewidth
> By the way, there should be only one \ in this line as org or emacs do
> not need the \ escaped in this context.
>>
>> but this is a rather blunt instrument: for images inside a table, it
>> applies not only to the images but also to the table (and it ends up
>> producing a syntactically incorrect latex program - that's probably
>> a bug in the latex exporter.)
> There is indeed a problem with figures inside tables in that the same
> construct is used to pass arguments to \includegraphics
> and \begin{tabular}. Not ideal at all. We really should have different
> constructs for each...
> For the above problem from the OP, the best solution in latex directly
> would have been to specify the widths of the columns using p{2.5cm}
> column formats, say. If that is done, the default width for images,
> based on \linewidth, would work just fine as \linewidth is the width of
> the text within the actual latex structure (as opposed to \textwidth or
> \columnwidth, say). This works because the "p" tabular format changes
> \linewidth within that column.
>
> However, it is not possible to specify table attributes *if* you have
> images inside the table as the same latex attributes are passed to both
> table and images...
Hi, Eric. Thanks for the information. Just for the record, I ended up
"cheating" on this problem: I used the ImageMagick utility "montage" to
create, well, a montage of the images I wanted and then just loaded the
resulting, single image. I've been meaning to close the loop on this but kept
forgetting.
-- Mike
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-25 7:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-03 0:20 Size and placement of images in table in PDF export Michael Hannon
2012-03-03 4:02 ` Nick Dokos
2012-04-25 7:08 ` Eric Fraga
2012-04-25 7:30 ` Michael Hannon
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).