emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Stanton <stanton@haas.berkeley.edu>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Cc: "nicholas.dokos@hp.com" <nicholas.dokos@hp.com>,
	"eric.schulte@gmx.com" <eric.schulte@gmx.com>
Subject: Re: Question on latex source block
Date: Mon, 10 Sep 2012 09:49:57 -0700	[thread overview]
Message-ID: <CC736692.24529%stanton@haas.berkeley.edu> (raw)
In-Reply-To: <mailman.113.1347292828.2054.emacs-orgmode@gnu.org>

>Date: Sun, 09 Sep 2012 13:39:32 -0600
>From: Eric Schulte <eric.schulte@gmx.com>
>To: nicholas.dokos@hp.com
>Cc: Richard Stanton <stanton@haas.berkeley.edu>,
>	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
>Subject: Re: [O] Question on latex source block
>Message-ID: <87ligj6l57.fsf@gmx.com>
>Content-Type: text/plain
>
>Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> Eric Schulte <eric.schulte@gmx.com> wrote:
>>
>>> >
>>> > Nothing - it's a bug introduced by commit
>>>a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b:
>>> >
>>> > ,----
>>> > | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b
>>> > | Author: Feng Shu <tumashu@gmail.com>
>>> > | Date:   Fri Apr 20 19:21:43 2012 +0200
>>> > | 
>>> > |     Allow to use imagemagick for previewing LaTeX fragements.
>>> > |     
>>> > |     * org.el (org-latex-create-formula-image-program): New option
>>> > |     to use either dvipng or imagemagick to convert and preview
>>> > |     LaTeX fragments.
>>> > |     (org-preview-latex-fragment, org-format-latex): Handle the new
>>> > |     option.
>>> > |     (org-create-formula-image-with-dvipng): Rename from
>>> > |     `org-create-formula-image'.
>>> > |     (org-create-formula-image-with-imagemagick): New defun to
>>> > |     handle LaTeX preview with imagemagick.
>>> > |     (org-latex-color, org-latex-color-format): New defuns to
>>> > |     handle color conversions.
>>> > |     
>>> > |     * org-latex.el (org-latex-to-pdf-process, org-export-as-pdf):
>>> > |     Allow to use imagemagick to convert LaTeX fragments.
>>> > |     
>>> > |     * org-html.el (org-export-html-preprocess): Ditto.
>>> > |     
>>> > |     * org-exp.el (org-export-with-LaTeX-fragments): Ditto.
>>> > |     
>>> > |     * org.texi (@LaTeX{} fragments): Document imagemagick as an
>>> > |     alternative to dvipng.
>>> > | 
>>> > `----
>>> >
>>> > org-create-formula-image got renamed, but the reference in
>>>ob-latex.el
>>> > to the original name was not changed.
>>> >
>>> > The quick-and-dirty "fix" is to change the reference in ob-latex.el
>>>to
>>> > org-create-formula-image-dvipng or
>>>org-create-formula-image-imagemagick,
>>> > depending on which method you happen to be using. But one would
>>>resort
>>> > to that only in the direst emergency in order to get something
>>>working
>>> > as quickly as possible.
>>> >
>>> > IMO, it would be better to have split the dvipng/imagemagick
>>>decision at
>>> > a lower level in the code. That way, both org-format-latex and
>>> > org-babel-execute:latex would use the common function. As it is,
>>> > org-format-latex is a fairly "dirty" function and with the split, it
>>>got
>>> > even dirtier.
>>> >
>>> > But there may be difficulties that my quick glance through the code
>>>has
>>> > not uncovered: it needs a deeper look.
>>> >
>>> 
>>> So, what would you recommend as a full fix in ob-latex.el?  The
>>>attached
>>> commit selects an alternate function based on the value of the
>>> `org-latex-create-formula-image-program' variable.  Does this seem like
>>> an appropriate fix to the problem?
>>> 
>>
>> For the time being, yes: I think this fix is entirely appropriate (nb:
>> haven't tested it yet though).
>>
>> In the longer run, I would like to see a single function
>> (org-create-formula-image redux) be called from the two call sites
>> (org-format-latex and org-babel-execute:latex) and have the
>> dvipng/imagemagick/etc split be entirely within that function. It's
>> bound to happen that more methods of creating images (the etc part
>> above) will need to be added in the future and it behooves one to
>> arrange it so that only one place in the code is affected.
>>
>> Thanks,
>> Nick
>>
>
>Alright,
>
>I've just committed a patch which gets part-way to your suggest
>solution.  While the two backend-specific functions are still separate
>(I agree they should be combined), I have brought back the
>`org-create-formula-image' function, which now dispatches to the backend
>specific functions.
>
>Additionally there are some problems in the `org-format-latex' function.
>It lists mandatory arguments as optional, and appears to create
>variables which are not required or properly set.
>
>These function should probably be cleaned at some point up by whoever is
>maintaining Org-mode's LaTeX interfaces.
>
>Cheers,
>
>-- 
>Eric Schulte
>http://cs.unm.edu/~eschulte


Thanks. Things now get a lot further, but I'm still not quite getting what
I was hoping for. In particular, this source:

#+begin_src latex :file test.png
\frac{1}{2}
#+end_src

results in this output:

#+Results:
#+BEGIN_LaTeX
[[file:test.png]]
#+END_LaTeX

There are two problems here.


1) I'd like the graphic file to be displayed inline in the org file
buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX lines

2) There is no file test.png in the current working directory.

It may well be that I'm missing something, but I can't quite see what...

Thanks.

Richard Stanton

       reply	other threads:[~2012-09-10 16:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.113.1347292828.2054.emacs-orgmode@gnu.org>
2012-09-10 16:49 ` Richard Stanton [this message]
2012-09-10 19:07   ` Question on latex source block Nick Dokos
2012-09-10 20:43     ` Richard Stanton
2012-09-10 20:53       ` Nick Dokos
2012-09-11  6:52         ` Giovanni Ridolfi
2012-09-09  5:15 Richard Stanton
2012-09-09  7:07 ` Nick Dokos
2012-09-09  7:17   ` Nick Dokos
2012-09-09 16:49   ` Eric Schulte
2012-09-09 17:44     ` Nick Dokos
2012-09-09 19:39       ` Eric Schulte
2012-09-09 20:31         ` Nick Dokos
2012-09-13  6:00         ` Jambunathan K
2012-09-13  7:28           ` Nick Dokos
2012-09-13  7:58             ` Nick Dokos
2012-09-13 15:07           ` Eric Schulte
2012-09-13 16:04             ` Nick Dokos
2012-09-13 17:09               ` Eric Schulte
2012-09-13 19:12                 ` Abdó Roig-Maranges
2012-09-13 19:42                   ` Jambunathan K
2012-09-14  7:27                     ` Bastien

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=CC736692.24529%stanton@haas.berkeley.edu \
    --to=stanton@haas.berkeley.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.com \
    --cc=nicholas.dokos@hp.com \
    /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).