Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-30 Thread Aaron Ecay
Hi Malcom,

2013ko urriak 28an, Cook, Malcolm-ek idatzi zuen:
 

[...]

 Excellent!  Adding to the top of my emacs .org file the following allowed it 
 to work.  
 
 #+LATEX_HEADER: \graphicspath{{fig/}}
 
 Much better workaround.  But still a workaround?

The support for including graphics from other directories in latex
documents doesn’t strike me as robust, and I think the \graphicspath
specification is often needed in such cases.  (Though I’m far from an
expert).  So I think it is indeed a workaround, but of the usual LaTeX
sort.

-- 
Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-29 Thread Cook, Malcolm
Hi Aaron,

 Can I re-open this thread to discuss two new issues I now experience with 
 emacs 24.3.1 and orgmode version 8.2.1 in the handling of
 svg = tex = pdf ?
 
  Here goes:
 
  1) If the plot has text in it which contains a percent character (%),
  then we fail due to https://bugs.launchpad.net/inkscape/+bug/857231
 
 It sounds from
 https://bugs.launchpad.net/inkscape/+bug/719320/comments/3 as though
 inkscape makes a deliberate effort to support LaTeX markup in their
 pdf+latex output.  So it’s not surprising that % is a problem.
 
It’s unfortunate from the perspective of having a single SVG file that
 works in both HTML and LaTeX, but I don’t know if that is an argument
 that will cut ice with them.  I don’t know what org can/should do to
 patch around inkscape’s design decisions.

Indeed!  So, I made a suggestion to 'fix' (?) Inkscape here:

https://bugs.launchpad.net/inkscape/+bug/719320

Let's see if I get any traction on that!


 Certainly the svg LaTeX package could be patched to use inkscape’s pdf
 export, instead of the pdf+latex one.  This would lose the nice fonts
 that running the text through latex nets you, but get rid of the %
 annoyances.
 
 
  2) If the :file is in a sub-directory  (for example, `:file
  fig/mtcars.svg`), even though both ./fig/mtcars.pdf_tex  and
  ./fig/mtcars.pdf are created, the reference to the .pdf in the
  .pdf_tex  is not interpreted relative to the subdirectory, but rather
  to the parent, and so the .pdf is not found.
 
 Have you looked at the \graphicspath macro from the graphics package?
 http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graphicspath.  You may
 be able to get things to work by adding \graphicspath{{fig/}} (note the
 double braces) to your document.  \setsvg{svgpath=fig/} from the svg
 package may also/additionally be needed.
 

Excellent!  Adding to the top of my emacs .org file the following allowed it to 
work.  

#+LATEX_HEADER: \graphicspath{{fig/}}

Much better workaround.  But still a workaround?

~ Malcolm


 Aaron
 
 PS Maybe org should be generating the \includesvg command relative to
 the graphicspath or svgpath – I’m not sure.  But let us know if setting
 those variables works at all, and if so we can think about adding
 support to org.
 
 --
 Aaron Ecay


Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-28 Thread Cook, Malcolm
Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,

Hi again!

Can I re-open this thread to discuss two new issues I now experience with emacs 
24.3.1 and orgmode version 8.2.1 in the handling of svg = tex = pdf ?

Here goes:

1) If the plot has text in it which contains a percent character (%), then we 
fail due to https://bugs.launchpad.net/inkscape/+bug/857231

2) If the :file is in a sub-directory  (for example, `:file fig/mtcars.svg`), 
even though both ./fig/mtcars.pdf_tex  and ./fig/mtcars.pdf are created, the 
reference to the .pdf in the .pdf_tex  is not interpreted relative to the 
subdirectory, but rather to the parent, and so the .pdf is not found.

The workaround for (1) is to not use '%' as a label on my plots.

The workaround for (2) is to not put my figures in a './fig/' subdirectory.

I suppose the fix for (1) is to get the inkscape export 'fixed' to (optionally) 
escape the labels, and to take the option.  Thoughts?

