* Table caption in Latex export with :float nil
@ 2015-03-11 2:16 Vikas Rawal
2015-03-11 5:54 ` Vikas Rawal
0 siblings, 1 reply; 7+ messages in thread
From: Vikas Rawal @ 2015-03-11 2:16 UTC (permalink / raw)
To: org-mode mailing list
I need to insert a table in an mdframed box, for which I need to turn off :float. The following, however, does not give me the caption:
#+name: milk-consumption-india
#+attr_latex: :float nil :environment tabular :caption \caption{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
| Year | Rural | Urban | All |
|---------------------------------+-------+-------+------|
| 1983 | 38.7 | 55.6 | 44.7 |
| 1993–1994 | 50.3 | 66.4 | 54.3 |
| 2004–2005 | 50.2 | 69.3 | 55 |
| 2009–2010 | 51.7 | 71.6 | 57.1 |
| <4colc>Source: citet:anjani2014 | | | |
I have also tried (along with #+latex_header: \usepackage{caption})
#+name: milk-consumption-india
#+attr_latex: :float nil :environment tabular :caption \captionof{table}{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
| Year | Rural | Urban | All |
|---------------------------------+-------+-------+------|
| 1983 | 38.7 | 55.6 | 44.7 |
| 1993–1994 | 50.3 | 66.4 | 54.3 |
| 2004–2005 | 50.2 | 69.3 | 55 |
| 2009–2010 | 51.7 | 71.6 | 57.1 |
| <4colc>Source: citet:anjani2014 | | | |
Vikas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-11 2:16 Table caption in Latex export with :float nil Vikas Rawal
@ 2015-03-11 5:54 ` Vikas Rawal
2015-03-11 8:51 ` Rasmus
0 siblings, 1 reply; 7+ messages in thread
From: Vikas Rawal @ 2015-03-11 5:54 UTC (permalink / raw)
To: org-mode mailing list
This seems to work:
#+name: milk-consumption-india
#+attr_latex: :placement [H] :environment tabular :caption \captionof{table}{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
| Year | Rural | Urban | All |
|---------------------------------+-------+-------+------|
| 1983 | 38.7 | 55.6 | 44.7 |
| 1993–1994 | 50.3 | 66.4 | 54.3 |
| 2004–2005 | 50.2 | 69.3 | 55 |
| 2009–2010 | 51.7 | 71.6 | 57.1 |
| <4colc>Source: citet:anjani2014 | | | |
Is :float deprecated?
Vikas
> On 11-Mar-2015, at 7:46 am, Vikas Rawal <vikaslists@agrarianresearch.org> wrote:
>
> I need to insert a table in an mdframed box, for which I need to turn off :float. The following, however, does not give me the caption:
>
> #+name: milk-consumption-india
> #+attr_latex: :float nil :environment tabular :caption \caption{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
> | Year | Rural | Urban | All |
> |---------------------------------+-------+-------+------|
> | 1983 | 38.7 | 55.6 | 44.7 |
> | 1993–1994 | 50.3 | 66.4 | 54.3 |
> | 2004–2005 | 50.2 | 69.3 | 55 |
> | 2009–2010 | 51.7 | 71.6 | 57.1 |
> | <4colc>Source: citet:anjani2014 | | | |
>
>
> I have also tried (along with #+latex_header: \usepackage{caption})
>
> #+name: milk-consumption-india
> #+attr_latex: :float nil :environment tabular :caption \captionof{table}{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
> | Year | Rural | Urban | All |
> |---------------------------------+-------+-------+------|
> | 1983 | 38.7 | 55.6 | 44.7 |
> | 1993–1994 | 50.3 | 66.4 | 54.3 |
> | 2004–2005 | 50.2 | 69.3 | 55 |
> | 2009–2010 | 51.7 | 71.6 | 57.1 |
> | <4colc>Source: citet:anjani2014 | | | |
>
> Vikas
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-11 5:54 ` Vikas Rawal
@ 2015-03-11 8:51 ` Rasmus
2015-03-11 13:37 ` Vikas Rawal
0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2015-03-11 8:51 UTC (permalink / raw)
To: emacs-orgmode
> Is :float deprecated?
No but caption takes priority. I'm working on this case, but my
dev. computer is not well at the moment.
—Rasmus
--
Bang bang
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-11 8:51 ` Rasmus
@ 2015-03-11 13:37 ` Vikas Rawal
2015-03-11 13:58 ` Rasmus
0 siblings, 1 reply; 7+ messages in thread
From: Vikas Rawal @ 2015-03-11 13:37 UTC (permalink / raw)
To: Rasmus; +Cc: org-mode mailing list
>
>> Is :float deprecated?
>
> No but caption takes priority. I'm working on this case, but my
> dev. computer is not well at the moment.
>
We need to consider the scenario that if we need a captioned table without a floating environment, what is the right way of obtaining it. That is needed if you want to insert a table in an mdframed block.
I have managed to get it using :placement, but I am not sure if that is the right approach.
Vikas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-11 13:37 ` Vikas Rawal
@ 2015-03-11 13:58 ` Rasmus
2015-03-12 13:36 ` Vikas Rawal
0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2015-03-11 13:58 UTC (permalink / raw)
To: vikaslists; +Cc: emacs-orgmode
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>>
>>> Is :float deprecated?
>>
>> No but caption takes priority. I'm working on this case, but my
>> dev. computer is not well at the moment.
>>
>
> We need to consider the scenario that if we need a captioned table
> without a floating environment, what is the right way of obtaining
> it.
Is that a question? A right approach is to use the float package as you
did. I don't like it cause it redefines floats. Another right approach
is not to make it a float if you don't want it to float.... Then you
could use something like capt-of to get a caption and increase the counter
in question. This can be dangerous as floats could get out of order.
ATM for your example you could use either:
#+begin_mdframed
#+attr_latex: :float nil
#+LATEX: \captionof{table}{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
| Year | Rural | Urban | All |
|---------------------------------+-------+-------+------|
| 1983 | 38.7 | 55.6 | 44.7 |
| 1993–1994 | 50.3 | 66.4 | 54.3 |
| 2004–2005 | 50.2 | 69.3 | 55 |
| 2009–2010 | 51.7 | 71.6 | 57.1 |
#+end_mdframed
As caption forces float, or
#+begin_mdframed
#+name: milk-consumption-india
#+attr_latex: :placement [H]
#+caption: Average consumption of milk, India, kilograms per capita per annum
| Year | Rural | Urban | All |
|---------------------------------+-------+-------+------|
| 1983 | 38.7 | 55.6 | 44.7 |
| 1993–1994 | 50.3 | 66.4 | 54.3 |
| 2004–2005 | 50.2 | 69.3 | 55 |
| 2009–2010 | 51.7 | 71.6 | 57.1 |
#+end_mdframed
Which relies on package-float's H.
> That is needed if you want to insert a table in an mdframed block.
The previous discussion is here:
http://thread.gmane.org/gmane.emacs.orgmode/95224/focus=95229
Feel free to beat me with a patch!
> I have managed to get it using :placement, but I am not sure if that
> is the right approach.
You are using the float package. It's heretic, but don't worry about
it...
—Rasmus
--
Governments should be afraid of their people
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-11 13:58 ` Rasmus
@ 2015-03-12 13:36 ` Vikas Rawal
2015-03-12 13:52 ` Rasmus
0 siblings, 1 reply; 7+ messages in thread
From: Vikas Rawal @ 2015-03-12 13:36 UTC (permalink / raw)
To: Rasmus; +Cc: org-mode mailing list
>>
>> We need to consider the scenario that if we need a captioned table
>> without a floating environment, what is the right way of obtaining
>> it.
>
> Is that a question? A right approach is to use the float package as you
> did. I don't like it cause it redefines floats. Another right approach
> is not to make it a float if you don't want it to float.... Then you
> could use something like capt-of to get a caption and increase the counter
> in question. This can be dangerous as floats could get out of order.
>
> ATM for your example you could use either:
>
> #+begin_mdframed
> #+attr_latex: :float nil
> #+LATEX: \captionof{table}{\label{milk-consumption-india}Average consumption of milk, India, kilograms per capita per annum}
> | Year | Rural | Urban | All |
> |---------------------------------+-------+-------+------|
> | 1983 | 38.7 | 55.6 | 44.7 |
> | 1993–1994 | 50.3 | 66.4 | 54.3 |
> | 2004–2005 | 50.2 | 69.3 | 55 |
> | 2009–2010 | 51.7 | 71.6 | 57.1 |
> #+end_mdframed
>
>
Thanks, that is what I was trying to do for several days :).
> Which relies on package-float's H.
>
>> That is needed if you want to insert a table in an mdframed block.
>
> The previous discussion is here:
>
> http://thread.gmane.org/gmane.emacs.orgmode/95224/focus=95229
>
I did see this, but needed an example to understand what was going to work. Specifying \captionof in a separate line did not occur to me.
>
> You are using the float package. It's heretic, but don't worry about
> it…
>
:)
Thanks
Vikas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Table caption in Latex export with :float nil
2015-03-12 13:36 ` Vikas Rawal
@ 2015-03-12 13:52 ` Rasmus
0 siblings, 0 replies; 7+ messages in thread
From: Rasmus @ 2015-03-12 13:52 UTC (permalink / raw)
To: emacs-orgmode
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
> I did see this, but needed an example to understand what was going to
> work. Specifying \captionof in a separate line did not occur to me.
The point is merely that you need to "cheat" ox-latex to think there's not
a caption.
I used this macro as a workaround (since I also needed other backends
than).
#+MACRO: caption (eval (format (if (org-export-derived-backend-p org-export-current-backend 'latex) "@@latex:\\captionof{table}{%s\\label{%s}}@@" "#+CAPTION: %s") (org-trim "$1") (org-trim "$2")))
And then
{{{caption(⋯, NAME)}}}
in place of
#+CAPTION:⋯
You could probably make it smarter and capture the label automatically.
–Rasmus
--
Together we will make the possible totalllly impossible!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-12 13:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11 2:16 Table caption in Latex export with :float nil Vikas Rawal
2015-03-11 5:54 ` Vikas Rawal
2015-03-11 8:51 ` Rasmus
2015-03-11 13:37 ` Vikas Rawal
2015-03-11 13:58 ` Rasmus
2015-03-12 13:36 ` Vikas Rawal
2015-03-12 13:52 ` 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).