emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jeremiah Via <jxv911@cs.bham.ac.uk>
To: Dan Davison <davison@stats.ox.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: Mathematical Pseudocode in Source Block
Date: Thu, 12 Aug 2010 15:14:19 -0700	[thread overview]
Message-ID: <AANLkTim2TfsY9F56mLn6qxYJN4+aDan1avstahyHeDrw@mail.gmail.com> (raw)
In-Reply-To: <87sk2jsrsf.fsf@stats.ox.ac.uk>

This is exactly what I needed.

Thanks for all your help!

On Thu, Aug 12, 2010 at 9:46 AM, Dan Davison <davison@stats.ox.ac.uk> wrote:
> Jeremiah Via <jxv911@cs.bham.ac.uk> writes:
>
>> Hi there,
>>
>> I was wondering if there was any way to make the source blocks work
>> with LaTeX formulas. I wanted to use it for some pesudocode; for
>> example:
>>
>> while not converged
>>   for each state i
>>        \( U^{'}_i = r_i + \underset{a}{argmax} \sum{Pa_{ij}U_j} \)
>>        \( U_i \rightarrow U^{'}_i \)
>>   end for
>> end while
>>
>> If a source block isn't possible, is there at least a way to get a
>> textbox around it?
>
> Hi Jeremiah,
>
> Absolutely. Here are some quick notes
>
> - Org can recognise simple LaTeX constructs inline, without any special
>  markup
>
>  section 11.7 of the manual
>  http://orgmode.org/org.html#Embedded-LaTeX
>
> - The basic way to place more complex fragments of latex in an Org
>  document is in a #+begin_latex block
>
>  section 12.6 of the manual
>  http://orgmode.org/org.html#LaTeX-and-PDF-export
>
> - Personally I use the listings package to format pseudocode, e.g.
>
> #+begin_latex
> \begin{algorithm}
>  \caption{An algorithm}
>  \label{alg:myalg}
>  \begin{lstlisting}[mathescape,escapeinside='']
>    '\foreach individual $i$'
>        '\foreach group $k$'
>            $\gamma_{ik} \getsp Q_{k}\prod_{l}\prod_{a=1}^{2}P_{lkX_{ila}}$
>  \end{lstlisting}
> \end{algorithm}
> #+end_latex
>
> - Don't forget the nice Org functionality like C-c ' to view the latex
>  code in a latex-mode buffer (manual section 11.3), and C-c C-x C-l to view a png image of
>  the latex fragment (manual section 11.7.4).
>
> - The latex can also be included in HTML export. By default this uses
>  png images, but check out this thread for using MathJax and jsMath to
>  have javascript-mediated rendering of LaTeX formulas in HTML with
>  genuine fonts
>
> http://thread.gmane.org/gmane.emacs.orgmode/28259
>
> - You can use a #+latex_header line to specify additional latex
>  preamble lines. E.g. I defined the \foreach command in a file
>  emvbpl.sty and make sure that file is included with
>
> #+latex_header: \usepackage{emvbpl}
>
> - In addition, latex can be included inside begin_src latex blocks, to
>  achieve a variety of extra functionality, and also some of the same
>  functionality as above.
>
>  chapter 14
>  http://orgmode.org/org.html#Working-With-Source-Code
>
>
> Don't hesitate to come back to this list with further questions.
>
> Dan
>
>
>
>>
>> Thank you
>



-- 
Jeremiah M. Via
School of Computer Science
University of Birmingham

      reply	other threads:[~2010-08-12 22:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 19:47 Mathematical Pseudocode in Source Block Jeremiah Via
2010-08-12 16:30 ` Bastien
2010-08-12 16:46 ` Dan Davison
2010-08-12 22:14   ` Jeremiah Via [this message]

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=AANLkTim2TfsY9F56mLn6qxYJN4+aDan1avstahyHeDrw@mail.gmail.com \
    --to=jxv911@cs.bham.ac.uk \
    --cc=davison@stats.ox.ac.uk \
    --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).