emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ox-latex] How to force ALL captions below their referents?
@ 2014-10-02  7:23 James Harkins
  2014-10-02 16:54 ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: James Harkins @ 2014-10-02  7:23 UTC (permalink / raw)
  To: orgmode

I'm struggling a bit with caption placement in LaTeX export.

In the document I'm working on now, I have:

- Image links, exported as floating figures (by inclusion of a
  caption). ox-latex places the caption at the end of the figure
  environment, so the caption appears below the image.

#+name: fig1
#+caption: blah blah
#+attr_latex: :width 0.75\textwidth
[[./img/blahblah.png]]

\begin{figure}[htb]
\centering
\includegraphics[width=0.75\textwidth]{./img/blahblah.png}
\caption{\label{fig1}blah blah}
\end{figure}

- A figure block containing some figures. The entire block should be
  captioned. ox-latex places a caption first in the figure environment,
  so the caption is on top.

#+name: product1
#+caption: blah blah
#+begin_figure
#+begin_latex
\begin{subfigure}[b]{0.4\textwidth}
        \includegraphics[width=\textwidth]{./img/blah1.png}
\end{subfigure} \hfill \begin{subfigure}[b]{0.4\textwidth}
        \includegraphics[width=\textwidth]{./img/blah2.png}
\end{subfigure}
#+end_latex
#+end_figure

\begin{figure}
\caption{\label{product1}blah blah}
\begin{subfigure}...... (omitted)
\end{figure}

I don't like the typographical inconsistency. It would be much better,
I think, if I could specify in one place that I want *all* captions
below or above the entity being captioned.

It seems somebody recognized a while ago that this was a problem, and
introduced org-latex-table-caption-above. But this applies only to
tables, not to "figure" special blocks, nor to source code blocks, and
probably some other cases that I can't think of. Well,  I can customize
org-latex-listings-options to include ("captionpos" "b"), but I think
this is not quite ideal because:

a/ image captions always go at the bottom;
b/ table captions can be configured;
c/ listings captions can be configured in a different variable;
d/ many types of captions always go at the top, conflicting with a/.

Is there a plan to deal with this, other than my hacking ox-latex
locally?

hjh

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-02  7:23 [ox-latex] How to force ALL captions below their referents? James Harkins
@ 2014-10-02 16:54 ` Nicolas Goaziou
  2014-10-04  3:41   ` James Harkins
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-02 16:54 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@qq.com> writes:

> It seems somebody recognized a while ago that this was a problem, and
> introduced org-latex-table-caption-above. But this applies only to
> tables, not to "figure" special blocks, nor to source code blocks, and
> probably some other cases that I can't think of. Well,  I can customize
> org-latex-listings-options to include ("captionpos" "b"), but I think
> this is not quite ideal because:
>
> a/ image captions always go at the bottom;
> b/ table captions can be configured;
> c/ listings captions can be configured in a different variable;
> d/ many types of captions always go at the top, conflicting with a/.
>
> Is there a plan to deal with this, other than my hacking ox-latex
> locally?

You mean moving `org-latex-table-caption-above' to
`org-latex-caption-above' and making sure every block complies to the
variable?


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-02 16:54 ` Nicolas Goaziou
@ 2014-10-04  3:41   ` James Harkins
  2014-10-05  8:37     ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: James Harkins @ 2014-10-04  3:41 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Thu, 02 Oct 2014 18:54:20 +0200
Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> You mean moving `org-latex-table-caption-above' to
> `org-latex-caption-above' and making sure every block complies to the
> variable?

Sorry for the late reply. I wasn't feeling quite well yesterday.

Something like that would do it, I think. I hesitate about breaking
backward compatibility, but at the same time, I'm hard-pressed to
imagine why one would want captions to be differently placed in the
same document.

I suppose, if somebody needs to move a caption to the top or bottom
overriding the default, it could be an attribute, hypothetically:

#+name: blah
#+caption: blah blah
#+attr_latex: :captionpos t
#+begin_figure
...
#+end_figure

"t" would put it at the top, ":captionpos b" at the bottom and
":captionpos nil" (or not specified) would use the default from the
configuration variable.

