emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Custom latex environments using properties


From: suvayu ali
Subject: [O] Custom latex environments using properties
Date: Tue, 30 Aug 2011 00:52:05 +0200

Hi everyone,

I am trying to implement a way to wrap a custom latex environment
around a sub-tree where I specify the environment and its options as a
PROPERTY. I am expecting it to work as BEAMER_env or BEAMER_envargs
works for org-beamer export.

To give you an example:


* Bs decay (Bs->Dsh)
  Bs->DsK or Dsπ

** Decay model
   :PROPERTIES:
   :LATEX_env:      todonotes
   :LATEX_envargs:  green
   :END:

1. Justify neglecting CP violation
2. Verify master equations

** Detector effects
   :PROPERTIES:
   :LATEX_env:      todonotes
   :LATEX_envargs:  blue
   :END:

1. How is the Gaussian used for smearing of proper time resolution
   derived?
2. Why is the per event proper time error PDF needed? Why is smearing
   of time resolution not enough?


I am hoping to get blocks with colour codes (using the todonotes
package) based on the org properties. I tried using the preprocess hook
to convert the org source to latex using the defined properties but the
conversion to latex escapes everything and the process to pdf part
breaks. I used the following code to modify the preprocess hook.

#+begin_src emacs-lisp
  (defun my-org-export-latex-wrap-env ()
    "Wrap heading with arbitrary latex environment."
    (interactive)
    (setq env (org-entry-get (point) "LATEX_env"))
    (setq envargs (org-entry-get (point) "LATEX_envargs"))
    (let ((heading (org-get-heading t))
          (text (org-get-entry)))
      (org-mark-subtree)
      (delete-region (region-beginning) (region-end))
      (insert (concat env "[inline, color=" envargs "]{%\n"
                      "\\textbf{" heading "}\\protect\\linebreak{}%\n"
                      text "\n}%\n"))))

  ;; the following snippet is from my hook
  (dolist (match spltags)
    (org-map-entries (lambda () (my-org-export-latex-wrap-env))
                     match))
#+end_src

Any one has ideas about what else I can try?

-- 
Suvayu

Open source is the future. It sets us free.



reply via email to

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