From: Bastien <bzg@gnu.org>
To: Joon Kwon <condor002@hotmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Nice theorem display ?
Date: Tue, 07 Aug 2012 23:38:22 +0200 [thread overview]
Message-ID: <87mx26fkmp.fsf@gnu.org> (raw)
In-Reply-To: <COL101-W63E08EF2869CD557926795E6CE0@phx.gbl> (Joon Kwon's message of "Tue, 7 Aug 2012 22:53:05 +0200")
Hi Joon,
Joon Kwon <condor002@hotmail.com> writes:
> I'm wondering if there is a simple way to make the buffer display
> theorem environements (for instance) in a nice way...
>
> For instance, if I have the following code :
> #+begin_theorem
> My theorem
> Bla bla bla
> #+end_theorem
>
> I would like the buffer to display something like :
>
> Theorem :
> | My theorem
> | Bla bla bla
> +----
(defun my-format-theorem-blocks ()
"Format theorem blocks in org."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "#\\+begin_theorem" nil t)
(let ((beg0 (match-beginning 0))
(beg (1+ (match-end 0)))
(end0 (save-excursion
(re-search-forward "#\\+end_theorem" nil t)))
(end (match-beginning 0))
content c)
(setq content (split-string (buffer-substring beg end) "\n" t))
(delete-region beg0 end0)
(insert "Theorem :\n")
(while (setq c (pop content))
(insert (format " | %s\n" c)))
(insert " +----\n")))))
M-x my-format-theorem-blocks RET
But this in a one-way only... no return.
HTH,
--
Bastien
next prev parent reply other threads:[~2012-08-07 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 20:53 Nice theorem display ? Joon Kwon
2012-08-07 21:38 ` Bastien [this message]
2012-08-07 22:03 ` Joon Kwon
2012-08-07 23:09 ` Bastien
2012-08-07 23:52 ` Thomas S. Dye
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=87mx26fkmp.fsf@gnu.org \
--to=bzg@gnu.org \
--cc=condor002@hotmail.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).