I suppose the fix for (2) is somewhere in the org code.  Any takers?

Or, any other fixes suggested?

Thanks!

Malcolm



 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Cook, Malcolm
 Sent: Friday, August 09, 2013 4:01 PM
 To: 'Malcolm Cook'; 'emacs-orgmode@gnu.org'; 'Nick Dokos'; 'Suvayu Ali'; 
 'Eric Schulte'; 'Vincent Beffara'; 'Thomas S. Dye';
 'phil...@cern.ch'; 'Charles Berry'; 'Aaron Ecay'
 Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
 pdf?
 
 Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,
 
 Thanks for all your help.
 
 I am now satisfied with approach for exporting images to inline html and 
 inline latex=pdf.
 
 In my hands, the following code block will produce in-line images in html and 
 be included in exported pdf.
 
 #+LATEX_HEADER: \usepackage{svg}
 #+begin_src R :results  graphics output :exports both :file mtcars.svg
 with(mtcars,plot(wt, mpg))
 #+end_src
 
 I am using:
   Emacs 24.3.1
   Suvayus orgmode export filter:
 
 (defun my-svg-graphics (contents backend info)
   (when (eq backend 'latex)
   (replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\)
includesvg\1 contents))
 )
 (add-to-list 'org-export-filter-link-functions 'my-svg-graphics)
 
 * svg latex package v1.0 2004/11/05
 
  * customize the emacs variable `org-latex-pdf-process` to include
 '--shell-escape' (following advice in
 http://orgmode.org/worg/org-dependencies.html, which outlines some
 other options)
 
 * customize org-export-html-inline-image-extensions to include  svg
 
  * upgrade to inkscape version 0.48.+ (which is more recent than our
 centOS repos proffered, but, hey) since the --export-latex switch that
 svg.sty depends upon is not implemented till this version
 
 * upgrade org-mode version 8.0.7-377 built from git pull yesterday
 
 I think I've covered all the pieces.
 
 I have not explored how/whether any options passed to includegraphics are 
 interpreted by includesvg.
 
 Now, if I could get .svg images to display inline in my emacs buffer.  The 
 following is not respected, at least in my hands.
   '(org-export-latex-inline-image-extensions (quote (pdf jpeg jpg 
  png ps eps svg)))
 Any takers?
 
 
 ~ Malcolm
 
 
 
  -Original Message-
  From: emacs-orgmode-bounces+mec=stowers@gnu.org 
  [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
  Behalf Of Malcolm Cook
  Sent: Thursday, August 08, 2013 9:05 PM
  To: Malcolm Cook; emacs-orgmode@gnu.org; Nick Dokos
  Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
  pdf?
  
  Aaron,
  
  Thanks for staying with me on this.
  
  I'm not sure what you're suggesting.
  
  Nonetheless, I just updated org from `git clone 
  git://orgmode.org/org-mode.git`
  
  So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.
  
  Are you suggesting that  with this patch.svg created with exporting
  graphics :file should now display in the emacs buffer when I toggle
  display of inline images?  I wish they would.  They do not, despite my
  adding svg to org-export-latex-inline-image-extensions.
  
  Are you suggesting that such a .svg created by org code block would be
  appear in the pdf created when I export to latex - pdf?  I wish that
  also... that's what I've been trying to accomplish.
  
  Thanks!,
  
  
  Malcolm
  
  
  PS - I see you are/were in PA in linguistics.   My first job after my
  masters in AI from U Mass was at CMU's psych dept as a lisp programmer
  for John Anderson's intelligent tutoring systems.  I then went on in
  computational linguistics a bit, working on a marcus parser based
  natural language processing system at wang labs.  Ages ago.  Now I'm
  in computational biology.  The one commonality through it all?  Emacs!
  --
  Malcolm Cook
  h - 913.642.5257
  c - 913.226.1542
  w - 816.926.4449
  
  
  On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote:
   Hi 

Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-28 Thread Aaron Ecay
Hi Malcom,

2013ko urriak 28an, Cook, Malcolm-ek idatzi zuen:
 
 Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,
 
 Hi again!
 
 Can I re-open this thread to discuss two new issues I now experience with 
 emacs 24.3.1 and orgmode version 8.2.1 in the handling of svg = tex = pdf ?
 
 Here goes:
 
 1) If the plot has text in it which contains a percent character (%),
 then we fail due to https://bugs.launchpad.net/inkscape/+bug/857231

