From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Restrict include to some backend
Date: Tue, 6 Sep 2016 09:59:58 -0400 [thread overview]
Message-ID: <bcd154cc-c7c8-bed9-467f-264f1db44c5b@gmail.com> (raw)
In-Reply-To: <CAFgFV9Ob+8_H3L-1a+-67gRZ8tT5jgFMbFW6_TPTsmue3_-aQw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2036 bytes --]
Hi Fabrice,
I've run into this issue recently (while writing my first large document in Org). I couldn't find a good natice solution, so I used a rather unpleasant trick, and I've been meaning to write emacs-orgmode about it since then.
In my documents I have a BEGIN_ONLY environment that I use like this:
#+begin_export html
#+include foo.py src python
#+end_export
#+begin_export latex
This is processed as *regular* ~org-mode~ code, but only when exporting to LaTeX.
#+end_export
I remove the blocks based on the current backend using a crude pre-processing step in Emacs lisp. I can share the code if you're in a hurry, but maybe this idea can also be integrated to Org itself?
For the record, here are places where this was useful:
* Some complex math was improperly rendered by MathJax; I made SVG images of it and declared a macro that inserted the actual math in LaTeX mode, and the SVG in HTML mode. To get backend-dependent macro definitions, I used BEGIN_ONLY blocks.
* I wanted to set the TOC depth only for the HTML version; I used
#+BEGIN_ONLY html
#+TOC: headlines 2
#+END_ONLY html
* In HTML mode listings are labeled as "listings," but in TeX mode they are listed as "figures"; I used a backend-dependent macro definition to smoothe out the difference.
* I split a figure in two in HTML, while using two subfigures in LaTeX
* I included PDF figures in LaTeX and SVG figures in HTML in some places
* I have my own custom-written citation processor for HTML; I included the "* Bibliography" header only in the HTML, since LaTeX inserted it by itself.
Cheers,
Clément.
On 2016-09-06 01:13, Fabrice Popineau wrote:
> Hi,
>
> Maybe there is an obvious answer but I wonder how to restrict
> including a file to some backend. The following doesn't work:
>
> #+begin_export latex
> #+include foo.py src python
> #+end_export
>
> (Not that I expected it to actually work, but it shows the goal)
> Any idea ? Thanks for your help.
>
> Fabrice
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-09-06 14:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 5:13 Restrict include to some backend Fabrice Popineau
2016-09-06 13:59 ` Clément Pit--Claudel [this message]
2016-09-06 14:59 ` Clément Pit--Claudel
2016-09-06 15:58 ` Nicolas Goaziou
2016-09-06 18:15 ` Clément Pit--Claudel
2016-09-06 20:32 ` Nicolas Goaziou
2016-09-13 3:10 ` Kaushal Modi
2016-09-13 3:14 ` Clément Pit--Claudel
2016-09-14 11:55 ` Kaushal Modi
2016-09-14 12:21 ` Clément Pit--Claudel
2016-09-14 12:33 ` Kaushal Modi
2016-09-06 20:10 ` Fabrice Popineau
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=bcd154cc-c7c8-bed9-467f-264f1db44c5b@gmail.com \
--to=clement.pit@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).