emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vincent Beffara <vbeffara@ens-lyon.fr>
To: emacs-orgmode@gnu.org
Subject: Re: Using different image format given the export backend
Date: Mon, 01 Jul 2013 21:22:49 +0200	[thread overview]
Message-ID: <m2y59qytiu.fsf@ens-lyon.fr> (raw)
In-Reply-To: 51D1D253.3010808@lal.in2p3.fr


Hello,

> #+CAPTION: Toto figure
> #+NAME: fig::toto
> #+ATTR_LATEX: :width 0.38\textwidth
> #+BEGIN_SRC emacs-lisp :exports results :results value raw
>    (case (and (boundp 'backend) backend)
>      (nil "")
>      (latex "[[file:./toto.pdf]]"
>      (html  "[[file:./toto.png]]"))
> #+END_SRC

I do it like this:

(defun vb-massage-includegraphics (str backend opts)
  (replace-regexp-in-string ".png}" ".pdf}" str))
(add-hook 'org-export-filter-final-output-functions
          'vb-massage-includegraphics)

And then, simply refer to the png file in the .org file. Then nothing
happens for the html output, but on latex export, the regexp matches the
'}' and includes the .pdf file instead.

That is extremely ugly, and makes plenty of assumptions, most of all
that the .pdf file exists. And it should probably test for the value of
'backend'. But for personal use, it is convenient ...

           /v

-- 
Vincent Beffara

  reply	other threads:[~2013-07-01 19:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 19:02 Using different image format given the export backend Garrido Xavier
2013-07-01 19:22 ` Vincent Beffara [this message]
2013-07-02  6:39   ` Xavier Garrido

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=m2y59qytiu.fsf@ens-lyon.fr \
    --to=vbeffara@ens-lyon.fr \
    --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).