8000 multi-export-target macros · Issue #3 · fniessen/org-macros · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
multi-export-target macros #3
Open
@mdsib

Description

@mdsib

I'm working on an org file that will eventually export to html and pdf/latex.

If anyone's interested, I can add these sorts of macros on here, and perhaps give them some better names.

#+MACRO: begin_main (eval (begin-main-macro))
#+MACRO: end_main (eval (end-main-macro))
#+MACRO: begin_aside (eval (begin-aside-macro))
#+MACRO: end_aside (eval (end-aside-macro))
#+begin_src elisp :exports results :results silent
  (defun begin-main-macro ()
    (pcase org-export-current-backend
      ('latex "\\begin{minipage}[t]{0.5\\textwidth}")
      ('html "@@html:<div class='main'>@@")
      (t "")))
  (defun end-main-macro ()
    (pcase org-export-current-backend
      ('latex "\\end{minipage}")
      ('html "@@html:</div>@@")
      (t "")))
  (defun begin-aside-macro ()
    (pcase org-export-current-backend
      ('latex "\\begin{minipage}[t]{0.2\\textwidth}")
      ('html "@@html:<div class='aside'>@@")
      (t "")))
  (defun end-aside-macro ()
    (pcase org-export-current-backend
      ('latex "\\end{minipage}")
      ('html "@@html:</div>@@")
      (t "")))
#+end_src

Usage:

{{{begin_main}}}
Main section stuff goes here.
{{{end_main}}}
{{{begin_aside}}}
Aside section stuff goes here.
{{{end_aside}}}

You have to run the src block with C-c C-c before exporting. I think there's an option to do this automatically, but I haven't set that up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0