emacs-orgmode@gnu.org archives
help / color / mirror / code / Atom feed
* org-latex and figures
@ 2011-01-27 14:04 Andrea Crotti
2011-01-27 16:53  Thomas S. Dye
From: Andrea Crotti @ 2011-01-27 14:04 UTC (permalink / raw)
To: emacs-orgmode

I could not understand why on earth my pdf had all the images after the
whole document.
Then I found this:

http://www.eng.cam.ac.uk/help/tpl/textprocessing/float_hint.html

and found out that the default for a figure was
\begin{figure}[ptb]

while in the generated latex file from org I had
\begin{figure}[htb]

So I changed to the default and now it works fine...
Isn't that default maybe a bit dangerous?

The fact is that if the first image doesn't fit "here" it will be
printed late and all the others after.

I might also just use the latex code here for these things, I don't care
to export to other formats, it's just nicer to look if it's in org syntax

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

* Re: org-latex and figures
2011-01-27 14:04 org-latex and figures Andrea Crotti
@ 2011-01-27 16:53  Thomas S. Dye
2011-01-27 20:35    Chris Malone
From: Thomas S. Dye @ 2011-01-27 16:53 UTC (permalink / raw)
To: Andrea Crotti; +Cc: emacs-orgmode

Hi Andrea,

There is no default that will work in all situations.  A default of
[ptb] will typically generate some pages with just a figure and lots
of white space.  I make a lot of latex documents and I find the path
of least resistance is to use a default of [htb!] and pay attention to
the large figures so they don't float to the end and take the other
figures with them.

All the best,
Tom

On Jan 27, 2011, at 4:04 AM, Andrea Crotti wrote:

> I could not understand why on earth my pdf had all the images after
> the
> whole document.
> Then I found this:
>
> http://www.eng.cam.ac.uk/help/tpl/textprocessing/float_hint.html
>
> and found out that the default for a figure was
> \begin{figure}[ptb]
>
> while in the generated latex file from org I had
> \begin{figure}[htb]
>
> So I changed to the default and now it works fine...
> Isn't that default maybe a bit dangerous?
>
> The fact is that if the first image doesn't fit "here" it will be
> printed late and all the others after.
>
> I might also just use the latex code here for these things, I don't
> care
> to export to other formats, it's just nicer to look if it's in org
> syntax
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-latex and figures
2011-01-27 16:53  Thomas S. Dye
@ 2011-01-27 20:35    Chris Malone
2011-01-28 15:56      Eric S Fraga
2011-01-28 16:01      Eric Schulte
0 siblings, 2 replies; 7+ messages in thread
From: Chris Malone @ 2011-01-27 20:35 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode, Andrea Crotti

