Re: [O] [new exporter] Captions for tables made by source blocks
Hello Achim, Achim Gratz wrote: Nicolas Goaziou writes: It's very easy to have a caption on the generated output: name the code. Hence, the following code block: #+NAME: calculation #+BEGIN_SRC emacs-lisp (+ 1 1) #+END_SRC will produce: #+RESULTS: calculation 2 If you add a caption to the results, like: #+CAPTION: Basic arithmetic #+RESULTS: calculation 2 you can update the source block without ever needing to remove the caption. Great. I could swear the last time I was trying this it would add a new result block on top of the old one, but I may have changed the name inbetween. The thing is: - you try with an unnamed block - you get an unnamed result block inserted - you name the block - you get a named result block inserted - you have to manually remove the unnamed result block It would still be nice (I think) if an unnamed source block would simply replace the next unnamed result block if there is one. I think this is a great proposition, which would make a lot of sense. Best regards, Seb -- Sebastien Vauban
Re: [O] [new exporter] Captions for tables made by source blocks
Hello, Mike McLean mike.mcl...@pobox.com writes: On Wed, Mar 6, 2013 at 7:28 AM, Nicolas Goaziou n.goaz...@gmail.com wrote: Vikas Rawal vikasli...@agrarianresearch.org writes: CAPTION keyword above a source block applies to the source block only. If the source block generates a table, you have to put a CAPTION above it, as it will not inherit the caption of the source block. It also implies that you need to name the results. Otherwise, source block will not recognize its own production, due to the CAPTION keyword above it. Thank you once again Nicolas. I understand from this that the variable org-babel-results-keyword has to be changed to NAME. I did this and it works. Is there a way that this could be file-specific? I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. Interesting that this topic comes up today just as I noticed it. I'm still unclear about how to put the CAPTION keyword in when using a dynamic block via org-collector.el. I have the lines below and I do not get a table caption like I used to in the old exporter. #+NAME: tbl-coi #+CAPTION: COI Table #+BEGIN: propview :colnames ( Area Shorthand COI ) :cols ( AREA CATEGORY ITEM ) :match +COI+LEVEL=2-ARCHIVE :noquote t :scope agenda :inherit (AREA) For the same reason, caption here applies to the dynamic block, not to its contents. The usual way to handle it is to provide a :caption argument in the header, which will in turn create a #+CAPTION keyword above the table upon updating. However, I don't think that org-collector handles it. You may want to patch it (you can look at `org-clocktable-write-default' for an example). Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. There is something strange happening. Cross-references to captions of tables that are produced thus get exported to latex as \texttt{something} rather than as \ref{something}. Am not able to figure out what have I missed up. It was working fine yesterday but then [perhaps] I did something. Vikas
Re: [O] [new exporter] Captions for tables made by source blocks
Vikas Rawal vikasli...@agrarianresearch.org writes: I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. There is something strange happening. Cross-references to captions of tables that are produced thus get exported to latex as \texttt{something} rather than as \ref{something}. Am not able to figure out what have I missed up. It was working fine yesterday but then [perhaps] I did something. Could you provide an ECM? Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
Could you provide an ECM? See the attached dummy file. Vikas #+STARTUP: hidestars #+TITLE: Title of the paper #+DATE: #+AUTHOR: name of author #+COLUMNS: %25ITEM %TAGS %PRIORITY %T #+property: exports results #+property: session fbi #+OPTIONS: H:2 toc:nil num:1 #+LaTeX_CLASS: article * Introduction Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. * Levels and variation in farm business incomes ** Annual income from crop production + For a large majority of cultivating households in all the villages, crop production provided only meagre incomes. Table [[crop-median]] shows median incomes from crop production in each village. The Table shows that the median annual income was only Rs. 1290 per household in Mahatwar, a village where agriculture was primarily rainfed. Even in Ananthavaram, where Xx of the gross cropped area was irrigated, annual income was only Rs. 2654 per household. In Warwat Khanderao, a cotton-growing village in Vidarbha region, median income from crop production was only Rs. 14755 per household. In Nimshirgaon, where sugarcane was the most important crop, the median income from crop production was only Rs. 9991 per household. #+CAPTION: Median and ninth decile annual income from crop production, by village (2005-06 prices) #+NAME: crop-median #+BEGIN_SRC R :results value :colnames yes :hline yes c(1:5)-a data.frame(name=paste(a,a),id=a,id2=a^2)-b b #+END_SRC #+CAPTION: Median and ninth decile annual income from crop production, by village (2005-06 prices) #+RESULTS: crop-median | name | id | id2 | |--++-| | a 1 | 1 | 1 | | a 2 | 2 | 4 | | a 3 | 3 | 9 | | a 4 | 4 | 16 | | a 5 | 5 | 25 |
Re: [O] [new exporter] Captions for tables made by source blocks
Could you provide an ECM? Please see the attached file. Vikas #+STARTUP: hidestars #+TITLE: Title of the paper #+DATE: #+AUTHOR: name of author #+COLUMNS: %25ITEM %TAGS %PRIORITY %T #+property: exports results #+property: session fbi #+OPTIONS: H:2 toc:nil num:1 #+LaTeX_CLASS: article * Introduction Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. * Levels and variation in farm business incomes ** Annual income from crop production + For a large majority of cultivating households in all the villages, crop production provided only meagre incomes. Table [[crop-median]] shows median incomes from crop production in each village. The Table shows that the median annual income was only Rs. 1290 per household in Mahatwar, a village where agriculture was primarily rainfed. Even in Ananthavaram, where Xx of the gross cropped area was irrigated, annual income was only Rs. 2654 per household. In Warwat Khanderao, a cotton-growing village in Vidarbha region, median income from crop production was only Rs. 14755 per household. In Nimshirgaon, where sugarcane was the most important crop, the median income from crop production was only Rs. 9991 per household. #+CAPTION: Median and ninth decile annual income from crop production, by village (2005-06 prices) #+NAME: crop-median #+BEGIN_SRC R :results value :colnames yes :hline yes c(1:5)-a data.frame(name=paste(a,a),id=a,id2=a^2)-b b #+END_SRC #+CAPTION: Median and ninth decile annual income from crop production, by village (2005-06 prices) #+RESULTS: crop-median | name | id | id2 | |--++-| | a 1 | 1 | 1 | | a 2 | 2 | 4 | | a 3 | 3 | 9 | | a 4 | 4 | 16 | | a 5 | 5 | 25 |
Re: [O] [new exporter] Captions for tables made by source blocks
Vikas Rawal vikasli...@agrarianresearch.org writes: Could you provide an ECM? I have always used something along these lines #+label: crop-median just before the table to define the target. This works for your ECM. -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
Re: [O] [new exporter] Captions for tables made by source blocks
Nicolas Goaziou writes: For the same reason, caption here applies to the dynamic block, not to its contents. This seems to be a common enough mistake and it is currently impossible to put captions and other arguments on results blocks save with yet another source block that produces the correct org code (well you can put the headers there after the result has been generated, but then you have to delete all that stuff before generating a new result). Would it be possible to either change the insertion of the results so that the user has a chance to put any options before the place where it should go or (I'm not fond of that idea, but I'll put it out there anyway) have yet more option arguments (along the lines of #+RESULTS_HEADER…) that will be transferred to the results block along with the actual result? Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ DIY Stuff: http://Synth.Stromeko.net/DIY.html
Re: [O] [new exporter] Captions for tables made by source blocks
Vikas Rawal vikasli...@agrarianresearch.org writes: Could you provide an ECM? Please see the attached file. I cannot reproduce it, i.e. I get \ref{crop-median} in the output. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
Hello, Achim Gratz strom...@nexgo.de writes: Nicolas Goaziou writes: For the same reason, caption here applies to the dynamic block, not to its contents. This seems to be a common enough mistake and it is currently impossible to put captions and other arguments on results blocks save with yet another source block that produces the correct org code (well you can put the headers there after the result has been generated, but then you have to delete all that stuff before generating a new result). It's very easy to have a caption on the generated output: name the code. Hence, the following code block: #+NAME: calculation #+BEGIN_SRC emacs-lisp (+ 1 1) #+END_SRC will produce: #+RESULTS: calculation 2 If you add a caption to the results, like: #+CAPTION: Basic arithmetic #+RESULTS: calculation 2 you can update the source block without ever needing to remove the caption. At some point, it would be nice if Babel could find captioned anonymous results (so you wouldn't even have to name the block). I'll have a look at it. But meanwhile, this solution is sufficient. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
Nicolas Goaziou writes: It's very easy to have a caption on the generated output: name the code. Hence, the following code block: #+NAME: calculation #+BEGIN_SRC emacs-lisp (+ 1 1) #+END_SRC will produce: #+RESULTS: calculation 2 If you add a caption to the results, like: #+CAPTION: Basic arithmetic #+RESULTS: calculation 2 you can update the source block without ever needing to remove the caption. Great. I could swear the last time I was trying this it would add a new result block on top of the old one, but I may have changed the name inbetween. It would still be nice (I think) if an unnamed source block would simply replace the next unnamed result block if there is one. At some point, it would be nice if Babel could find captioned anonymous results (so you wouldn't even have to name the block). I'll have a look at it. But meanwhile, this solution is sufficient. Oh absolutely. Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ Wavetables for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
Re: [O] [new exporter] Captions for tables made by source blocks
Could you provide an ECM? Please see the attached file. I cannot reproduce it, i.e. I get \ref{crop-median} in the output. This is odd!! Please see the .tex file attached with this mail. This is what I get. Any idea, how do I debug this? Vikas
Re: [O] [new exporter] Captions for tables made by source blocks
Could you provide an ECM? Please see the attached file. I cannot reproduce it, i.e. I get \ref{crop-median} in the output. Regards, For me, it works if I change the value of org-babel-results-keyword to NAME. Then the results block is produced with #+NAME: crop-median The cross-reference picks this up fine. But when org-babel-results-keyword is set to RESULTS, the results block is produced with #+RESULTS: crop-median The cross-reference does not pick it up correctly. The latex backend does not export it with a \ref but with a \texttt. The odt backend also produces crop-median in cross-reference rather than the table number. Vikas
[O] [new exporter] Captions for tables made by source blocks
There has been some change in the behaviour of #+CAPTION in case of tables made by source blocks. In the old exporter, #+CAPTION just before #+BEGIN_SRC was sufficient to place the caption before the table when the file was exported. The new exporter does not produce captions the same way. When I looked through the list archives, I found some discussion ( http://list-archives.org/2012/08/20/emacs-orgmode-gnu-org/o-new-exporter-and-latex-attributes/f/2837855005, and http://www.mail-archive.com/emacs-orgmode@gnu.org/msg57188.html ) It is, however, not clear if the problem was finally resolved and what is the recommended practice. Could somebody explain? Vikas
Re: [O] [new exporter] Captions for tables made by source blocks
Hello, Vikas Rawal vikasli...@agrarianresearch.org writes: There has been some change in the behaviour of #+CAPTION in case of tables made by source blocks. In the old exporter, #+CAPTION just before #+BEGIN_SRC was sufficient to place the caption before the table when the file was exported. The new exporter does not produce captions the same way. When I looked through the list archives, I found some discussion ( http://list-archives.org/2012/08/20/emacs-orgmode-gnu-org/o-new-exporter-and-latex-attributes/f/2837855005, and http://www.mail-archive.com/emacs-orgmode@gnu.org/msg57188.html ) It is, however, not clear if the problem was finally resolved and what is the recommended practice. Could somebody explain? CAPTION keyword above a source block applies to the source block only. If the source block generates a table, you have to put a CAPTION above it, as it will not inherit the caption of the source block. It also implies that you need to name the results. Otherwise, source block will not recognize its own production, due to the CAPTION keyword above it. HTH, Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
CAPTION keyword above a source block applies to the source block only. If the source block generates a table, you have to put a CAPTION above it, as it will not inherit the caption of the source block. It also implies that you need to name the results. Otherwise, source block will not recognize its own production, due to the CAPTION keyword above it. Thank you once again Nicolas. I understand from this that the variable org-babel-results-keyword has to be changed to NAME. I did this and it works. Is there a way that this could be file-specific? Vikas
Re: [O] [new exporter] Captions for tables made by source blocks
Vikas Rawal vikasli...@agrarianresearch.org writes: CAPTION keyword above a source block applies to the source block only. If the source block generates a table, you have to put a CAPTION above it, as it will not inherit the caption of the source block. It also implies that you need to name the results. Otherwise, source block will not recognize its own production, due to the CAPTION keyword above it. Thank you once again Nicolas. I understand from this that the variable org-babel-results-keyword has to be changed to NAME. I did this and it works. Is there a way that this could be file-specific? I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. BTW, you mustn't change `org-babel-results-keyword'. I don't even know why this is a defcustom and why it is allowed to turn it into NAME. RESULTS refers to the name of the src-block which produced the current element, whereas NAME refers to the name of the current element. Their purpose is completely different. Cc'ing Eric Schulte about it. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] Captions for tables made by source blocks
I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. Got it. Thanks. BTW, you mustn't change `org-babel-results-keyword'. I don't even know why this is a defcustom and why it is allowed to turn it into NAME. RESULTS refers to the name of the src-block which produced the current element, whereas NAME refers to the name of the current element. Their purpose is completely different. Have changed `org-babel-results-keyword' back to RESULTS. The captions are working fine. Thank you. Cc'ing Eric Schulte about it. Let us hear from Eric what is the purpose of this variable, and if it has some use. Best, Vikas
Re: [O] [new exporter] Captions for tables made by source blocks
Vikas Rawal vikasli...@agrarianresearch.org writes: I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. Got it. Thanks. BTW, you mustn't change `org-babel-results-keyword'. I don't even know why this is a defcustom and why it is allowed to turn it into NAME. RESULTS refers to the name of the src-block which produced the current element, whereas NAME refers to the name of the current element. Their purpose is completely different. Have changed `org-babel-results-keyword' back to RESULTS. The captions are working fine. Thank you. Cc'ing Eric Schulte about it. Let us hear from Eric what is the purpose of this variable, and if it has some use. IIRC, that was introduced to allow users to choose #+results or #+Results. Regards, Andreas
Re: [O] [new exporter] Captions for tables made by source blocks
On Wed, Mar 6, 2013 at 7:28 AM, Nicolas Goaziou n.goaz...@gmail.com wrote: Vikas Rawal vikasli...@agrarianresearch.org writes: CAPTION keyword above a source block applies to the source block only. If the source block generates a table, you have to put a CAPTION above it, as it will not inherit the caption of the source block. It also implies that you need to name the results. Otherwise, source block will not recognize its own production, due to the CAPTION keyword above it. Thank you once again Nicolas. I understand from this that the variable org-babel-results-keyword has to be changed to NAME. I did this and it works. Is there a way that this could be file-specific? I wasn't clear. By naming the results, I mean that you must provide your source block a #+NAME: something attribute, so the generated table gets a #+RESULTS: something attribute. Interesting that this topic comes up today just as I noticed it. I'm still unclear about how to put the CAPTION keyword in when using a dynamic block via org-collector.el. I have the lines below and I do not get a table caption like I used to in the old exporter. #+NAME: tbl-coi #+CAPTION: COI Table #+BEGIN: propview :colnames ( Area Shorthand COI ) :cols ( AREA CATEGORY ITEM ) :match +COI+LEVEL=2-ARCHIVE :noquote t :scope agenda :inherit (AREA) Mike