It sounds from
https://bugs.launchpad.net/inkscape/+bug/719320/comments/3 as though
inkscape makes a deliberate effort to support LaTeX markup in their
pdf+latex output.  So it’s not surprising that % is a problem.

It’s unfortunate from the perspective of having a single SVG file that
works in both HTML and LaTeX, but I don’t know if that is an argument
that will cut ice with them.  I don’t know what org can/should do to
patch around inkscape’s design decisions.

Certainly the svg LaTeX package could be patched to use inkscape’s pdf
export, instead of the pdf+latex one.  This would lose the nice fonts
that running the text through latex nets you, but get rid of the %
annoyances.

 
 2) If the :file is in a sub-directory  (for example, `:file
 fig/mtcars.svg`), even though both ./fig/mtcars.pdf_tex  and
 ./fig/mtcars.pdf are created, the reference to the .pdf in the
 .pdf_tex  is not interpreted relative to the subdirectory, but rather
 to the parent, and so the .pdf is not found.

Have you looked at the \graphicspath macro from the graphics package?
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graphicspath.  You may
be able to get things to work by adding \graphicspath{{fig/}} (note the
double braces) to your document.  \setsvg{svgpath=fig/} from the svg
package may also/additionally be needed.

Aaron

PS Maybe org should be generating the \includesvg command relative to
the graphicspath or svgpath – I’m not sure.  But let us know if setting
those variables works at all, and if so we can think about adding
support to org.

-- 
Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-10 Thread Cook, Malcolm
Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,

Thanks for all your help.

I am now satisfied with approach for exporting images to inline html and inline 
latex=pdf.

In my hands, the following code block will produce in-line images in html and 
be included in exported pdf.

#+LATEX_HEADER: \usepackage{svg}
#+begin_src R :results  graphics output :exports both :file mtcars.svg
with(mtcars,plot(wt, mpg))
#+end_src 

I am using:
Emacs 24.3.1
Suvayus orgmode export filter:

(defun my-svg-graphics (contents backend info)
  (when (eq backend 'latex)
  (replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\)
   includesvg\1 contents))
)
(add-to-list 'org-export-filter-link-functions 'my-svg-graphics)

* svg latex package v1.0 2004/11/05

 * customize the emacs variable `org-latex-pdf-process` to include
'--shell-escape' (following advice in
http://orgmode.org/worg/org-dependencies.html, which outlines some
other options)

* customize org-export-html-inline-image-extensions to include  svg 

 * upgrade to inkscape version 0.48.+ (which is more recent than our
centOS repos proffered, but, hey) since the --export-latex switch that
svg.sty depends upon is not implemented till this version

* upgrade org-mode version 8.0.7-377 built from git pull yesterday

I think I've covered all the pieces.

I have not explored how/whether any options passed to includegraphics are 
interpreted by includesvg.

Now, if I could get .svg images to display inline in my emacs buffer.  The 
following is not respected, at least in my hands.  
'(org-export-latex-inline-image-extensions (quote (pdf jpeg jpg 
png ps eps svg)))
Any takers?


