emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Embed images in formats best suited for HTML and LaTeX export and inline viewing
@ 2012-05-30 13:26 Brett Viren
  2012-06-07  3:47 ` Avdi Grimm
  0 siblings, 1 reply; 6+ messages in thread
From: Brett Viren @ 2012-05-30 13:26 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

Hi,

How can I tell org-mode to use different file formats for an image for
different purposes?

What I really want is a scalable format to embed "line art" type images
(plots) into org-mode documents so that they can display inline and in
both HTML and LaTeX exports.  SVG seems good for the first two but LaTeX
doesn't accept it.  Likewise, LaTeX wants PDF but inline and HTML export
do not.

Anyway to eat my cake?

Thanks,
-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Embed images in formats best suited for HTML and LaTeX export and inline viewing
  2012-05-30 13:26 Embed images in formats best suited for HTML and LaTeX export and inline viewing Brett Viren
@ 2012-06-07  3:47 ` Avdi Grimm
  2012-07-31 13:20   ` Brett Viren
  0 siblings, 1 reply; 6+ messages in thread
From: Avdi Grimm @ 2012-06-07  3:47 UTC (permalink / raw)
  To: Brett Viren; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 845 bytes --]

I'm interested in this as well. At present I plan on handling it externally
to org-mode with some preprocessing before final org-export; but it would
be cool to have it be a built-in feature. Obviously it can be accomplished
manually with #+LaTeX: and #+HTML: sections, but some syntax sugar for it
would be great.

On Wed, May 30, 2012 at 9:26 AM, Brett Viren <bv@bnl.gov> wrote:

> Hi,
>
> How can I tell org-mode to use different file formats for an image for
> different purposes?
>
> What I really want is a scalable format to embed "line art" type images
> (plots) into org-mode documents so that they can display inline and in
> both HTML and LaTeX exports.  SVG seems good for the first two but LaTeX
> doesn't accept it.  Likewise, LaTeX wants PDF but inline and HTML export
> do not.
>
> Anyway to eat my cake?
>
> Thanks,
> -Brett.
>

[-- Attachment #2: Type: text/html, Size: 1173 bytes --]

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

* Re: Embed images in formats best suited for HTML and LaTeX export and inline viewing
  2012-06-07  3:47 ` Avdi Grimm
@ 2012-07-31 13:20   ` Brett Viren
  2012-08-01 13:24     ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Brett Viren @ 2012-07-31 13:20 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Hi,

I'm back wanting to specify per-export image formats again.

I learned about macros in org-mode and I have found a half-solution:


#+MACRO: himg #+HTML: <a name="$1"><center><img width="100%" src="$2.svg" alt="$3"/> $3</center></a>
#+MACRO: limg #+LATEX: \begin{figure}\label{$1}\includegraphics[width=\textwidth]{$2.pdf}\caption{$3}\end{figure}


I then call each macro explicitly:


{{{limg(fig:overview,dataflow,Overview of the data flow.)}}}
{{{himg(fig-overview,dataflow,Overview of the data flow.)}}}


It works but has a few warts:

0) It totally subverts org-mode's figure markup.

1) So far I think I must use two macro calls thus annoyingly repeating
data.  Can macros be nested?  Can they have newlines?

2) I prefer "fig:label" type labels in LaTeX but the HTML export
apparently forms the link translating ":" to "-".  So, this must be
taken into account when the macros are called.


Any other ideas?


Thanks,
-Brett.


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Embed images in formats best suited for HTML and LaTeX export and inline viewing
  2012-07-31 13:20   ` Brett Viren
@ 2012-08-01 13:24     ` Bastien
  2012-08-01 17:05       ` Brett Viren
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-08-01 13:24 UTC (permalink / raw)
  To: Brett Viren; +Cc: emacs-orgmode

Hi Brett,

Brett Viren <bv@bnl.gov> writes:

> #+MACRO: himg #+HTML: <a name="$1"><center><img width="100%" src="$2.svg" alt="$3"/> $3</center></a>
> #+MACRO: limg #+LATEX: \begin{figure}\label{$1}\includegraphics[width=\textwidth]{$2.pdf}\caption{$3}\end{figure}
>
> I then call each macro explicitly:
>
> {{{limg(fig:overview,dataflow,Overview of the data flow.)}}}
> {{{himg(fig-overview,dataflow,Overview of the data flow.)}}}
>
> It works but has a few warts:
>
> 0) It totally subverts org-mode's figure markup.
>
> 1) So far I think I must use two macro calls thus annoyingly repeating
> data.  Can macros be nested?  

No.

> Can they have newlines?

I don't think so -- did you try?

-- 
 Bastien

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

* Re: Embed images in formats best suited for HTML and LaTeX export and inline viewing
  2012-08-01 13:24     ` Bastien
@ 2012-08-01 17:05       ` Brett Viren
  2012-08-02 15:11         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Brett Viren @ 2012-08-01 17:05 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Hi Bastien,

Bastien <bzg@gnu.org> writes:

> Brett Viren <bv@bnl.gov> writes:
>
>> Can they have newlines?
>
> I don't think so -- did you try?

Now, there is an idea!  I had not tried, but yes, the are accepted and a
"multiline" macro can be defined using '\n' characters like:

#+MACRO: mimg #+HTML: <a name="$1"><center><img width="100%" src="$2.svg" alt="$3"/> $3</center></a>\n#+LATEX: \begin{figure}\label{$1}\includegraphics[width=\textwidth]{$2.pdf}\caption{$3}\end{figure}

I can now call this macro with a single line like:

{{{mimg(fig-overview,dataflow,Overview of the data flow.)}}}

and both HTML and LaTeX/PDF export produces correct output.  I give up
the "fig:" style prefix for the label, but that is a small detail.


So, I'm satisfied now.  Thanks for the nudge!

-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Embed images in formats best suited for HTML and LaTeX export and inline viewing
  2012-08-01 17:05       ` Brett Viren
@ 2012-08-02 15:11         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2012-08-02 15:11 UTC (permalink / raw)
  To: Brett Viren; +Cc: emacs-orgmode

Brett Viren <bv@bnl.gov> writes:

> So, I'm satisfied now.  Thanks for the nudge!

I learned something -- you're welcome,

-- 
 Bastien

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

end of thread, other threads:[~2012-08-02 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30 13:26 Embed images in formats best suited for HTML and LaTeX export and inline viewing Brett Viren
2012-06-07  3:47 ` Avdi Grimm
2012-07-31 13:20   ` Brett Viren
2012-08-01 13:24     ` Bastien
2012-08-01 17:05       ` Brett Viren
2012-08-02 15:11         ` Bastien

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