Reasonable?
hjh

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-04  3:41   ` James Harkins
@ 2014-10-05  8:37     ` Nicolas Goaziou
  2014-10-12 15:36       ` Aaron Ecay
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-05  8:37 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@qq.com> writes:

> Something like that would do it, I think. I hesitate about breaking
> backward compatibility, but at the same time, I'm hard-pressed to
> imagine why one would want captions to be differently placed in the
> same document.

This wouldn't break compatibility. We would just mark
`org-latex-table-caption-above' as an obsolete alias for
`org-latex-caption-above'.

> I suppose, if somebody needs to move a caption to the top or bottom
> overriding the default, it could be an attribute, hypothetically:
>
> #+name: blah
> #+caption: blah blah
> #+attr_latex: :captionpos t
> #+begin_figure
> ...
> #+end_figure
>
> "t" would put it at the top, ":captionpos b" at the bottom and
> ":captionpos nil" (or not specified) would use the default from the
> configuration variable.
>
> Reasonable?

I don't think we need to go that far at the moment. Implementing
`org-latex-caption-above' is a reasonable start.

I add it to my ToDo list.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-05  8:37     ` Nicolas Goaziou
@ 2014-10-12 15:36       ` Aaron Ecay
  2014-10-13 15:58         ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Aaron Ecay @ 2014-10-12 15:36 UTC (permalink / raw)
  To: Nicolas Goaziou, James Harkins; +Cc: orgmode

Hi Nicolas,

2014ko urriak 5an, Nicolas Goaziou-ek idatzi zuen:
> 
> Hello,
> 
> James Harkins <jamshark70@qq.com> writes:
> 
>> Something like that would do it, I think. I hesitate about breaking
>> backward compatibility, but at the same time, I'm hard-pressed to
>> imagine why one would want captions to be differently placed in the
>> same document.
> 
> This wouldn't break compatibility. We would just mark
> `org-latex-table-caption-above' as an obsolete alias for
> `org-latex-caption-above'.
> 
>> I suppose, if somebody needs to move a caption to the top or bottom
>> overriding the default, it could be an attribute, hypothetically:
>> 
>> #+name: blah
>> #+caption: blah blah
>> #+attr_latex: :captionpos t
>> #+begin_figure
>> ...
>> #+end_figure
>> 
>> "t" would put it at the top, ":captionpos b" at the bottom and
>> ":captionpos nil" (or not specified) would use the default from the
>> configuration variable.
>> 
>> Reasonable?
> 
> I don't think we need to go that far at the moment. Implementing
> `org-latex-caption-above' is a reasonable start.
> 
> I add it to my ToDo list.

There’s at least some notion in the Latex community that captions atop
tables but below figures is sensible style:
<https://tex.stackexchange.com/questions/3243/why-should-a-table-caption-be-placed-above-the-table>.

In that light, does it make sense to instead implement this setting as an alist
with separate settings for tables, images, src blocks, etc.?  (Of
course, there could be separate variables
org-latex-{table,figure,src-block}-caption-above, but a single alist
seems simpler)

Thanks,

-- 
Aaron Ecay

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-12 15:36       ` Aaron Ecay
@ 2014-10-13 15:58         ` Nicolas Goaziou
  2014-10-17 20:08           ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-13 15:58 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

Aaron Ecay <aaronecay@gmail.com> writes:

> There’s at least some notion in the Latex community that captions atop
> tables but below figures is sensible style:
> <https://tex.stackexchange.com/questions/3243/why-should-a-table-caption-be-placed-above-the-table>.
>
> In that light, does it make sense to instead implement this setting as an alist
> with separate settings for tables, images, src blocks, etc.?  (Of
> course, there could be separate variables
> org-latex-{table,figure,src-block}-caption-above, but a single alist
> seems simpler)

If we want to preserve backward-compatibility, t, nil and a list of
types (e.g. '(table src-block)) should suffice. No need for an alist.

Still on my ToDo list but I'm not there yet. Feel free to beat me to it
if you want.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-13 15:58         ` Nicolas Goaziou
@ 2014-10-17 20:08           ` Nicolas Goaziou
  2014-10-21 10:56             ` Eric S Fraga
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-17 20:08 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> If we want to preserve backward-compatibility, t, nil and a list of
> types (e.g. '(table src-block)) should suffice. No need for an alist.
>
> Still on my ToDo list but I'm not there yet. Feel free to beat me to it
> if you want.

Done. Feedback welcome.

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-17 20:08           ` Nicolas Goaziou
@ 2014-10-21 10:56             ` Eric S Fraga
  2014-10-21 16:47               ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Eric S Fraga @ 2014-10-21 10:56 UTC (permalink / raw)
  To: orgmode

On Friday, 17 Oct 2014 at 22:08, Nicolas Goaziou wrote:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> If we want to preserve backward-compatibility, t, nil and a list of
>> types (e.g. '(table src-block)) should suffice. No need for an alist.
>>
>> Still on my ToDo list but I'm not there yet. Feel free to beat me to it
>> if you want.
>
> Done. Feedback welcome.

Nicolas,

the changes seem to work just fine.  Thanks.

However, I think it would make sense to make '(table) (at least) the
default for captions above to have some form of backward compatibility?
The change caught me by surprise...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-472-gc27d86

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-21 10:56             ` Eric S Fraga
@ 2014-10-21 16:47               ` Nicolas Goaziou
  2014-10-22 14:03                 ` Eric S Fraga
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-21 16:47 UTC (permalink / raw)
  To: orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> However, I think it would make sense to make '(table) (at least) the
> default for captions above to have some form of backward compatibility?
> The change caught me by surprise...

If we change `org-latex-caption-above', then it will no longer match
`org-latex-table-caption-above', which will introduce another class of
backward compatibility problems.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-21 16:47               ` Nicolas Goaziou
@ 2014-10-22 14:03                 ` Eric S Fraga
  2014-10-23 21:08                   ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Eric S Fraga @ 2014-10-22 14:03 UTC (permalink / raw)
  To: orgmode

On Tuesday, 21 Oct 2014 at 18:47, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> However, I think it would make sense to make '(table) (at least) the
>> default for captions above to have some form of backward compatibility?
>> The change caught me by surprise...
>
> If we change `org-latex-caption-above', then it will no longer match
> `org-latex-table-caption-above', which will introduce another class of
> backward compatibility problems.

Hi Nicolas,

I don't actually understand you.  All I know is that I had nothing set
explicitly anywhere to do with captions and, all of a sudden, the
behaviour has changed.  This seems wrong.  If I understand things
correctly, a new variable has been introduced to control behaviour that
previously was implicit.  By introducing this variable, the default
(previously implicit but now explicit) behaviour has changed.  

But it's a not a big deal (to me) as I have now set the variable and I'm
back to where I was.  So I'm happy to have things as they are now if
that's deemed to be better overall.

Thanks,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-22 14:03                 ` Eric S Fraga
@ 2014-10-23 21:08                   ` Nicolas Goaziou
  2014-10-24  7:59                     ` Eric S Fraga
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-23 21:08 UTC (permalink / raw)
  To: orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> I don't actually understand you.

`org-latex-table-caption-above' is now an alias for
`org-latex-caption-above', so the default values ought to be the same.

> All I know is that I had nothing set explicitly anywhere to do with
> captions and, all of a sudden, the behaviour has changed. This seems
> wrong. If I understand things correctly, a new variable has been
> introduced to control behaviour that previously was implicit. By
> introducing this variable, the default (previously implicit but now
> explicit) behaviour has changed.

IIUC, the old behaviour wasn't consistent (some captions above, some
below). This is the original motivation for this change.

I would be happy to make the transition smoother. However, I don't know
how to achieve complete backward compatibility, considering the remark
above.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-23 21:08                   ` Nicolas Goaziou
@ 2014-10-24  7:59                     ` Eric S Fraga
  2014-10-24  9:28                       ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Eric S Fraga @ 2014-10-24  7:59 UTC (permalink / raw)
  To: orgmode

On Thursday, 23 Oct 2014 at 23:08, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> I don't actually understand you.
>
> `org-latex-table-caption-above' is now an alias for
> `org-latex-caption-above', so the default values ought to be the same.

Ah, I see.

> IIUC, the old behaviour wasn't consistent (some captions above, some
> below). This is the original motivation for this change.

