From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [RFC] [PATCH] conditional use of latex packages Date: Wed, 20 Feb 2013 23:02:21 -0500 Message-ID: <1361419346-23146-1-git-send-email-aaronecay@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8NMy-0001PG-N8 for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 23:02:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8NMs-000374-87 for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 23:02:52 -0500 Received: from mail-ve0-f177.google.com ([209.85.128.177]:51238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8NMs-00036x-4M for emacs-orgmode@gnu.org; Wed, 20 Feb 2013 23:02:46 -0500 Received: by mail-ve0-f177.google.com with SMTP id m1so7546016ves.22 for ; Wed, 20 Feb 2013 20:02:45 -0800 (PST) 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: emacs-orgmode@gnu.org Hello, The current way that org handles LaTeX packages for export isn’t optimal. The org-latex-(default-)packages-alist variables define a set of packages that are loaded always. If a user wants to use advanced functionality (booktabs for nicer table export, listings or minted for nicer source code), s/he has to add the packages to these variables manually. And a package like longtables is imported into every document, slowing down compilation even when it is not used. The attached patches (specifically 1, 2, and 5) introduce a mechanism to load certain packages only when needed. It is possible to customize these packages by specifying options to be passed to their \usepackage (only inserted if needed to properly export the document), as well as arbitrary code to place in the document’s preamble if the package is used. The other patches in the series (3, 4) fix the latex exporter’s handling of tikz image files, as generated by R’s tikzDevice function. Currently, a link to the file containing the graphics code is inserted. The proper behavior is to \input the file; the source code therein is compiled into a graph by LaTeX as it compiles the document. (Tikz is a very expensive latex package to load; the ability to load tikz only when necessary motivated the optional packages mechanism.) I think these patches need more testing, but I wanted to send them along for feedback. If it is not desired to change the status quo wrt. packages like booktabs and minted (must be manually added), and wrapfig and longtable (will always be used even if not needed), it would be possible to accept only patches 1, 3, and 4. (But obviously I think the other patches are a marked improvement.) With luck, the patches will be sent as replies to this message with git send-email. Thanks, Aaron PS I’ve sent away for the copyright assignment forms from the FSF...