~ Malcolm



 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Malcolm Cook
 Sent: Thursday, August 08, 2013 9:05 PM
 To: Malcolm Cook; emacs-orgmode@gnu.org; Nick Dokos
 Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
 pdf?
 
 Aaron,
 
 Thanks for staying with me on this.
 
 I'm not sure what you're suggesting.
 
 Nonetheless, I just updated org from `git clone 
 git://orgmode.org/org-mode.git`
 
 So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.
 
 Are you suggesting that  with this patch.svg created with exporting
 graphics :file should now display in the emacs buffer when I toggle
 display of inline images?  I wish they would.  They do not, despite my
 adding svg to org-export-latex-inline-image-extensions.
 
 Are you suggesting that such a .svg created by org code block would be
 appear in the pdf created when I export to latex - pdf?  I wish that
 also... that's what I've been trying to accomplish.
 
 Thanks!,
 
 
 Malcolm
 
 
 PS - I see you are/were in PA in linguistics.   My first job after my
 masters in AI from U Mass was at CMU's psych dept as a lisp programmer
 for John Anderson's intelligent tutoring systems.  I then went on in
 computational linguistics a bit, working on a marcus parser based
 natural language processing system at wang labs.  Ages ago.  Now I'm
 in computational biology.  The one commonality through it all?  Emacs!
 --
 Malcolm Cook
 h - 913.642.5257
 c - 913.226.1542
 w - 816.926.4449
 
 
 On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote:
  Hi Malcom,
 
  There is a patch that was added to the master branch of the org git
  repository on Jul 27, which turns this from a link into a real inclusion
  of the image.  So, it will only work as intended if you are using a git
  checkout from after that date.
 
  My apologies, I should have made this more prominent in my earlier
  mails.
 
  --
  Aaron Ecay




Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-09 Thread Aaron Ecay
Hi Malcom,

On Thu, Aug 8, 2013 at 10:04 PM, Malcolm Cook malcolm.c...@gmail.com wrote:
 Aaron,

 Thanks for staying with me on this.

 I'm not sure what you're suggesting.

 Nonetheless, I just updated org from `git clone 
 git://orgmode.org/org-mode.git`

 So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.

 Are you suggesting that  with this patch.svg created with exporting
 graphics :file should now display in the emacs buffer when I toggle
 display of inline images?  I wish they would.  They do not, despite my
 adding svg to org-export-latex-inline-image-extensions.

This I believe relies on your emacs binary having support for svg
images.  You can check if emacs is linked against librsvg with the
following shell command (assuming you are on linux):
$ ldd `which emacs` | grep svg

Which should give you some line of output like
librsvg-2.so.2 = /usr/lib/librsvg-2.so.2 (0xb6a86000)

Within emacs, M-: (image-type-available-p 'svg) RET should display t

In buffer viewing of svg works for me without any additional setup,
upon pressing C-c C-x C-v, in an emacs with svg support.


 Are you suggesting that such a .svg created by org code block would be
 appear in the pdf created when I export to latex - pdf?  I wish that
 also... that's what I've been trying to accomplish.

Yes.  I'm attaching the testsvg.org file (slightly modified from the
one you sent) and resultant latex export I get from the same git
version as you...as you can see, the [[file:mtcars.svg]] link is
translated into an \includesvg LaTeX command.  Does it work the same
for you?


 PS - I see you are/were in PA in linguistics.   My first job after my
 masters in AI from U Mass was at CMU's psych dept as a lisp programmer
 for John Anderson's intelligent tutoring systems.  I then went on in
 computational linguistics a bit, working on a marcus parser based
 natural language processing system at wang labs.  Ages ago.  Now I'm
 in computational biology.  The one commonality through it all?  Emacs!

:)  I'm in the doctoral program in linguistics at Penn, and a happy
emacs user for several years.  Here's to many more!


testsvg.org
Description: Binary data


testsvg.tex
Description: TeX document


Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Malcolm Cook
Aaron  Nick,

Thanks for the help.  I think I'm almost there.

So far I did

 * install a latex package (first time for everything).  I wound up
just putting svg.sty file it for now in the same directory as the .org
file since my attempts to date failed using $HOME/texfm
 * customize the emacs variable `org-latex-pdf-process` to include
