emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Best way to include METAPOST in ConTeXt exporter


From: Ihor Radchenko
Subject: Re: Best way to include METAPOST in ConTeXt exporter
Date: Mon, 04 Oct 2021 16:41:08 +0800

Jason Ross <jasonross1024@gmail.com> writes:

> Hello,
>
> I'd like to include METAPOST figures in the ConTeXt exporter backend I'm
> developing. However, I don't know of an idiomatic way to add captions and
> references for the figures.

You can use affiliated keywords:

(defconst org-element-affiliated-keywords
  '("CAPTION" "DATA" "HEADER" "HEADERS" "LABEL" "NAME" "PLOT" "RESNAME" "RESULT"
    "RESULTS" "SOURCE" "SRCNAME" "TBLNAME")
  "List of affiliated keywords as strings.
By default, all keywords setting attributes (e.g., \"ATTR_LATEX\")
are affiliated keywords and need not to be in this list.")

> Currently, I export METAPOST with `#+BEGIN_EXPORT metapost` / `#+END_EXPORT`
> tags. However, this feature seems to be intended for completely "raw"
> outputs
> with no markup or tagging in the resulting export. I'm interested in
> supporting
> at least `#+NAME` and `#+CAPTION` keywords for METAPOST figures so that they
> can be referred to in the Org file and also in the exported pdf.



> What are some better ways of doing something like this? Source blocks? How
> would
> a user expect to use a feature like this?


You can use a special block:
#+caption: Sample caption
#+attr_context: :field value
#+begin_metapost
...
#+end_metapost

The parsed representation of this element in exporter will be something like:

(special-block (:type "metapost" :begin 292 :end 382 :contents-begin 364 
:contents-end 368 :post-blank 0 :post-affiliated 347 :caption (((#("Sample 
caption" 0 14 (:parent #4))))) :attr_context (":field value")))


Best,
Ihor



reply via email to

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