emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ox-latex, bug?] :caption forces environment
@ 2015-02-19 14:52 Rasmus
  2015-02-19 15:13 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-02-19 14:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Consider this example:

#+ATTR_LATEX: :environment nil :center nil :caption cap
| t |

Exporting to latex, it produces:

    \begin{table}[htb]
    cap
    \begin{tabular}{l}
    \toprule
    t\\
    \bottomrule
    \end{tabular}
    \end{table}

I'd expect:

    cap
    \begin{tabular}{l}
    \toprule
    t\\
    \bottomrule
    \end{tabular}

The real usecase is that I want to use \captionof{table}{my caption}.

I can try to fix it myself later if that's better.

—Rasmus

-- 
. . . The proofs are technical in nature and provides no real understanding

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 14:52 [ox-latex, bug?] :caption forces environment Rasmus
@ 2015-02-19 15:13 ` Nicolas Goaziou
  2015-02-19 15:19   ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-02-19 15:13 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:


> Consider this example:
>
> #+ATTR_LATEX: :environment nil :center nil :caption cap
> | t |
>
> Exporting to latex, it produces:
>
>     \begin{table}[htb]
>     cap
>     \begin{tabular}{l}
>     \toprule
>     t\\
>     \bottomrule
>     \end{tabular}
>     \end{table}
>
> I'd expect:
>
>     cap
>     \begin{tabular}{l}
>     \toprule
>     t\\
>     \bottomrule
>     \end{tabular}

This is a feature. A caption implies, at least, a "table" environment.

> The real usecase is that I want to use \captionof{table}{my caption}.

This feature existed before support for "captionof". Of course, it is
now possible to make use of this macro and alter `org-latex--org-table'
accordingly.


Regards,

-- 
Nicolas Goaziou

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 15:13 ` Nicolas Goaziou
@ 2015-02-19 15:19   ` Rasmus
  2015-02-19 15:28     ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-02-19 15:19 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> This is a feature. A caption implies, at least, a "table" environment.

Except when it doesn't¹ ...  And in this case I told Org that it doesn't by
specifying :environment nil.  :environment should be stronger
than :caption.

>> The real usecase is that I want to use \captionof{table}{my caption}.
>
> This feature existed before support for "captionof". Of course, it is
> now possible to make use of this macro and alter `org-latex--org-table'
> accordingly.

There no explicit interface for \captonof, and reading the manual of
capt-of, I don't want to, as the author says care should be taken in
documents where floats are also used.

—Rasmus


Footnotes: 
¹   I need to put the table inside an minipage, and they don't hold floats.

-- 
. . . The proofs are technical in nature and provides no real
understanding

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 15:19   ` Rasmus
@ 2015-02-19 15:28     ` Nicolas Goaziou
  2015-02-19 15:50       ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-02-19 15:28 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> This is a feature. A caption implies, at least, a "table" environment.
>
> Except when it doesn't¹ ...

That's your problem since Org didn't request the minipage in the first
place. You don't want a caption but still provide one.

> And in this case I told Org that it doesn't by specifying :environment
> nil. :environment should be stronger than :caption.

This is really a matter of taste. I don't mind either way.

> There no explicit interface for \captonof, and reading the manual of
> capt-of, I don't want to, as the author says care should be taken in
> documents where floats are also used.

Again, this is the user's problem. But it could be reasonable to use
"captionof" when no environment is explicitly required. IOW "ox-latex"
could fall-back to caption of when a caption is specified and there's no
environment to hold it.


Regards,

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 15:28     ` Nicolas Goaziou
@ 2015-02-19 15:50       ` Rasmus
  2015-02-19 16:12         ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-02-19 15:50 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Again, this is the user's problem. But it could be reasonable to use
> "captionof" when no environment is explicitly required.

Do you consider it explicit when no environment is specified?  I would
/only/ use capt-of when :environment is nil.

>  IOW "ox-latex" could fall-back to caption of when a caption is
> specified and there's no environment to hold it.

That would be nice, I guess.  Then I could also use #+CAPTION which is
arguably nicer than #+attr_latex :caption.

—Rasmus

-- 
⠠⠵

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 15:50       ` Rasmus
@ 2015-02-19 16:12         ` Nicolas Goaziou
  2015-02-19 16:43           ` Rasmus
  2015-02-19 16:49           ` Rasmus
  0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2015-02-19 16:12 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Do you consider it explicit when no environment is specified?  I would
> /only/ use capt-of when :environment is nil.

I think you are confusing :environment and :float. :environment cannot
be nil.

  ‘:environment’
       Environment used for the table.  It can be set to any LaTeX table
       environment, like ‘tabularx’(1), ‘longtable’, ‘array’, ‘tabu’(2),
       ‘bmatrix’...  It defaults to ‘org-latex-default-table-environment’
       value.


  ‘:placement’
       The ‘:float’ specifies the float environment for the table.
       Possible values are ‘sideways’(3), ‘multicolumn’, ‘t’ and ‘nil’.
       When unspecified, a table with a caption will have a ‘table’
       environment.  Moreover, the ‘:placement’ attribute can specify the
       positioning of the float.  Note: ‘:placement’ is ignored for
       ‘:float sideways’ tables.

We could use captof with a caption and :float nil.

> That would be nice, I guess.  Then I could also use #+CAPTION which is
> arguably nicer than #+attr_latex :caption.

Indeed.

Regards,

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 16:12         ` Nicolas Goaziou
@ 2015-02-19 16:43           ` Rasmus
  2015-02-19 16:49           ` Rasmus
  1 sibling, 0 replies; 10+ messages in thread