The old behaviour was not consistent in the sense of captions for
different objects being placed differently but the behaviour was
"consistent" with what is recognised as best practice in typesetting:
captions below figures and captions above tables.  However, I agree with
the desire for complete control.

> I would be happy to make the transition smoother. However, I don't know
> how to achieve complete backward compatibility, considering the remark
> above.

Okay.  No worries!

thanks,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-24  7:59                     ` Eric S Fraga
@ 2014-10-24  9:28                       ` Nicolas Goaziou
  2014-10-24 12:46                         ` Rasmus
  2014-10-24 19:51                         ` Eric S Fraga
  0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-24  9:28 UTC (permalink / raw)
  To: orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> The old behaviour was not consistent in the sense of captions for
> different objects being placed differently but the behaviour was
> "consistent" with what is recognised as best practice in typesetting:
> captions below figures and captions above tables.  However, I agree with
> the desire for complete control.

If this is really considered as best practice (would you have
a reference about it?), we really should consider making it the default.
Reading the thread, it seemed to me that it wasn't as universal.

However, `org-latex-table-caption-above' would then be dropped
altogether. I don't mind either.


Regards,

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-24  9:28                       ` Nicolas Goaziou
@ 2014-10-24 12:46                         ` Rasmus
  2014-10-24 19:51                         ` Eric S Fraga
  1 sibling, 0 replies; 16+ messages in thread
