emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: carsten.dominik@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [export] Should sidewaystable option automatically add rotating package?
Date: Tue, 17 Sep 2013 15:24:35 +0200	[thread overview]
Message-ID: <87ioxztwbw.fsf@pank.eu> (raw)
In-Reply-To: <170A71C4-F232-4E00-BB52-3EB667D570BC@gmail.com> (Carsten Dominik's message of "Tue, 17 Sep 2013 06:48:27 +0200")

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> 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	other threads:[~2013-09-17 13:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 11:05 [export] Should sidewaystable option automatically add rotating package? Eric S Fraga
2013-09-11 12:01 ` Rasmus
2013-09-11 12:08   ` Eric S Fraga
2013-09-11 12:14     ` Carsten Dominik
2013-09-11 12:25       ` Rasmus
2013-09-11 15:24         ` Eric S Fraga
2013-09-11 12:30       ` Rainer M Krug
2013-09-12 17:42   ` Nicolas Goaziou
2013-09-12 18:33     ` Rasmus
2013-09-12 19:00       ` Nicolas Goaziou
2013-09-13  8:49         ` Sebastien Vauban
2013-09-12 19:22     ` Carsten Dominik
2013-09-13  8:01     ` Detlef Steuer
2013-09-15  4:49       ` Carsten Dominik
2013-09-15 14:02         ` Nicolas Girard
2013-09-16  8:08           ` Carsten Dominik
2013-09-16 10:47         ` Rasmus
2013-09-16 11:26           ` Rainer M Krug
2013-09-16 13:27           ` Carsten Dominik
2013-09-16 13:38             ` Carsten Dominik
2013-09-16 19:26             ` Rasmus
2013-09-16 20:21               ` Andreas Leha
2013-09-17  1:45               ` Eric Abrahamsen
2013-09-17  4:48                 ` Carsten Dominik
2013-09-17 13:24                   ` Rasmus [this message]
2013-09-18 13:18                     ` Carsten Dominik
2013-09-18 22:21                       ` Rasmus
2013-09-19  2:04                         ` Carsten Dominik
2013-09-19  9:11                           ` Rasmus
2013-09-19  9:28                             ` Carsten Dominik
2013-09-19  9:38                           ` Nicolas Girard
2013-09-19 11:05                             ` Carsten Dominik
2013-09-25  7:04                             ` Carsten Dominik
2013-09-25  7:45                               ` Nicolas Girard
2013-09-25  7:50                                 ` Carsten Dominik
2013-09-25  9:09                                 ` Rasmus
2013-09-26  8:51                                   ` Marcin Borkowski
2013-09-17 13:30                 ` Rasmus
2013-09-17  5:11 ` Carsten Dominik
2013-09-17  8:05   ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ioxztwbw.fsf@pank.eu \
    --to=rasmus@gmx.us \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).