emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Options for HTML & PDF export
@ 2011-05-18 21:07 ` Ken.Williaos
  2011-05-18 21:19   ` Nick Dokos
  2011-05-19  9:45   ` Sebastien Vauban
  0 siblings, 2 replies; 6+ messages in thread
From: Ken.Williaos @ 2011-05-18 21:07 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I use the Babel features of org-mode to do a sort of literate-programming thing.  I have lots of R code that generates graphics which get included into an exported HTML or PDF (via LaTeX) document.

I'm wondering about "best practices" (though I hate that term) for managing the export to both HTML & PDF.  For the HTML I generate the graphics files as PNG, but for PDF the PNG format doesn't embed very well, so I need to generate PDF or EPS or somesuch.  But then I have to change the ":file filename.png" to ":file filename.pdf", which is quite cumbersome to do every time I want to export.

Is there some wcy people have for dealing with this situation?  Some options setting maybe?

Thanks.

--
Ken Williams
Senior Research Scientist

Thomson Reuters

http://labs.thomsonreuters.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Options for HTML & PDF export
  2011-05-18 21:07 ` Options for HTML & PDF export Ken.Williaos
@ 2011-05-18 21:19   ` Nick Dokos
  2011-05-18 21:28     ` Ken.Williams
  2011-05-19  9:45   ` Sebastien Vauban
  1 sibling, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2011-05-18 21:19 UTC (permalink / raw)
  To: Ken.Williams; +Cc: nicholas.dokos, emacs-orgmode

List-Post8 <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org

<Ken.Williams@thomsonreuters.com> wrote:

> I'm wondering about "best practices" (though I hate that term) for
> managing the export to both HTML & PDF.  For the HTML I generate the
> graphics files as PNG, but for PDF the PNG format doesn't embed very
> well, 

What is the problem with PNG exactly? I've never had any problems
incorporating them into a PDF. It is a bitmap format, so it will not
suffer extreme changes in magnification without some ugliness of course,
but other than that I don't know of any problems.

Nick

> so I need to generate PDF or EPS or somesuch.  But then I have
> to change the ":file filename.png" to ":file filename.pdf", which is
> quite cumbersome to do every time I want to export.
> 
> Is there some way people have for dealing with this situation?  Some options setting maybe?
> 
> Thanks.
> 
> --
> Ken Williams
> Senior Research Scientist
> 
> Thomson Reuters
> 
> http://labs.thomsonreuters.com
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Options for HTML & PDF export
  2011-05-18 21:19   ` Nick Dokos
@ 2011-05-18 21:28     ` Ken.Williams
  2011-05-19 12:28       ` Christophe Rhodes
  0 siblings, 1 reply; 6+ messages in thread
From: Ken.Williams @ 2011-05-18 21:28 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode



On 5/18/11 4:19 PM, "Nick Dokos" <nicholas.dokos@hp.com> wrote:

><Ken.Williams@thomsonreuters.com> wrote:
>
>> I'm wondering about "best practices" (though I hate that term) for
>> managing the export to both HTML & PDF.  For the HTML I generate the
>> graphics files as PNG, but for PDF the PNG format doesn't embed very
>> well, 
>
>What is the problem with PNG exactly? I've never had any problems
>incorporating them into a PDF. It is a bitmap format, so it will not
>suffer extreme changes in magnification without some ugliness of course,
>but other than that I don't know of any problems.

That is exactly the problem =).  It does include itself into the document,
it just doesn't look very nice.  Since these are data-based graphics
coming from R, their lines should be nice & crisp, but they end up looking
pretty fuzzy.


--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Options for HTML & PDF export
  2011-05-18 21:07 ` Options for HTML & PDF export Ken.Williaos
  2011-05-18 21:19   ` Nick Dokos
@ 2011-05-19  9:45   ` Sebastien Vauban
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastien Vauban @ 2011-05-19  9:45 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Ken,

<Ken.Williaos-qs4m+OjfQoH+fug3k4jHmNBPR1lH4CV8@public.gmane.org> wrote:
> I use the Babel features of org-mode to do a sort of literate-programming
> thing. I have lots of R code that generates graphics which get included into
> an exported HTML or PDF (via LaTeX) document.
>
> I'm wondering about "best practices" (though I hate that term) for managing
> the export to both HTML & PDF.

Just by curiosity, what don't use like that term?

> For the HTML I generate the graphics files as PNG, but for PDF the PNG
> format doesn't embed very well, so I need to generate PDF or EPS or
> somesuch. But then I have to change the ":file filename.png" to ":file
> filename.pdf", which is quite cumbersome to do every time I want to export.
>
> Is there some wcy people have for dealing with this situation? Some options
> setting maybe?

I've no time to customize it to your particular needs, but here's something
you can update to map it to your needs:

#+begin_src org
#+BABEL: :results (if (and (boundp 'backend) (eq backend 'latex)) "latex" "file")
#+end_src

Please post your solution for the sake of further sharing...

Best regards,
  Seb

-- 
Sébastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Options for HTML & PDF export
  2011-05-18 21:28     ` Ken.Williams