'--shell-escape' (following advice in
http://orgmode.org/worg/org-dependencies.html, which outlines some
other options)
 * upgrade to inkscape version 0.48.+ (which is more recent than our
centOS repos proffered, but, hey) since the --export-latex switch that
svg.sty depends upon is not implemented till this version

When I export to latex as PDF file, I get error PDF file ./test.pdf
wasn't produced

Sleuthing, I see the output .tex file includes the following lines:

\usepackage{svg}
...
\includegraphics[width=.9\linewidth]{mtcars.png}
@@backend:\includesvg{mtcars}

However, when they get processed, and the includesvg seeks the pdf_tex
file, I get this error:

! LaTeX Error: File `mtcars.pdf_tex' not found.
Type X to quit or RETURN to proceed,
or enter new name. (Default extension: pdf_tex)
Enter file name:
! Emergency stop.
read *
l.354 \includesvg{mtcars}

If you have any suggestions to me for further sleuthing I would be much obliged.

Thanks,

Malcolm Cook


On Sat, Jul 27, 2013 at 1:36 AM, Aaron Ecay aarone...@gmail.com wrote:

 Hi Malcom,

 2013ko uztailak 17an, malcolm cook-ek idatzi zuen:
 
  Hi,
 
  I am creating .svg files with R source blocks and ESS in org.
 
  I am happily viewing them in-line in my emacs buffer.
 
  I am happily exporting as html and viewing them in-line in the resulting web
  page, including a table of images.
 
  I do not have an approach for including them into PDF when I export-tex-pdf.
 
  I'm thinking there might be an approach to converting them on-the-fly to png
  (or something) during the export-tex-pdf.
 
  A similar problem was addressed with custom macros here:
  http://thread.gmane.org/gmane.emacs.orgmode/56532/focus=58322
 
  But it does not work with  R source blocks that produce .svg files.
 
  Any suggestions for me?  Is this a lost cause?  Am I asking for too many
  assumptions to be made by such an auto-conversion process that it is doomed
  to fail anyway?

 I have been using a variant of this workflow with some success.  Using a
 patch I just pushed to the master branch, you should be able to
 successfully export SVG image files to LaTeX documents, using the “svg”
 LaTeX package: http://www.ctan.org/pkg/svg

 No configuration should be needed on the org side.

 The svg LaTeX package is a bit fussy.  It only works under pdfTeX (it
 can be patched to work with LuaTeX, but cannot work with XeTeX at all).
 It also requires you to have the inkscape command line program
 installed.  But within those constraints it works very nicely.

 You may need to arrange for whatever compilation process you use for
 LaTeX files to pass the “-shell-escape” command line option to pdftex.
 This allows TeX code to execute command line programs, which is needed
 to communicate with inkscape and convert the SVG into something LaTeX
 can use.

 I think in the long run it would be nice if Org could help you translate
 the image types in your document into image types an exporter
 understands (basically an expanded and generalized version of what is
 already done with LaTeX snippets for non-LaTeX export).  But that is
 a bigger project, I think.

 --
 Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Nick Dokos
Malcolm Cook malcolm.c...@gmail.com writes:


 When I export to latex as PDF file, I get error PDF file ./test.pdf
 wasn't produced


In case of difficulties like this, I produce the tex file (C-c C-e l l)
and then I process it by hand:

 pdflatex --shell-escape foo.tex

Separates concerns nicely.

 Sleuthing, I see the output .tex file includes the following lines:

 \usepackage{svg}
 ...
 \includegraphics[width=.9\linewidth]{mtcars.png}
 @@backend:\includesvg{mtcars}


This looks wrong. You probably want @@latex:\includesvg{mtcars}@@ in
your org file. In any case, the output in the tex file should be just

  \includesvg{mtcars}

Also, not sure how the \includegraphics is produced (are you evaluating a
source block?) but it should probably not be there, otherwise you are
going to get two images in your PDF.

-- 
Nick




Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Aaron Ecay
Hi Malcom,

2013ko abuztuak 8an, Malcolm Cook-ek idatzi zuen:
 
 Aaron  Nick,
 
 Thanks for the help.  I think I'm almost there.
 
 So far I did
 
  * install a latex package (first time for everything).  I wound up
 just putting svg.sty file it for now in the same directory as the .org
 file since my attempts to date failed using $HOME/texfm
  * customize the emacs variable `org-latex-pdf-process` to include
 '--shell-escape' (following advice in
 http://orgmode.org/worg/org-dependencies.html, which outlines some
 other options)
  * upgrade to inkscape version 0.48.+ (which is more recent than our
 centOS repos proffered, but, hey) since the --export-latex switch that
 svg.sty depends upon is not implemented till this version
 
 When I export to latex as PDF file, I get error PDF file ./test.pdf
 wasn't produced
 
 Sleuthing, I see the output .tex file includes the following lines:
 
 \usepackage{svg}
 ...
 \includegraphics[width=.9\linewidth]{mtcars.png}
 @@backend:\includesvg{mtcars}
  ^

This looks like (malformed?) org markup that has “escaped” into the
exported .tex file.  Are you still using some of the custom macros from
other threads?  Can you send a minimal example of the file that you are
trying to export, and the resulting exported .tex file?  The .log file
produced by LaTeX when compiling the .tex file may be helpful as well.

Thanks,

-- 
Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Malcolm Cook
Aaron, thanks so much, I've attached all three
--
Malcolm Cook
h - 913.642.5257
c - 913.226.1542
w - 816.926.4449


On Thu, Aug 8, 2013 at 2:36 PM, Aaron Ecay aarone...@gmail.com wrote:
 Hi Malcom,

 2013ko abuztuak 8an, Malcolm Cook-ek idatzi zuen:

 Aaron  Nick,

 Thanks for the help.  I think I'm almost there.

 So far I did

  * install a latex package (first time for everything).  I wound up
 just putting svg.sty file it for now in the same directory as the .org
 file since my attempts to date failed using $HOME/texfm
  * customize the emacs variable `org-latex-pdf-process` to include
 '--shell-escape' (following advice in
 http://orgmode.org/worg/org-dependencies.html, which outlines some
 other options)
  * upgrade to inkscape version 0.48.+ (which is more recent than our
 centOS repos proffered, but, hey) since the --export-latex switch that
 svg.sty depends upon is not implemented till this version

 When I export to latex as PDF file, I get error PDF file ./test.pdf
 wasn't produced

 Sleuthing, I see the output .tex file includes the following lines:

 \usepackage{svg}
 ...
 \includegraphics[width=.9\linewidth]{mtcars.png}
 @@backend:\includesvg{mtcars}
   ^

 This looks like (malformed?) org markup that has “escaped” into the
 exported .tex file.  Are you still using some of the custom macros from
 other threads?  Can you send a minimal example of the file that you are
 trying to export, and the resulting exported .tex file?  The .log file
 produced by LaTeX when compiling the .tex file may be helpful as well.

 Thanks,

 --
 Aaron Ecay


testsvg.log
Description: Binary data


testsvg.tex
Description: TeX document


testsvg.org
Description: Binary data


Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Aaron Ecay
Hi Malcom,

It looks like there are two things going on.  The first is that you
are (as Nick suspected) including the file twice in the document.  You
should change the header of the babel block to output a SVG file:

#+begin_src R :results  graphics output :exports both :file mtcars.svg
   ^^^

Then you don’t need the #+BEGIN/END_LATEX bit.

The other bit is the svg package failing somehow.  Does the mtcars.svg
file exist in the same directory?  (It isn’t being generated by the
babel block, for example).  Is the inkscape binary you installed on your
$PATH?  I am suspicious about this line from the log file:

,
| ! LaTeX Error: File `mtcars.zzpdf_tex' not found.
`

The “zz” should not be there.  Could a stray “zz” have gotten into the
svg.sty file?

The svg package doesn’t have the greatest error reporting; if
you keep having trouble it may be helpful to add \usepackage{trace} to
the top of the document, and \traceon just before the \includesvg
command, to try to see in more detail what steps it is trying (and
possibly failing).  This will generate a voluminous log file...

-- 
Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Malcolm Cook
Aaron,

Yeah, the zz was added by me whilst sleuthing.  Sorry for the
confusion.  I added it across the board though. Before I added it, the
message had been 'mtcars.zzpdf_tex' not found.'

I know with org I can directly :export :file basename.svg

The thing I am trying to accomplish is to find an approach that works
for both org export to html and org export to latex-pdf without
having to edit the org document in between exports.

When I do  :export :file basename.svg the resulting pdf does not
inline the svg.  Rather it contains a link to it.

I thought the dance with the svg package was a way of accomplishing my aim.

Do you see a better way?

Thanks!
--
Malcolm Cook
h - 913.642.5257
c - 913.226.1542
w - 816.926.4449


On Thu, Aug 8, 2013 at 4:00 PM, Aaron Ecay aarone...@gmail.com wrote:
 Hi Malcom,

 It looks like there are two things going on.  The first is that you
 are (as Nick suspected) including the file twice in the document.  You
 should change the header of the babel block to output a SVG file:

 #+begin_src R :results  graphics output :exports both :file mtcars.svg
^^^

 Then you don’t need the #+BEGIN/END_LATEX bit.

 The other bit is the svg package failing somehow.  Does the mtcars.svg
 file exist in the same directory?  (It isn’t being generated by the
 babel block, for example).  Is the inkscape binary you installed on your
 $PATH?  I am suspicious about this line from the log file:

 ,
 | ! LaTeX Error: File `mtcars.zzpdf_tex' not found.
 `

 The “zz” should not be there.  Could a stray “zz” have gotten into the
 svg.sty file?

 The svg package doesn’t have the greatest error reporting; if
 you keep having trouble it may be helpful to add \usepackage{trace} to
 the top of the document, and \traceon just before the \includesvg
 command, to try to see in more detail what steps it is trying (and
 possibly failing).  This will generate a voluminous log file...

 --
 Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Cook, Malcolm
In case of difficulties like this, I produce the tex file (C-c C-e l l)
 and then I process it by hand:
 
  pdflatex --shell-escape foo.tex
 
 Separates concerns nicely.

I will try your approach - thanks - I agree

 
  Sleuthing, I see the output .tex file includes the following lines:
 
  \usepackage{svg}
  ...
  \includegraphics[width=.9\linewidth]{mtcars.png}
  @@backend:\includesvg{mtcars}
 
 
 This looks wrong. You probably want @@latex:\includesvg{mtcars}@@ in
 your org file. In any case, the output in the tex file should be just
 
   \includesvg{mtcars}
 
 Also, not sure how the \includegraphics is produced (are you evaluating a
 source block?) 

Yes

 but it should probably not be there, otherwise you are
 going to get two images in your PDF.

I was going to conditionally suppress it depending on value of ox-backend.

If I can get this whole gamish to work for me at all

~Malcolm

 
 --
 Nick
 




Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Aaron Ecay
Hi Malcom,

There is a patch that was added to the master branch of the org git
repository on Jul 27, which turns this from a link into a real inclusion
of the image.  So, it will only work as intended if you are using a git
checkout from after that date.

My apologies, I should have made this more prominent in my earlier
mails.

-- 
Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Malcolm Cook
Aaron,

Thanks for staying with me on this.

I'm not sure what you're suggesting.

Nonetheless, I just updated org from `git clone git://orgmode.org/org-mode.git`