From: Rasmus @ 2014-10-24 12:46 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> The old behaviour was not consistent in the sense of captions for
>> different objects being placed differently but the behaviour was
>> "consistent" with what is recognised as best practice in typesetting:
>> captions below figures and captions above tables.  However, I agree with
>> the desire for complete control.
>
> If this is really considered as best practice (would you have
> a reference about it?), we really should consider making it the default.
> Reading the thread, it seemed to me that it wasn't as universal.

It's discussed here with some references:

https://tex.stackexchange.com/questions/3243/why-should-a-table-caption-be-placed-above-the-table

I took a quick looks as some different journals for which I have
articles with both tables and figures on my computer.  7 had the
configuration table captions above and figure caption below.  One had
both captions above.  One had mixed figure captions (some years above
some years below).  So for sure table captions should be above.
Probably figure captions should be below.  It makes sense.

—Rasmus
 
-- 
I almost cut my hair, it happened just the other day

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-24  9:28                       ` Nicolas Goaziou
  2014-10-24 12:46                         ` Rasmus
@ 2014-10-24 19:51                         ` Eric S Fraga
  2014-10-24 22:12                           ` Nicolas Goaziou
  1 sibling, 1 reply; 16+ messages in thread
From: Eric S Fraga @ 2014-10-24 19:51 UTC (permalink / raw)
  To: orgmode

On Friday, 24 Oct 2014 at 11:28, Nicolas Goaziou wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> The old behaviour was not consistent in the sense of captions for
>> different objects being placed differently but the behaviour was
>> "consistent" with what is recognised as best practice in typesetting:
>> captions below figures and captions above tables.  However, I agree with
>> the desire for complete control.
>
> If this is really considered as best practice (would you have
> a reference about it?), we really should consider making it the default.
> Reading the thread, it seemed to me that it wasn't as universal.

Not sure whether any reference will be definitive as there will always
be those that argue when it comes to style.  However, a web search for
"typesetting captions for tables and figures" gives quite a few results,
the first of which is interesting:

https://www.e-education.psu.edu/styleforstudents/c4_p12.html

which is headed "Captions for figures and tables".  I quote:

     The caption for a figure appears below the graphic; for a table,
     above.

The fact that LaTeX encourages the above is also a good sign.

However, I should add that I could be somewhat anglo-centric in this: I
really have no idea what technical writing in other languages might look
like.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e

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

* Re: [ox-latex] How to force ALL captions below their referents?
  2014-10-24 19:51                         ` Eric S Fraga
@ 2014-10-24 22:12                           ` Nicolas Goaziou
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2014-10-24 22:12 UTC (permalink / raw)
  To: orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Not sure whether any reference will be definitive as there will always
> be those that argue when it comes to style.  However, a web search for
> "typesetting captions for tables and figures" gives quite a few results,
> the first of which is interesting:
>
> https://www.e-education.psu.edu/styleforstudents/c4_p12.html
>
> which is headed "Captions for figures and tables".  I quote:
>
>      The caption for a figure appears below the graphic; for a table,
>      above.
>
> The fact that LaTeX encourages the above is also a good sign.
>
> However, I should add that I could be somewhat anglo-centric in this: I
> really have no idea what technical writing in other languages might look
> like.

Thanks for the feedback. Default value is now '(table).


Regards,

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

end of thread, other threads:[~2014-10-24 22:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-02  7:23 [ox-latex] How to force ALL captions below their referents? James Harkins
2014-10-02 16:54 ` Nicolas Goaziou
2014-10-04  3:41   ` James Harkins
2014-10-05  8:37     ` Nicolas Goaziou
2014-10-12 15:36       ` Aaron Ecay
2014-10-13 15:58         ` Nicolas Goaziou
2014-10-17 20:08           ` Nicolas Goaziou
2014-10-21 10:56             ` Eric S Fraga
2014-10-21 16:47               ` Nicolas Goaziou
2014-10-22 14:03                 ` Eric S Fraga
2014-10-23 21:08                   ` Nicolas Goaziou
2014-10-24  7:59                     ` Eric S Fraga
2014-10-24  9:28                       ` Nicolas Goaziou
2014-10-24 12:46                         ` Rasmus
2014-10-24 19:51                         ` Eric S Fraga
2014-10-24 22:12                           ` Nicolas Goaziou

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