@ 2011-05-19 12:28       ` Christophe Rhodes
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe Rhodes @ 2011-05-19 12:28 UTC (permalink / raw)
  To: emacs-orgmode

<Ken.Williams@thomsonreuters.com> writes:

> On 5/18/11 4:19 PM, "Nick Dokos" <nicholas.dokos@hp.com> wrote:
>>What is the problem with PNG exactly? I've never had any problems
>>incorporating them into a PDF. It is a bitmap format, so it will not
>>suffer extreme changes in magnification without some ugliness of course,
>>but other than that I don't know of any problems.
>
> That is exactly the problem =).  It does include itself into the document,
> it just doesn't look very nice.  Since these are data-based graphics
> coming from R, their lines should be nice & crisp, but they end up looking
> pretty fuzzy.

For what it's worth, I've been experimenting with the tikzDevice R
graphics device.  I have in the preamble of my current document

#+srcname: orgrsetup
#+begin_src R :session *R* :exports none :results none
  library(tikzDevice)
  org.device <- function(name, ext) {
    file <- sprintf("%s.%s", name, ext)
    switch(ext,
           "png"=png(file, width=480, height=384),
           "tikz"=tikz(file, width=5, height=4))
  }
  org.raw <- function(name, ext) {
    file <- sprintf("%s.%s", name, ext)
    switch(ext,
           "png"=sprintf("[[file:%s]]", file),
           "tikz"=sprintf("#+LaTeX: \\input{%s}", file))
  }
#+end_src

and then I use

#+begin_src R :session *R* :exports results :results value raw :var name="filename" :var ext=(csr-org-export-babel-graphics-extension)
  org.device(name, ext)
  # draw the picture here
  dev.off()
  org.raw(name,ext)
#+end_src

where csr-org-export-babel-graphics-extension returns "tikz" if the
backend is latex, and png otherwise.  This (with a bit more work on the
R side) gives me scalable graphics with fonts matching the PDF
document's fonts going through LaTeX, and acceptable-quality HTML.
(Which is something I've been looking for for the last six years, so I'm
quite pleased at the moment :-)

I hope this helps to provide some ideas.

Cheers,

Christophe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Options for HTML & PDF export
@ 2011-05-20 19:47 Ken.Williams
  0 siblings, 0 replies; 6+ messages in thread
From: Ken.Williams @ 2011-05-20 19:47 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban <wxhgmqzgwmuf@...> writes:
>
> <Ken.Williams@...> wrote:
> > [...]
> > I'm wondering about "best practices" (though I hate that term) for
>managing
> > the export to both HTML & PDF.
> 
> Just by curiosity, what don't use like that term?

I'm not sure - I just hear it used a lot as sort of a "trump card" when
someone wants to impress someone else with how great their methods are, or
if they want to squash someone else's "non-compliant" tool usage.

In this case though, I'm perfectly willing to be impressed with someone's
method. =)


> I've no time to customize it to your particular needs, but here's
>something
> you can update to map it to your needs:
> 
> #+begin_src org
> #+BABEL: :results (if (and (boundp 'backend) (eq backend 'latex))
>"latex" "file")
> #+end_src

Thanks Seb, I'll try working with that.  I haven't ever done any Lisp
stuff in org-mode, so I may be a little bit lost here, but I'll experiment
a bit.

Is there somewhere in the orgmode manual that talks about where Lisp can
be embedded in documents for interpolation like this? I hadn't seen that
kind of thing before.


> 
> Please post your solution for the sake of further sharing...

Definitely will if I find something useful!



--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-20 19:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <C9F99F46.2CB3E%ken.winliams@thomsonreuters.com>
2011-05-18 21:07 ` Options for HTML & PDF export Ken.Williaos
2011-05-18 21:19   ` Nick Dokos
2011-05-18 21:28     ` Ken.Williams
2011-05-19 12:28       ` Christophe Rhodes
2011-05-19  9:45   ` Sebastien Vauban
2011-05-20 19:47 Ken.Williams

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).