From: Rasmus @ 2015-02-19 16:43 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Do you consider it explicit when no environment is specified?  I would
>> /only/ use capt-of when :environment is nil.
>
> I think you are confusing :environment and :float. :environment cannot
> be nil.

I think you are right.

> We could use captof with a caption and :float nil.

Yeah, that makes perfect sense.

—Rasmus

-- 
Need more coffee. . .

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 16:12         ` Nicolas Goaziou
  2015-02-19 16:43           ` Rasmus
@ 2015-02-19 16:49           ` Rasmus
  2015-02-24 20:06             ` Nicolas Goaziou
  1 sibling, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-02-19 16:49 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> We could use captof with a caption and :float nil.

You would also be able to do this with the awful float-package using the
H :placement, though I guess it's still a float (so I don't know if it
would work in e.g. minipage). 

AFAIK, we use float actively at one place, namely ";; Case 1.  No source
fontification".  Of org-latex-src-block.  In that particular case I guess
we could also use capt-of, actually.

At some point I wanted to get rid of float, until I became aware that
capt-of doesn't ensure that floats/non-floats appear in the right order.

-- 
Summon the Mothership!

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-19 16:49           ` Rasmus
@ 2015-02-24 20:06             ` Nicolas Goaziou
  2015-02-24 22:49               ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2015-02-24 20:06 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> AFAIK, we use float actively at one place, namely ";; Case 1.  No source
> fontification".  Of org-latex-src-block.  In that particular case I guess
> we could also use capt-of, actually.

It's worth trying. Do you want to provide a patch?

> At some point I wanted to get rid of float, until I became aware that
> capt-of doesn't ensure that floats/non-floats appear in the right
> order.

Since we wouldn't use floats anymore, this isn't a problem, is it?

Regards,

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

* Re: [ox-latex, bug?] :caption forces environment
  2015-02-24 20:06             ` Nicolas Goaziou
@ 2015-02-24 22:49               ` Rasmus
  0 siblings, 0 replies; 10+ messages in thread
From: Rasmus @ 2015-02-24 22:49 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> AFAIK, we use float actively at one place, namely ";; Case 1.  No source
>> fontification".  Of org-latex-src-block.  In that particular case I guess
>> we could also use capt-of, actually.
>
> It's worth trying. Do you want to provide a patch?

Yeah, I started already, but so far only tables works, but I'm really busy
ATM with funding applications.

[BTW: For one I need to send a .doc.  I'm getting random crashes with
 ox-odt as well (as Eric), but I haven't been able to track it down...]

>> At some point I wanted to get rid of float, until I became aware that
>> capt-of doesn't ensure that floats/non-floats appear in the right
>> order.
>
> Since we wouldn't use floats anymore, this isn't a problem, is it?

Well the problem is that you can get unorder.  E.g. the following where I
don't know if the syntax is valid.  Table 1 can be printed midway on the
page, and table 2 can be printed on top of the page, but table 2 would
actually be called "Table 2".  I haven't tested this thoroughly though.

Text 

#+Attr_latex:  :float nil
| 1 | 

Text

#+Attr_latex:  :float t :options [t]
| 2  | 

—Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!

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

end of thread, other threads:[~2015-02-24 22:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 14:52 [ox-latex, bug?] :caption forces environment Rasmus
2015-02-19 15:13 ` Nicolas Goaziou
2015-02-19 15:19   ` Rasmus
2015-02-19 15:28     ` Nicolas Goaziou
2015-02-19 15:50       ` Rasmus
2015-02-19 16:12         ` Nicolas Goaziou
2015-02-19 16:43           ` Rasmus
2015-02-19 16:49           ` Rasmus
2015-02-24 20:06             ` Nicolas Goaziou
2015-02-24 22:49               ` 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).