Re: [O] Latex export of tables
Hi Suvayu, Suvayu Ali writes: Actually, I am working on a workflow for large writing projects, my PhD thesis in this case :-p. What I have in mind is have a Makefile based build system that uses `emacs --batch' to export to LaTeX and html. The images are generated separately using babel blocks or standalone TeX files with TikZ code. I intend to make pdf images for LaTeX and convert them to png/svg with imagemagick/inkscape. Of course all of this is still a pipe dream; if I get it working, I'll definitely write a Worg page on it. Of course it will be great if people with interesting ideas pitch in :). I expect to have an early working environment in a couple of months. I am looking forward to seeing what you come up with. (I have mentioned this before, however) I have been using a CMake system for LaTeX export: http://cmake.org/Wiki/images/8/80/UseLATEX.cmake This allows (amongst other things) generating graphics from stand alone R scripts that get their own data from a database. I believe the new version has some kind of support for SVG. I used this system for several papers and my thesis and it has three main advantages: 1) out-of-source builds, so my working dir doesn't get cluttered with LaTeX files 2) asynchronous export of org to LaTeX (although this is now available with the new exporter) 3) the graphics are regenerated every time so I know it all still works I tangle a CMakeList.txt from every org file that I want to export, then run cmake ~/path; make from the commandline. (Version control as part of this workflow is possibly another topic: I have been using git subtrees to make project-local copies of files such as mystyle.sty and mybiblatex.bib and then update the main git repo with the changes, and pull the changes down to another project.) I'll just paste the whole CMakeList.txt so you can see what it looks like, but the most interesting part is the emacs --batch command: #+BEGIN_SRC sh :tangle CMakeLists.txt cmake_minimum_required(VERSION 2.8) project(relk NONE) include(/usr/share/cmake-2.8/Modules/UseLATEX.cmake) # export the .tex file from the .org file # using the emacs orgmode exporter latex_get_output_path(OUTPUT_DIR) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/relkpaper.org DESTINATION ${OUTPUT_DIR}/ ) file(COPY /home/myles/lib/lisp/my-export.el DESTINATION ${OUTPUT_DIR}/ ) add_custom_target( orgfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.org ) add_custom_target( elfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/my-export.el ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.tex COMMAND emacs --batch --eval \(progn (add-to-list 'load-path (expand-file-name \\~/.emacs.d/plugins/org-mode/lisp/\\)) (add-to-list 'load-path (expand-file-name \\~/.emacs.d/plugins/org-mode/contrib/lisp/\\ t)) (require 'org) (require 'ox) (require 'org-exp) (require 'org-inlinetask) (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (sh . t))) (setq org-confirm-babel-evaluate nil) (setq org-export-with-todo-keywords nil) (setq org-export-babel-evaluate nil) (load-file \\my-export.el\\) (add-to-list 'org-export-before-parsing-hook 'my-export-delete-headlines-tagged-noheading) (add-to-list 'org-export-filter-link-functions 'my-autoref-filter-link-func) (find-file \\${CMAKE_CURRENT_BINARY_DIR}/relkpaper.org\\) (org-latex-export-to-latex))\ DEPENDS orgfile elfile COMMENT Exporting orgmode file to LaTeX using emacs) add_custom_target( mainfile ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/relkpaper.tex ) # Set R executable set(R_COMPILE /usr/bin/Rscript) # Set the location of data files ##set(DATA_DIR data) # Set the location of the directory for image files set(IMAGE_DIR graphicsauto) # Get a list of R files file(GLOB_RECURSE R_FILES *.R) # Copy over all R scripts # add_custom_command( # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/R # DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/R # COMMAND ${CMAKE_COMMAND} -E copy_directory # ${CMAKE_CURRENT_SOURCE_DIR}/R # ${CMAKE_CURRENT_BINARY_DIR}/R # ) file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/R DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}) foreach(file ${R_FILES}) message(processing ${file}) get_filename_component(basename ${file} NAME_WE) #file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/R/${file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/R/${file}) # # Replace strings in R files so data files can be found # file(READ # ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${basename}.R # file_contents # ) # string(REPLACE ${DATA_DIR}
Re: [O] Latex export of tables
I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} I do not think this is possible. You have to realise that Org does not aim to support everything you can do with a backend natively. One of the primary reasons for that is the backend agnostic abstraction provided by Org. I have seen some way of doing things like this. See section 13.3 at http://orgmode.org/worg/org-tutorials/org-latex-export.html I can't get it to work though. Will keep trying. When in need of specific needs like this, I resort to writing LaTeX natively. I guess one thing about org-mode is that it is addictive. Afterall, if it is something to do with manipulating text, it ought to be possible :) There is also a reason for not doing it natively in latex even if the org-mode solution is somewhat round-about. I am writing a research paper using orgmode, with embedded R source blocks in it. I do not mind embedding some latex source block into it but I would not like to edit an exported latex file. After all, in the end, the objective is to be able to have an org file which produces a full paper when exported. Vikas
Re: [O] Latex export of tables
Hi Vikas I am not sure I understand the problem correctly, but how about this? Here is a table produced by a R-src block with some descriptive text in a minipage: ---snip-- #+BEGIN_SRC R :results output latex :exports results :session *R* :cache yes tab - matrix(1:12,nrow=4) cat(\n\\begin{table}\n) cat(\\begin{minipage}{\\textwidth}\n) cat(\\tiny{ Note: some descriptive text}\n) cat(\\end{minipage}\n) nix - apply(tab,1,function(x)cat(paste(x,collab=),\n)) cat(\\end{table}\n) #+END_SRC #+RESULTS[2013-04-16 15:11:58 964853177d477abc1cba212a72dde1f7cf3251c0]: #+BEGIN_LaTeX \begin{table} \begin{minipage}{\textwidth} \tiny{ Note: some descriptive text} \end{minipage} 1 5 9 \\ 2 6 10 \\ 3 7 11 \\ 4 8 12 \\ \end{table} #+END_LaTeX ---snap-- cheers Thomas Vikas Rawal vikasli...@agrarianresearch.org writes: I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} I do not think this is possible. You have to realise that Org does not aim to support everything you can do with a backend natively. One of the primary reasons for that is the backend agnostic abstraction provided by Org. I have seen some way of doing things like this. See section 13.3 at http://orgmode.org/worg/org-tutorials/org-latex-export.html I can't get it to work though. Will keep trying. When in need of specific needs like this, I resort to writing LaTeX natively. I guess one thing about org-mode is that it is addictive. Afterall, if it is something to do with manipulating text, it ought to be possible :) There is also a reason for not doing it natively in latex even if the org-mode solution is somewhat round-about. I am writing a research paper using orgmode, with embedded R source blocks in it. I do not mind embedding some latex source block into it but I would not like to edit an exported latex file. After all, in the end, the objective is to be able to have an org file which produces a full paper when exported. Vikas -- Thomas A. Gerds -- Assoc. Prof. Department of Biostatistics University of Copenhagen, Ă˜ster Farimagsgade 5, 1014 Copenhagen, Denmark Office: CSS-15.2.07 (Gamle Kommunehospital) tel: 35327914 (sec: 35327901)
Re: [O] Latex export of tables
Hi Vikas, On Tue, Apr 16, 2013 at 05:26:19PM +0530, Vikas Rawal wrote: I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} I do not think this is possible. You have to realise that Org does not aim to support everything you can do with a backend natively. One of the primary reasons for that is the backend agnostic abstraction provided by Org. I have seen some way of doing things like this. See section 13.3 at http://orgmode.org/worg/org-tutorials/org-latex-export.html I can't get it to work though. Will keep trying. Many of the things on that page is old exporter specific and probably will not work with the new exporter. There is also a reason for not doing it natively in latex even if the org-mode solution is somewhat round-about. I am writing a research paper using orgmode, with embedded R source blocks in it. I do not mind embedding some latex source block into it but I would not like to edit an exported latex file. After all, in the end, the objective is to be able to have an org file which produces a full paper when exported. Then generate LaTeX tables from R not Org tables. As far as I know, R is capable of that. I believe you can pass the :wrap latex option to the babel block to wrap your LaTeX table with #+begin_latex..#+end_latex. I'm suggesting this because if you continue on this path, i.e. litter your Org file with hacks, soon you will end up with an extremely fragile and complicated Org project. I have been down that road while writing my thesis. At one point I realised the problem and made the decision to split things into two kinds of files: static content (document structuring, text, plots, etc), and dynamic content (babel, TikZ blocks that generate tables, plots, figures, etc used by the static content files). It is still reproducible research, but modular and less hacky (hence more stable). Of course all of this is my personal opinion, it might be completely inappropriate advise for your use case. Good luck, -- Suvayu Open source is the future. It sets us free.
Re: [O] Latex export of tables
Aloha all, Jumping in here with apologies :) Suvayu Ali fatkasuvayu+li...@gmail.com writes: Hi Vikas, On Tue, Apr 16, 2013 at 05:26:19PM +0530, Vikas Rawal wrote: I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} I do not think this is possible. You have to realise that Org does not aim to support everything you can do with a backend natively. One of the primary reasons for that is the backend agnostic abstraction provided by Org. I have seen some way of doing things like this. See section 13.3 at http://orgmode.org/worg/org-tutorials/org-latex-export.html I can't get it to work though. Will keep trying. Many of the things on that page is old exporter specific and probably will not work with the new exporter. Yes, this page is all about workarounds for the old exporter. I believe John Hendy is reorganizing this material and at some point will either remove the tutorial or label it clearly as specific to the old exporter. There is also a reason for not doing it natively in latex even if the org-mode solution is somewhat round-about. I am writing a research paper using orgmode, with embedded R source blocks in it. I do not mind embedding some latex source block into it but I would not like to edit an exported latex file. After all, in the end, the objective is to be able to have an org file which produces a full paper when exported. Then generate LaTeX tables from R not Org tables. As far as I know, R is capable of that. I believe you can pass the :wrap latex option to the babel block to wrap your LaTeX table with #+begin_latex..#+end_latex. One reason to stick with Org tables is to ensure stylistic consistency in the LaTeX output for all tables, regardless of where they originated. This is more of a convenience than anything else, since the approach you suggest can yield arbitrarily styled tables, too. I'm suggesting this because if you continue on this path, i.e. litter your Org file with hacks, soon you will end up with an extremely fragile and complicated Org project. I have been down that road while writing my thesis. At one point I realised the problem and made the decision to split things into two kinds of files: static content (document structuring, text, plots, etc), and dynamic content (babel, TikZ blocks that generate tables, plots, figures, etc used by the static content files). It is still reproducible research, but modular and less hacky (hence more stable). The path to a fragile and complicated Org project is well-worn, I've been down it too many times myself. The habits I've developed over time have helped, but I think they are less systematic than what you've devised. I'd love to see some notes on your solution as a brief tutorial or an expanded FAQ on Worg. I'll be happy to contribute or help if you find time to do something like this. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] Latex export of tables
Hey Tom, On Tue, Apr 16, 2013 at 10:07:26AM -1000, Thomas S. Dye wrote: Aloha all, Jumping in here with apologies :) Isn't that why we discuss on mailing lists, so that people can jump in ;). I'm suggesting this because if you continue on this path, i.e. litter your Org file with hacks, soon you will end up with an extremely fragile and complicated Org project. I have been down that road while writing my thesis. At one point I realised the problem and made the decision to split things into two kinds of files: static content (document structuring, text, plots, etc), and dynamic content (babel, TikZ blocks that generate tables, plots, figures, etc used by the static content files). It is still reproducible research, but modular and less hacky (hence more stable). The path to a fragile and complicated Org project is well-worn, I've been down it too many times myself. The habits I've developed over time have helped, but I think they are less systematic than what you've devised. I'd love to see some notes on your solution as a brief tutorial or an expanded FAQ on Worg. I'll be happy to contribute or help if you find time to do something like this. Actually, I am working on a workflow for large writing projects, my PhD thesis in this case :-p. What I have in mind is have a Makefile based build system that uses `emacs --batch' to export to LaTeX and html. The images are generated separately using babel blocks or standalone TeX files with TikZ code. I intend to make pdf images for LaTeX and convert them to png/svg with imagemagick/inkscape. Of course all of this is still a pipe dream; if I get it working, I'll definitely write a Worg page on it. Of course it will be great if people with interesting ideas pitch in :). I expect to have an early working environment in a couple of months. :) -- Suvayu Open source is the future. It sets us free.
Re: [O] Latex export of tables
Hi Suvayu, Suvayu Ali fatkasuvayu+li...@gmail.com writes: Hey Tom, Actually, I am working on a workflow for large writing projects, my PhD thesis in this case :-p. What I have in mind is have a Makefile based build system that uses `emacs --batch' to export to LaTeX and html. The images are generated separately using babel blocks or standalone TeX files with TikZ code. I intend to make pdf images for LaTeX and convert them to png/svg with imagemagick/inkscape. Of course all of this is still a pipe dream; if I get it working, I'll definitely write a Worg page on it. Of course it will be great if people with interesting ideas pitch in :). I expect to have an early working environment in a couple of months. This sounds like the system I was using near the end of the old exporter's life. When Nicolas added asynchronous export to the new exporter I was able to abandon the Makefile. Lately, I've been tangling init.el files from my source document. I really like this approach because the asynchronous exporter starts off with a fresh emacs instance (the infamous emacs -Q, I think) and you don't have to worry if your .emacs has an old setting that has some weird effect on export--all of the setup is in the babel block that generates the init.el file. I like that the init.el setup travels with the document in the Org mode file. I think it helps with reproducibility. All the best, Tom -- T.S. Dye Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com
Re: [O] Latex export of tables
Hello Vikas, On Fri, Apr 12, 2013 at 01:36:01PM +0530, Vikas Rawal wrote: I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} I do not think this is possible. You have to realise that Org does not aim to support everything you can do with a backend natively. One of the primary reasons for that is the backend agnostic abstraction provided by Org. When in need of specific needs like this, I resort to writing LaTeX natively. Hope this helps somehow, -- Suvayu Open source is the future. It sets us free.
[O] Latex export of tables
I am using org-mode version 8.0-pre (release_8.0-pre-247-gbc3ccd @ /home/vikas/lisp/org-mode/lisp/). I have a table generated by a source block in a document that I would like to export to latex. In the exported tex file, I would like org to insert a line like the following between \end(tabular} and \end{table} \begin{minipage}{\textwidth} \tiny Note: Some descriptive text here. \end{minipage} Can somebody suggest what I could do to insert this? I have been playing with something like the following but am not able to get it right. #+LATEX: { #+NAME: table-name-out #+CAPTION: Average gross value of output and net income from cultivation of wheat intercropped with rapeseed, by class, Mahatwar (Rupees per acre, 2005-06 prices) #+attr_latex: :environment tabulary :width 15cm :align l|RRR #+RESULTS: source_code_name | A | B | C | |---+---+---| | 1 | 1 | 1 | | 1 | 2 | 3 | | 2 | 2 | 4 | #+LATEX: \begin{minipage}{} \tiny Note: Some descriptive text here.#\end{minipage} } Vikas