* Nice theorem display ?
@ 2012-08-07 20:53 Joon Kwon
2012-08-07 21:38 ` Bastien
2012-08-07 23:52 ` Thomas S. Dye
0 siblings, 2 replies; 5+ messages in thread
From: Joon Kwon @ 2012-08-07 20:53 UTC (permalink / raw)
To: emacs-orgmode
Hi,
I'm a new orgmode user and I am really enjoying it, especially for writing LaTeX documents.
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
+----
I guess this must not be difficult for elisp programmers ...
Joon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Nice theorem display ?
2012-08-07 20:53 Nice theorem display ? Joon Kwon
@ 2012-08-07 21:38 ` Bastien
2012-08-07 22:03 ` Joon Kwon
2012-08-07 23:52 ` Thomas S. Dye
1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2012-08-07 21:38 UTC (permalink / raw)
To: Joon Kwon; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Nice theorem display ?
2012-08-07 21:38 ` Bastien
@ 2012-08-07 22:03 ` Joon Kwon
2012-08-07 23:09 ` Bastien
0 siblings, 1 reply; 5+ messages in thread
From: Joon Kwon @ 2012-08-07 22:03 UTC (permalink / raw)
To: emacs-orgmode
Bastien <bzg <at> gnu.org> writes:
> But this in a one-way only... no return.
>
> HTH,
>
Hi Bastien,
Thank you for answering !
But what I want is to keep the real file as it is, in order to export it to
LaTeX later.
I just want the buffer to display it differently...
Do you know how to do that ?
Joon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Nice theorem display ?
2012-08-07 22:03 ` Joon Kwon
@ 2012-08-07 23:09 ` Bastien
0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-08-07 23:09 UTC (permalink / raw)
To: Joon Kwon; +Cc: emacs-orgmode
Hi Joon,
Joon Kwon <condor002@hotmail.com> writes:
> But what I want is to keep the real file as it is, in order to export it to
> LaTeX later.
> I just want the buffer to display it differently...
> Do you know how to do that ?
Yes, I know how to do that but I'm not sure this will be useful to
someone else, so I won't spend time on this. Sorry!
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Nice theorem display ?
2012-08-07 20:53 Nice theorem display ? Joon Kwon
2012-08-07 21:38 ` Bastien
@ 2012-08-07 23:52 ` Thomas S. Dye
1 sibling, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2012-08-07 23:52 UTC (permalink / raw)
To: Joon Kwon; +Cc: emacs-orgmode
Joon Kwon <condor002@hotmail.com> writes:
> Hi,
>
> I'm a new orgmode user and I am really enjoying it, especially for
> writing LaTeX documents.
>
> 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
> +----
>
> I guess this must not be difficult for elisp programmers ...
>
> Joon
>
>
Aloha Joon,
Welcome to Org mode.
The #+begin_theorem ... #+end_theorem pair doesn't appear in the Org
mode manual. Presumably, you are using org-special-blocks to generate
\begin{theorem} ... \end{theorem} environments in LaTeX? IIUC, then
this means you have declared \newtheorem{theorem}{LabelText} somewhere,
so that a structure like \begin{theorem} ... \end{theorem} will actually
be compiled by LaTeX? This is almost certainly an unusual use case and
it is not likely that it is one that could be anticipated by the Org
mode software.
A more typical use case is something like this:
#+BEGIN_LaTeX
\begin{equation}
\alpha \dots \omega
\end{equation}
#+END_LaTeX
Org mode recognizes this as a LaTeX fragment. With point inside the
fragment, pressing C-c C-x C-l will generate a preview and display it in
your Org mode buffer. The operation can be reversed with C-c C-c.
I'm glad to hear you enjoy writing LaTeX documents in Org mode. This is
something I enjoy, too. Org mode will soon become a much more powerful
environment for authoring LaTeX (and other) documents, when Nicolas
Goaziou's "new exporter" moves fully into the Org mode core.
hth,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-07 23:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07 20:53 Nice theorem display ? Joon Kwon
2012-08-07 21:38 ` Bastien
2012-08-07 22:03 ` Joon Kwon
2012-08-07 23:09 ` Bastien
2012-08-07 23:52 ` Thomas S. Dye
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).