emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Custom latex environments using properties
@ 2011-08-29 22:52 suvayu ali
  2011-08-30  6:05 ` Jambunathan K
  0 siblings, 1 reply; 6+ messages in thread
From: suvayu ali @ 2011-08-29 22:52 UTC (permalink / raw)
  To: org-mode mailing list

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-30 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 22:52 Custom latex environments using properties suvayu ali
2011-08-30  6:05 ` Jambunathan K
2011-08-30  6:51   ` Sebastien Vauban
2011-08-30  7:21     ` Jambunathan K
     [not found]       ` <CAMXnza2jN0A3a=uWRetZykQ_OtwjyR47VYC_s6tCcePUb3YHOg@mail.gmail.com>
2011-08-30 17:20         ` Jambunathan K
2011-08-30 18:07           ` Suvayu Ali

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).