From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [export] Should sidewaystable option automatically add rotating package? Date: Tue, 17 Sep 2013 15:24:35 +0200 Message-ID: <87ioxztwbw.fsf@pank.eu> References: <87ob7z4nzl.fsf@pinto.chemeng.ucl.ac.uk> <877gentvmv.fsf@gmx.us> <87wqmmos25.fsf@gmail.com> <20130913100125.257db23d@vknecht-intel.unibw-hamburg.de> <87ioy1vya1.fsf@gmx.us> <874n9kwott.fsf@gmx.us> <87zjrcmdai.fsf@ericabrahamsen.net> <170A71C4-F232-4E00-BB52-3EB667D570BC@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLvGm-0003c3-4l for emacs-orgmode@gnu.org; Tue, 17 Sep 2013 09:24:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLvGg-0000vk-5M for emacs-orgmode@gnu.org; Tue, 17 Sep 2013 09:24:44 -0400 Received: from eumx.net ([91.82.101.43]:38229 helo=owm.eumx.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLvGf-0000vd-Uj for emacs-orgmode@gnu.org; Tue, 17 Sep 2013 09:24:38 -0400 In-Reply-To: <170A71C4-F232-4E00-BB52-3EB667D570BC@gmail.com> (Carsten Dominik's message of "Tue, 17 Sep 2013 06:48:27 +0200") 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: carsten.dominik@gmail.com Cc: emacs-orgmode@gnu.org Hi Carsten, Carsten Dominik writes: > I'd be interested to see a patch to this effect. For now here's the filter I use and a add-to-list that hopefully works. It could be turned into a general function such that - Certain packages are only required with certain flavors of TeX (curtsy of iftex). - It only applies to the preamble (e.g. I don't want it in my code-blocks). For me it works great because I can quickly check drafts with pdftex (which is substantially faster on my system) and switch to xelatex or lualatex for more serious drafts. (setq rasmus/org-protected-packages '(inputenc fontenc)) (add-to-list 'org-latex-default-packages-alist '("" "iftex" nil)) (defun rasmus/org-latex-filter-protect-inputenc (text backend info) "Make inputenc and fontenc only load when using pdflatex" (when (org-export-derived-backend-p backend 'latex 'beamer) (replace-regexp-in-string (format "\\(\\\\usepackage\\[.*\\]{\\(%s\\)}\\)" (mapconcat 'symbol-name pank/org-protected-packages "\\|")) "\\\\ifPDFTeX\\1\\\\else\\\\fi" text))) (add-to-list 'org-export-filter-final-output-functions 'rasmus/org-latex-filter-protect-inputenc) The output tex file looks something like this: \ifPDFTeX\usepackage[utf8]{inputenc}\else\fi \ifPDFTeX\usepackage[T1]{fontenc}\else\fi BTW: I think the \else is redundant. =E2=80=93Rasmus -- There are known knowns; there are things we know that we know.