From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: Latex export of tables Date: Wed, 17 Apr 2013 11:21:55 +0100 Message-ID: <87bo9dzccc.fsf@gmail.com> References: <20130412080600.GA18235@panahar> <20130414232953.GC11696@kuru.dyndns-at-home.com> <20130416115619.GA12405@panahar> <20130416173948.GC7402@kuru.dyndns-at-home.com> <20130416213917.GA9183@kuru.dyndns-at-home.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USPTF-0004Cb-FT for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 06:20:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USPTD-0005rA-DJ for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 06:20:09 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:35995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USPTD-0005kv-4a for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 06:20:07 -0400 Received: by mail-wi0-f181.google.com with SMTP id c10so274255wiw.14 for ; Wed, 17 Apr 2013 03:20:06 -0700 (PDT) In-reply-to: <20130416213917.GA9183@kuru.dyndns-at-home.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Suvayu Ali Cc: emacs-orgmode@gnu.org, "Thomas S. Dye" 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}" "${IMAGE_DIR}/${DATA_DIR}" # changed_file_contents ${file_contents} # ) # file(WRITE # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.R # ${changed_file_contents} # ) # Command to run R if(R_COMPILE) message("Adding ........... ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR} COMMAND ${R_COMPILE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps ) message("Running ${R_COMPILE} ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps") # add_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps #) endif(R_COMPILE) # Make a list of all R files (for ADD_LATEX_DOCUMENT depend) set(ALL_R_FILES ${ALL_R_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps ) endforeach(file) # # Copy over all data files needed to generate R graphs # add_custom_command( # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR} # DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${DATA_DIR} # COMMAND ${CMAKE_COMMAND} -E copy_directory # ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${DATA_DIR} # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR} # ) add_latex_document( a.tex INPUTS texlib/mystyle.sty IMAGE_DIRS img/scans ${IMAGE_DIR} img DEPENDS ${ALL_R_FILES} mainfile BIBFILES texlib/mybiblatex.bib DEFAULT_PDF USE_NOMENCL ) #+END_SRC Myles