emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Feature request: simplify usage of special blocks (for beamer)
Date: Sat, 1 Dec 2018 15:41:50 -0300	[thread overview]
Message-ID: <CAELgYhd3Gj5C2SMoYcW=v6j99NH2vnqxkOnctWpCNxtC1hNjBg@mail.gmail.com> (raw)
In-Reply-To: <87a7lpxfsc.fsf@gmail.com>

> > 1. Allow for special blocks to take an :options argument.
>
> Although I agree that this would be nice, I imagine the difficulty would be that it would be difficult to cater for multiple backends.

It's not really difficult, more on the trivial side. For example, as
an end user I already can install a filter like:

(defun my-special-block-parse-filter (tree backend symbol)
  (when (org-export-derived-backend-p backend 'latex)
    (org-element-map tree 'special-block
      (lambda (element)
        (save-excursion
          (goto-char (org-element-property :begin element))
          (when (looking-at "[ \t]*#\\+BEGIN_\\S-+[ \t]+\\(\\S-+\\)")
            (let ((options (format ":options [%s]"
(match-string-no-properties 1))))
              (org-element-put-property element :attr_latex (list
options)))))))))

And then write:

#+BEGIN_definition Special Block
A block mostly left uninterpreted by core org for the sake of backends
#+END_definition

This is as devoid of boilerplate as possible.

Notice the filter only applies to latex derived backends and won't
take effect if there is an #+ATTR_LATEX clause before the block (this
because it's considered part of the element the regexp won't match
it).

Obviously this can be implemented in a cleaner way by changing
org-latex-special-block in ox-latex.el. Again, the change would be
trivial.

> > 2. Mention the possibility of using special blocks to represent beamer
> > blocks, be it in the manual or in the tutorial.
>
> Given that beamer inherits everything that the LaTeX exporter supports, is the special blocks section in the LaTeX exporter documentation not already enough?

Not much users seem to be aware of the ablity of using special blocks
for beamer. No example, answer, tutorial out there even mentioned the
possibility. Given its convenience, I would say the beamer export
section should explicitly suggest the alternative.

Best regards
--
Carlos

  reply	other threads:[~2018-12-01 18:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 16:24 Feature request: simplify usage of special blocks (for beamer) Carlos Pita
2018-12-01 18:28 ` Eric S Fraga
2018-12-01 18:41   ` Carlos Pita [this message]
2018-12-01 19:23     ` Carlos Pita
2018-12-02 11:58       ` Eric S Fraga
2018-12-02 14:50         ` Carlos Pita
2018-12-02 15:30           ` Carlos Pita
2018-12-02 20:42       ` Nicolas Goaziou
2018-12-02 21:05         ` Carlos Pita
2018-12-02 11:55     ` Eric S Fraga

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAELgYhd3Gj5C2SMoYcW=v6j99NH2vnqxkOnctWpCNxtC1hNjBg@mail.gmail.com' \
    --to=carlosjosepita@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 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).