[-- Attachment #1.1: Type: text/plain, Size: 2355 bytes --]

Hi Andrea,

I'm inclined to agree with Tom - there is no default that will work in all
instances.  That being said, you can use an #ATTR_LATEX line to modify the
placement for each image - see here:
http://orgmode.org/org.html#Images-in-LaTeX-export

Alternatively, (and this is very much a hack, which I can't guarantee will
work) you could make the org-mode default behaviour be [ptb] by replacing
the =(floatp "[htb]")= line with =(floatp "[ptb]")= in the
=org-export-latex-format-image= function definition in the file
org/lisp/org-latex.el ... you would have to do something similar to the
=org-export-latex-tables= function for tables.

HTH,
Chris

On Thu, Jan 27, 2011 at 11:53 AM, Thomas S. Dye <tsd@tsdye.com> wrote:

> Hi Andrea,
>
> There is no default that will work in all situations.  A default of [ptb]
> will typically generate some pages with just a figure and lots of white
> space.  I make a lot of latex documents and I find the path of least
> resistance is to use a default of [htb!] and pay attention to the large
> figures so they don't float to the end and take the other figures with them.
>
> All the best,
> Tom
>
> On Jan 27, 2011, at 4:04 AM, Andrea Crotti wrote:
>
>  I could not understand why on earth my pdf had all the images after the
>> whole document.
>> Then I found this:
>>
>> http://www.eng.cam.ac.uk/help/tpl/textprocessing/float_hint.html
>>
>> and found out that the default for a figure was
>> \begin{figure}[ptb]
>>
>> while in the generated latex file from org I had
>> \begin{figure}[htb]
>>
>> So I changed to the default and now it works fine...
>> Isn't that default maybe a bit dangerous?
>>
>> The fact is that if the first image doesn't fit "here" it will be
>> printed late and all the others after.
>>
>> I might also just use the latex code here for these things, I don't care
>> to export to other formats, it's just nicer to look if it's in org syntax
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

[-- Attachment #1.2: Type: text/html, Size: 3400 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-latex and figures
2011-01-27 20:35    Chris Malone
@ 2011-01-28 15:56      Eric S Fraga
2011-01-28 16:42        Thomas S. Dye
2011-01-28 16:01      Eric Schulte
From: Eric S Fraga @ 2011-01-28 15:56 UTC (permalink / raw)
To: Chris Malone; +Cc: emacs-orgmode, Andrea Crotti

Chris Malone <chris.m.malone@gmail.com> writes:

> Hi Andrea,
>
> I'm inclined to agree with Tom - there is no default that will work in all
> instances.  That being said, you can use an #ATTR_LATEX line to modify the
> placement for each image - see here:
> http://orgmode.org/org.html#Images-in-LaTeX-export
>
> Alternatively, (and this is very much a hack, which I can't guarantee will
> work) you could make the org-mode default behaviour be [ptb] by replacing
> the =(floatp "[htb]")= line with =(floatp "[ptb]")= in the
> =org-export-latex-format-image= function definition in the file
> org/lisp/org-latex.el ... you would have to do something similar to the
> =org-export-latex-tables= function for tables.
>
> HTH,
> Chris

I'm not understanding something in this whole thread: all the example
options seem to imply that 'h' and 'p' are somehow exclusive.  I have
always used [hbtp] (a sequence that essentially says: put the figure in
place as soon as you can), sometimes with and sometimes without '!'
before the h, and I have never had reason to complain about the
placement of figures!

Well, for some journals/conferences, I've had to adapt this to [hp] if
they insist on figures always at the top of a page... but I always have
both h and p options.

Just my two ¢s...

--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.4 (release_7.4.257.g5d90.dirty)

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

* Re: org-latex and figures
2011-01-27 20:35    Chris Malone
2011-01-28 15:56      Eric S Fraga
@ 2011-01-28 16:01      Eric Schulte
1 sibling, 0 replies; 7+ messages in thread
From: Eric Schulte @ 2011-01-28 16:01 UTC (permalink / raw)
To: Chris Malone; +Cc: emacs-orgmode, Andrea Crotti

Hi,

This seems like it should be easily customizable.  I've replaced the
hardcoded "htb" values with org-latex-default-figure-position' a new
defcustom variable which can be customized to change this behavior.
Please pull the latest from git, try it out and let me know if you run
into any problems.

Best -- Eric

Chris Malone <chris.m.malone@gmail.com> writes:

> Hi Andrea,
>
> I'm inclined to agree with Tom - there is no default that will work in all
> instances.  That being said, you can use an #ATTR_LATEX line to modify the
> placement for each image - see here:
> http://orgmode.org/org.html#Images-in-LaTeX-export
>
> Alternatively, (and this is very much a hack, which I can't guarantee will
> work) you could make the org-mode default behaviour be [ptb] by replacing
> the =(floatp "[htb]")= line with =(floatp "[ptb]")= in the
> =org-export-latex-format-image= function definition in the file
> org/lisp/org-latex.el ... you would have to do something similar to the
> =org-export-latex-tables= function for tables.
>
> HTH,
> Chris
>
>
> On Thu, Jan 27, 2011 at 11:53 AM, Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Hi Andrea,
>>
>> There is no default that will work in all situations.  A default of [ptb]
>> will typically generate some pages with just a figure and lots of white
>> space.  I make a lot of latex documents and I find the path of least
>> resistance is to use a default of [htb!] and pay attention to the large
>> figures so they don't float to the end and take the other figures with them.
>>
>> All the best,
>> Tom
>>
>> On Jan 27, 2011, at 4:04 AM, Andrea Crotti wrote:
>>
>>  I could not understand why on earth my pdf had all the images after the
>>> whole document.
>>> Then I found this:
>>>
>>> http://www.eng.cam.ac.uk/help/tpl/textprocessing/float_hint.html
>>>
>>> and found out that the default for a figure was
>>> \begin{figure}[ptb]
>>>
>>> while in the generated latex file from org I had
>>> \begin{figure}[htb]
>>>
>>> So I changed to the default and now it works fine...
>>> Isn't that default maybe a bit dangerous?
>>>
>>> The fact is that if the first image doesn't fit "here" it will be
>>> printed late and all the others after.
>>>
>>> I might also just use the latex code here for these things, I don't care
>>> to export to other formats, it's just nicer to look if it's in org syntax
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-latex and figures
2011-01-28 15:56      Eric S Fraga
@ 2011-01-28 16:42        Thomas S. Dye
2011-01-28 17:09          Eric S Fraga
From: Thomas S. Dye @ 2011-01-28 16:42 UTC (permalink / raw)
To: Eric S Fraga; +Cc: Chris Malone, emacs-orgmode, Andrea Crotti

On Jan 28, 2011, at 5:56 AM, Eric S Fraga wrote:

> Chris Malone <chris.m.malone@gmail.com> writes:
>
>> Hi Andrea,
>>
>> I'm inclined to agree with Tom - there is no default that will work
>> in all
>> instances.  That being said, you can use an #ATTR_LATEX line to
>> modify the
>> placement for each image - see here:
>> http://orgmode.org/org.html#Images-in-LaTeX-export
>>
>> Alternatively, (and this is very much a hack, which I can't
>> guarantee will
>> work) you could make the org-mode default behaviour be [ptb] by
>> replacing
>> the =(floatp "[htb]")= line with =(floatp "[ptb]")= in the
>> =org-export-latex-format-image= function definition in the file
>> org/lisp/org-latex.el ... you would have to do something similar to
>> the
>> =org-export-latex-tables= function for tables.
>>
>> HTH,
>> Chris
>
> I'm not understanding something in this whole thread: all the example
> options seem to imply that 'h' and 'p' are somehow exclusive.  I have
> always used [hbtp] (a sequence that essentially says: put the figure
> in
> place as soon as you can), sometimes with and sometimes without '!'
> before the h, and I have never had reason to complain about the
> placement of figures!
>
> Well, for some journals/conferences, I've had to adapt this to [hp] if
> they insist on figures always at the top of a page... but I always
> have
> both h and p options.
>
> Just my two ¢s...
>

Hi Eric,

Floats are tricky in LaTeX.  The two most frequent problems, in my
experience, are the "all the floats at the end" problem that bit
Andrea and the "small float on its own page" problem.  The first of
these comes from not including [p] and the second comes from including
[p].  I think you have to pick your poison here--there doesn't seem to
be a default that always works perfectly.

If you want to avoid both problems, as I do, then I find the best
default strategy to be [htb!], with [p] used for figures that are
designed specifically to fit the whole page.  What this implies is
that figures are designed to fit the printed page, with a preference
for figures that are short and wide and a strong aversion to figures
that are tall and narrow (except, perhaps, with two-column layouts,
which have their own drawbacks).

For figures at the top of a page, you probably want [tp] rather than
[hp], since [h] will let a figure start anywhere in happens to fall on
the page.

All the best,
Tom

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

* Re: org-latex and figures
2011-01-28 16:42        Thomas S. Dye
@ 2011-01-28 17:09          Eric S Fraga
0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2011-01-28 17:09 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: Chris Malone, emacs-orgmode, Andrea Crotti

"Thomas S. Dye" <tsd@tsdye.com> writes:

[...]

>
> Hi Eric,
>
> Floats are tricky in LaTeX.

agreed!

> The two most frequent problems, in my
> experience, are the "all the floats at the end" problem that bit
> Andrea and the "small float on its own page" problem.  The first of
> these comes from not including [p] and the second comes from including
> [p].  I think you have to pick your poison here--there doesn't seem to
> be a default that always works perfectly.

Yes, agreed as well other than to say that I have found [hbtp] to work
for most of my writing over the years.  I have seldom had to change from
this default.  But that could simply be a reflection of the types of
documents I work with.

Of course, as soon as you start talking about two-column formats, all of
this goes out the window! :-)

> If you want to avoid both problems, as I do, then I find the best
> default strategy to be [htb!], with [p] used for figures that are
> designed specifically to fit the whole page.

My point was simply that mixing 'h' and 'p' is perfectly legal: they
need not be treated as mutually exclusive options!

But, in any case, having an org variable that allows setting the figure
captions is fantastic: thanks to Eric Schulte for already implementing
this!

--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.4 (release_7.4.258.gb2ae3.dirty)

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

end of thread, other threads:[~2011-01-28 17:10 UTC | newest]

2011-01-27 14:04 org-latex and figures Andrea Crotti
2011-01-27 16:53  Thomas S. Dye
2011-01-27 20:35    Chris Malone
2011-01-28 15:56      Eric S Fraga
2011-01-28 16:42        Thomas S. Dye
2011-01-28 17:09          Eric S Fraga
2011-01-28 16:01      Eric Schulte


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).`