So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.

Are you suggesting that  with this patch.svg created with exporting
graphics :file should now display in the emacs buffer when I toggle
display of inline images?  I wish they would.  They do not, despite my
adding svg to org-export-latex-inline-image-extensions.

Are you suggesting that such a .svg created by org code block would be
appear in the pdf created when I export to latex - pdf?  I wish that
also... that's what I've been trying to accomplish.

Thanks!,


Malcolm


PS - I see you are/were in PA in linguistics.   My first job after my
masters in AI from U Mass was at CMU's psych dept as a lisp programmer
for John Anderson's intelligent tutoring systems.  I then went on in
computational linguistics a bit, working on a marcus parser based
natural language processing system at wang labs.  Ages ago.  Now I'm
in computational biology.  The one commonality through it all?  Emacs!
--
Malcolm Cook
h - 913.642.5257
c - 913.226.1542
w - 816.926.4449


On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote:
 Hi Malcom,

 There is a patch that was added to the master branch of the org git
 repository on Jul 27, which turns this from a link into a real inclusion
 of the image.  So, it will only work as intended if you are using a git
 checkout from after that date.

 My apologies, I should have made this more prominent in my earlier
 mails.

 --
 Aaron Ecay



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-07-27 Thread Aaron Ecay
Hi Malcom,

