emacs-orgmode
[Top][All Lists]
Advanced

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

[tip] Export annotations with the 'Mindflow' LaTeX package


From: Juan Manuel Macías
Subject: [tip] Export annotations with the 'Mindflow' LaTeX package
Date: Mon, 10 May 2021 07:19:25 +0000

Hi all,

A new LaTeX package, mindflow, has recently been uploaded to CTAN
(https://www.ctan.org/pkg/mindflow), which I found interesting and
useful for my org workflow. With this package we can add annotations and
ideas to our document. I mean, all that is in a `mindflow'
environment (including entire sections) will appear as in a kind of
'draft mode', with different format and colour. There is a global option
that allows you to choose between showing or not showing those
annotations.

I think it can be useful (for example) to export custom Org drawers to
that environment. But it also occurred to me to write the following, to
export a entire tree as a `mindflow' environment, with the tag
`:annotation:'

#+begin_src emacs-lisp
  (defun my-org-add-mindflow-env-heading (backend)
    (when (eq backend 'latex)
      (org-show-all)
      (save-excursion
        (goto-char (point-min))
        (while (re-search-forward org-heading-regexp nil t)
          (let ((element (org-element-at-point)))
            (when (member "annotation" (org-element-property :tags element))
              (save-restriction
                (org-narrow-to-subtree)
                (save-excursion
                  (goto-char (point-min))
                  (insert "\n\n@@latex:\\begin{mindflow}@@\n\n")
                  (goto-char (point-max))
                  (insert "\n\n@@latex:\\end{mindflow}@@\n\n")))))))))

  (add-hook 'org-export-before-processing-hook 
#'my-org-add-mindflow-env-heading)
#+end_src

Here are some screenshots: https://imgur.com/a/jo320AI

Best regards,

Juan Manuel

https://juanmanuelmacias.com/



reply via email to

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