emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [export] Should sidewaystable option automatically add rotating


From: Rasmus
Subject: Re: [O] [export] Should sidewaystable option automatically add rotating package?
Date: Tue, 17 Sep 2013 15:24:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi Carsten,

Carsten Dominik <address@hidden> 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.

–Rasmus

--
There are known knowns; there are things we know that we know.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]