2013ko uztailak 17an, malcolm cook-ek idatzi zuen:
 
 Hi, 
 
 I am creating .svg files with R source blocks and ESS in org. 
 
 I am happily viewing them in-line in my emacs buffer. 
 
 I am happily exporting as html and viewing them in-line in the resulting web 
 page, including a table of images. 
 
 I do not have an approach for including them into PDF when I export-tex-pdf. 
 
 I'm thinking there might be an approach to converting them on-the-fly to png 
 (or something) during the export-tex-pdf. 
 
 A similar problem was addressed with custom macros here: 
 http://thread.gmane.org/gmane.emacs.orgmode/56532/focus=58322 
 
 But it does not work with  R source blocks that produce .svg files. 
 
 Any suggestions for me?  Is this a lost cause?  Am I asking for too many 
 assumptions to be made by such an auto-conversion process that it is doomed 
 to fail anyway?

I have been using a variant of this workflow with some success.  Using a
patch I just pushed to the master branch, you should be able to
successfully export SVG image files to LaTeX documents, using the “svg”
LaTeX package: http://www.ctan.org/pkg/svg

No configuration should be needed on the org side.

The svg LaTeX package is a bit fussy.  It only works under pdfTeX (it
can be patched to work with LuaTeX, but cannot work with XeTeX at all).
It also requires you to have the inkscape command line program
installed.  But within those constraints it works very nicely.

