From: Kaushal Modi <kaushal.modi@gmail.com>
To: "Berry, Charles" <ccberry@health.ucsd.edu>
Cc: "Juan Manuel Macías" <maciaschain@posteo.net>,
orgmode <emacs-orgmode@gnu.org>
Subject: Re: Way to mark contents of an Org special block as verbatim?
Date: Sat, 8 Jan 2022 23:03:42 -0500 [thread overview]
Message-ID: <CAFyQvY1P+7FijQUCUoXjw8HOHEPyyDnS-_E_BfjvhKgn8s_vKg@mail.gmail.com> (raw)
In-Reply-To: <561D83E2-47BF-4AC2-B2AD-24B08D614845@health.ucsd.edu>
On Sat, Jan 8, 2022 at 10:01 PM Berry, Charles <ccberry@health.ucsd.edu> wrote:
>
>
> A simple one here:
>
> #+begin_src emacs-lisp
> ;; minimal backend with latex parent
> (org-export-define-derived-backend 'newlatex 'latex
> :translate-alist
> '((special-block . org-newlatex-special-block)))
>
> ;; special block transcoder
> (defun org-newlatex-special-block (special-block contents info)
> "Newlatex special block transcoder."
> (let
> ((type (org-element-property :type special-block)))
> (if (equal type "newlatex")
> (format "{{<FOO>}}\n%s{{<//FOO>}}\n" contents)
I am already doing something like this, but at this point in the code,
the `contents' already is the modified content i.e. Org entities
replaced and _{..} converted to <sub>, etc.
Note that ox-hugo exporter is extended from ox-md, which is extended
from ox-html.
My problem statement is that the contents I am receiving is already
modified and I don't get to access the original/raw/verbatim content.
Thanking the original example in this thread:
#+begin_katex
E = -J \sum_{i=1}^N s_i s_{i+1}
#+end_katex
- \sum will have converted to ∑
- _{i=1} will have converted to <sub>i=1</sub> by the time I receive
the contents in ox-hugo's org-hugo-special-block.
[ May be I am doing something wrong in my exporter? ]
Or may be it's due to the fact that my eventual base exporter is ox-html?
> ;; not `newlatex` so default to latex transcoder
> (org-export-with-backend 'latex special-block contents info))))
> #+end_src
>
> Eval the above, then use this as an example by copying the following
> src block to an org buffer and entering
>
> M-; (org-export-to-buffer 'newlatex "*Org NEW LATEX Export*" nil nil nil t) RET
>
> #+begin_src org
>
> ,#+begin_newlatex
> This is the new content
> ,#+end_newlatex
>
>
> ,#+attr_latex: :caption \MyCaption{HeadingA}
> ,#+BEGIN_proof
> dot-dot-dot
> ,#+END_proof
>
> #+end_src
>
> I get an *Org NEW LATEX Export* buffer like this:
>
> #+begin_example
> {{<FOO>}}
> This is the new content
> {{<//FOO>}}
>
>
> \begin{proof}
> dot-dot-dot
> \MyCaption{HeadingA}
> \end{proof}
>
> #+end_example
next prev parent reply other threads:[~2022-01-09 4:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 17:00 Way to mark contents of an Org special block as verbatim? Kaushal Modi
2022-01-06 18:27 ` Juan Manuel Macías
2022-01-06 19:14 ` Kaushal Modi
2022-01-06 19:33 ` Juan Manuel Macías
2022-01-06 19:46 ` Kaushal Modi
2022-01-08 21:52 ` Berry, Charles
2022-01-08 23:29 ` Kaushal Modi
2022-01-09 3:01 ` Berry, Charles
2022-01-09 4:03 ` Kaushal Modi [this message]
2022-01-09 16:58 ` Kaushal Modi
2022-01-09 19:57 ` Berry, Charles
2022-01-09 20:01 ` Nicolas Goaziou
2022-01-09 21:53 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY1P+7FijQUCUoXjw8HOHEPyyDnS-_E_BfjvhKgn8s_vKg@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=ccberry@health.ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=maciaschain@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.