You may need to arrange for whatever compilation process you use for
LaTeX files to pass the “-shell-escape” command line option to pdftex.
This allows TeX code to execute command line programs, which is needed
to communicate with inkscape and convert the SVG into something LaTeX
can use.

I think in the long run it would be nice if Org could help you translate
the image types in your document into image types an exporter
understands (basically an expanded and generalized version of what is
already done with LaTeX snippets for non-LaTeX export).  But that is
a bigger project, I think.

-- 
Aaron Ecay



[O] how to handle svg files when exporting orgmode to html and pdf?

2013-07-17 Thread malcolm cook
Hi, 

I am creating .svg files with R source blocks and ESS in org. 

I am happily viewing them in-line in my emacs buffer. 

I am happily exporting as html and viewing them in-line in the resulting web 
page, including a table of images. 

I do not have an approach for including them into PDF when I export-tex-pdf. 

I'm thinking there might be an approach to converting them on-the-fly to png 
(or something) during the export-tex-pdf. 

A similar problem was addressed with custom macros here: 
http://thread.gmane.org/gmane.emacs.orgmode/56532/focus=58322 

But it does not work with  R source blocks that produce .svg files. 

Any suggestions for me?  Is this a lost cause?  Am I asking for too many 
assumptions to be made by such an auto-conversion process that it is doomed 
to fail anyway? 

Thanks for your thoughts and help! 

Malcolm