unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* SVG with embedded png
@ 2021-05-18 10:45 Joe Corneli via Emacs development discussions.
  2021-05-18 12:25 ` Eli Zaretskii
  2021-05-18 12:40 ` Joost Kremers
  0 siblings, 2 replies; 9+ messages in thread
From: Joe Corneli via Emacs development discussions. @ 2021-05-18 10:45 UTC (permalink / raw)
  To: emacs-devel

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

Hello, the attached SVG file was made with M-x org-latex-preview.  It
includes an embedded PNG file.

The source is this LaTeX-in-Org oneliner, together with the PNG.

$$\mathit{Hello} \includegraphics[width=2cm,natwidth=445,natheight=661]{/home/joe/tools_for_thought/Tft1st.png}$$

The generated SVG image displays correctly in Mozilla Firefox 88.0.1.

However, inside Of Emacs 28.0.50 (2021-05-05, 31f64d), the image
displays, but I don’t see the embedded png file.  The PNG displays fine
in Emacs via M-x find-file.

Relevant config settigs:

(setq org-preview-latex-default-process 'dvisvgm)
(setq org-preview-latex-process-alist
      '((dvipng :programs
                ("latex" "dvipng")
                :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
                (1.0 . 1.0)
                :latex-compiler
                ("latex -interaction nonstopmode -output-directory %o %f")
                :image-converter
                ("dvipng -D %D -T tight -o %O %f"))
        (dvisvgm :programs
                 ("latex" "/usr/local/texlive/2021/bin/x86_64-linux/dvisvgm")
                 :description "dvi > svg"
                 :message "you need to install the programs: latex and dvisvgm."
                 :image-input-type "dvi" :image-output-type "svg"
                 :image-size-adjust (1.7 . .1)
                 :latex-compiler
                 ("latex -interaction nonstopmode -output-directory %o %f")
                 :image-converter
                 ("/usr/local/texlive/2021/bin/x86_64-linux/dvisvgm %f -n -e -c %S -o %O"))
        (imagemagick :programs
                     ("latex" "convert")
                     :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
                     (1.0 . 1.0)
                     :latex-compiler
                     ("pdflatex -interaction nonstopmode -output-directory %o %f")
                     :image-converter
                     ("convert -density %D -trim -antialias %f -quality 100 %O"))))


[-- Attachment #2: Tft.svg --]
[-- Type: image/svg+xml, Size: 5222 bytes --]

<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 2.11.1 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='186.305243pt' height='196.266296pt' viewBox='452.293796 43.074989 186.305243 196.266296'>
<defs>
<path id='g0-72' d='M7.402242-6.097136C7.481943-6.41594 7.561644-6.495641 8.18929-6.495641C8.398506-6.495641 8.488169-6.495641 8.488169-6.674969C8.488169-6.784558 8.418431-6.804483 8.348692-6.804483C7.970112-6.804483 7.561644-6.774595 7.173101-6.774595C6.774595-6.774595 6.366127-6.804483 5.977584-6.804483C5.917808-6.804483 5.788294-6.804483 5.788294-6.615193C5.788294-6.495641 5.867995-6.495641 6.057285-6.495641C6.366127-6.495641 6.635118-6.495641 6.635118-6.326276C6.635118-6.296389 6.635118-6.276463 6.595268-6.136986L5.987547-3.696139H3.257783L3.855542-6.097136C3.935243-6.41594 4.014944-6.495641 4.64259-6.495641C4.851806-6.495641 4.941469-6.495641 4.941469-6.674969C4.941469-6.784558 4.871731-6.804483 4.801993-6.804483C4.423412-6.804483 4.014944-6.774595 3.626401-6.774595C3.227895-6.774595 2.819427-6.804483 2.430884-6.804483C2.371108-6.804483 2.241594-6.804483 2.241594-6.615193C2.241594-6.495641 2.321295-6.495641 2.510585-6.495641C2.819427-6.495641 3.088418-6.495641 3.088418-6.326276C3.088418-6.296389 3.088418-6.276463 3.048568-6.136986L1.703611-.727273C1.62391-.388543 1.564134-.308842 .886675-.308842C.727273-.308842 .617684-.308842 .617684-.119552C.617684 0 .727273 0 .757161 0C1.135741 0 1.544209-.029888 1.932752-.029888C2.331258-.029888 2.739726 0 3.128269 0C3.198007 0 3.317559 0 3.317559-.179328C3.317559-.308842 3.247821-.308842 3.048568-.308842C2.470735-.308842 2.470735-.388543 2.470735-.478207C2.470735-.518057 2.470735-.537983 2.510585-.67746L3.178082-3.387298H5.907846L5.250311-.727273C5.17061-.388543 5.110834-.308842 4.433375-.308842C4.273973-.308842 4.164384-.308842 4.164384-.119552C4.164384 0 4.273973 0 4.303861 0C4.682441 0 5.090909-.029888 5.479452-.029888C5.877958-.029888 6.286426 0 6.674969 0C6.744707 0 6.864259 0 6.864259-.179328C6.864259-.308842 6.794521-.308842 6.595268-.308842C6.017435-.308842 6.017435-.388543 6.017435-.478207C6.017435-.488169 6.017435-.557908 6.057285-.707347L7.402242-6.097136Z'/>
<path id='g0-101' d='M2.381071-2.30137C2.67995-2.30137 3.347447-2.331258 3.825654-2.520548C4.612702-2.839352 4.612702-3.486924 4.612702-3.556663C4.612702-4.014944 4.244085-4.403487 3.606476-4.403487C2.560399-4.403487 1.135741-3.39726 1.135741-1.633873C1.135741-.737235 1.613948 .109589 2.560399 .109589C3.835616 .109589 4.662516-.886675 4.662516-1.036115C4.662516-1.085928 4.582814-1.195517 4.503113-1.195517C4.463263-1.195517 4.4533-1.185554 4.373599-1.085928C3.636364-.14944 2.749689-.109589 2.580324-.109589C1.932752-.109589 1.823163-.816936 1.823163-1.205479C1.823163-1.58406 1.92279-2.032379 1.992528-2.30137H2.381071ZM2.052304-2.520548C2.480697-4.154421 3.506849-4.184309 3.606476-4.184309C4.004981-4.184309 4.234122-3.915318 4.234122-3.576588C4.234122-2.520548 2.590286-2.520548 2.261519-2.520548H2.052304Z'/>
<path id='g0-108' d='M3.01868-6.665006C3.028643-6.694894 3.048568-6.774595 3.048568-6.794521C3.048568-6.884184 2.988792-6.914072 2.909091-6.914072C2.879203-6.914072 2.779577-6.90411 2.749689-6.894147L1.763387-6.814446C1.643836-6.804483 1.534247-6.794521 1.534247-6.60523C1.534247-6.495641 1.633873-6.495641 1.77335-6.495641C2.251557-6.495641 2.271482-6.425903 2.271482-6.326276C2.271482-6.296389 2.241594-6.166874 2.241594-6.156912L.996264-1.175592C.986301-1.135741 .936488-.936488 .936488-.787049C.936488-.259029 1.295143 .109589 1.77335 .109589C2.15193 .109589 2.351183-.159402 2.480697-.408468C2.650062-.757161 2.789539-1.39477 2.789539-1.424658C2.789539-1.524284 2.709838-1.524284 2.6401-1.524284C2.590286-1.524284 2.530511-1.524284 2.500623-1.474471L2.430884-1.225405C2.261519-.52802 2.072229-.109589 1.793275-.109589C1.534247-.109589 1.534247-.37858 1.534247-.518057C1.534247-.587796 1.534247-.737235 1.594022-.976339L3.01868-6.665006Z'/>
<path id='g0-111' d='M5.070984-2.769614C5.070984-3.716065 4.483188-4.403487 3.616438-4.403487C2.381071-4.403487 1.09589-2.988792 1.09589-1.534247C1.09589-.508095 1.723537 .109589 2.550436 .109589C3.785803 .109589 5.070984-1.305106 5.070984-2.769614ZM2.550436-.109589C2.161893-.109589 1.793275-.418431 1.793275-1.135741C1.793275-1.633873 2.052304-2.739726 2.371108-3.277709C2.739726-3.88543 3.217933-4.184309 3.606476-4.184309C4.094645-4.184309 4.373599-3.745953 4.373599-3.158157C4.373599-2.729763 4.154421-1.703611 3.835616-1.105853C3.5467-.557908 3.038605-.109589 2.550436-.109589Z'/>
</defs>
<g id='page1' transform='matrix(2.331429 0 0 2.331429 0 0)'>
<rect x='193.998564' y='18.475792' width='79.910337' height='84.182847' fill='#0d0e14'/>
<g fill='#dcdccc'>
<use x='193.998564' y='102.54905' xlink:href='#g0-72'/>
<use x='201.404084' y='102.54905' xlink:href='#g0-101'/>
<use x='205.98687' y='102.54905' xlink:href='#g0-108'/>
<use x='209.042064' y='102.54905' xlink:href='#g0-108'/>
<use x='211.588058' y='102.54905' xlink:href='#g0-111'/>
</g>
<image x='0' y='0' width='445' height='661' xlink:href='/home/joe/tools_for_thought/Tft1st.png' transform='matrix(.127191 0 0 .127191 217.308901 18.475792)'/>
</g>
</svg>

[-- Attachment #3: Tft1st.png --]
[-- Type: image/png, Size: 391204 bytes --]

[-- Attachment #4: Type: text/plain, Size: 280 bytes --]



-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).

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

* Re: SVG with embedded png
  2021-05-18 10:45 SVG with embedded png Joe Corneli via Emacs development discussions.
@ 2021-05-18 12:25 ` Eli Zaretskii
  2021-05-18 12:50   ` tomas
  2021-05-18 12:54   ` Basil L. Contovounesios
  2021-05-18 12:40 ` Joost Kremers
  1 sibling, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2021-05-18 12:25 UTC (permalink / raw)
  To: Joe Corneli; +Cc: emacs-devel

> Date: Tue, 18 May 2021 11:45:08 +0100
> From:  Joe Corneli via "Emacs development discussions." <emacs-devel@gnu.org>
> 
> Hello, the attached SVG file was made with M-x org-latex-preview.  It
> includes an embedded PNG file.
> 
> The source is this LaTeX-in-Org oneliner, together with the PNG.
> 
> $$\mathit{Hello} \includegraphics[width=2cm,natwidth=445,natheight=661]{/home/joe/tools_for_thought/Tft1st.png}$$
> 
> The generated SVG image displays correctly in Mozilla Firefox 88.0.1.

FWIW, I don't see the embedded PNG in Firefox, either.  Not even in
the latest version 88 of Firefox.



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

* Re: SVG with embedded png
  2021-05-18 10:45 SVG with embedded png Joe Corneli via Emacs development discussions.
  2021-05-18 12:25 ` Eli Zaretskii
@ 2021-05-18 12:40 ` Joost Kremers
  2021-05-18 14:24   ` Joe Corneli via Emacs development discussions.
  1 sibling, 1 reply; 9+ messages in thread
From: Joost Kremers @ 2021-05-18 12:40 UTC (permalink / raw)
  To: Joe Corneli; +Cc: emacs-devel


On Tue, May 18 2021, Joe Corneli via "Emacs development discussions." wrote:
> Hello, the attached SVG file was made with M-x org-latex-preview.  It
> includes an embedded PNG file.

Actually, if you take a look in the svg file, you'll notice that the png image
isn't embedded, it's linked, and the link points to
`/home/joe/tools_for_thought/Tft1st.png`, which is obviously not going to work
on anyone else's computer.

If I manually change the link to a relative one on my computer, Emacs (27.2)
shows the linked png just fine (provided the png image is in the directory
pointed to, of course). Why your Emacs isn't able to find the png, I don't know.
Perhaps you moved it in between viewing the svg in Firefox and Emacs?

HTH

-- 
Joost Kremers
Life has its moments



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

* Re: SVG with embedded png
  2021-05-18 12:25 ` Eli Zaretskii
@ 2021-05-18 12:50   ` tomas
  2021-05-18 12:54   ` Basil L. Contovounesios
  1 sibling, 0 replies; 9+ messages in thread
From: tomas @ 2021-05-18 12:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Joe Corneli, emacs-devel

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

On Tue, May 18, 2021 at 03:25:51PM +0300, Eli Zaretskii wrote:
> > Date: Tue, 18 May 2021 11:45:08 +0100
> > From:  Joe Corneli via "Emacs development discussions." <emacs-devel@gnu.org>
> > 
> > Hello, the attached SVG file was made with M-x org-latex-preview.  It
> > includes an embedded PNG file.
> > 
> > The source is this LaTeX-in-Org oneliner, together with the PNG.
> > 
> > $$\mathit{Hello} \includegraphics[width=2cm,natwidth=445,natheight=661]{/home/joe/tools_for_thought/Tft1st.png}$$
> > 
> > The generated SVG image displays correctly in Mozilla Firefox 88.0.1.
> 
> FWIW, I don't see the embedded PNG in Firefox, either.  Not even in
> the latest version 88 of Firefox.

Looking at the SVG (the source, I mean), this 'embedding' of the PNG
happens via an xlink, like so:

  xlink:href='/home/joe/tools_for_thought/Tft1st.png

I actually doubt You, Eli, have a directory /home/joe in your
computer (but I could be wrong :)

The resolution of that URL will, AFAIK, depend on quite a bit
of context (it is a path-absolute URL), but I might be wrong.

Cheers
 - t

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

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

* Re: SVG with embedded png
  2021-05-18 12:25 ` Eli Zaretskii
  2021-05-18 12:50   ` tomas
@ 2021-05-18 12:54   ` Basil L. Contovounesios
  1 sibling, 0 replies; 9+ messages in thread
From: Basil L. Contovounesios @ 2021-05-18 12:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Joe Corneli, emacs-devel

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

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Tue, 18 May 2021 11:45:08 +0100
>> From:  Joe Corneli via "Emacs development discussions." <emacs-devel@gnu.org>
>> 
>> Hello, the attached SVG file was made with M-x org-latex-preview.  It
>> includes an embedded PNG file.
>> 
>> The source is this LaTeX-in-Org oneliner, together with the PNG.
>> 
>> $$\mathit{Hello} \includegraphics[width=2cm,natwidth=445,natheight=661]{/home/joe/tools_for_thought/Tft1st.png}$$
>> 
>> The generated SVG image displays correctly in Mozilla Firefox 88.0.1.
>
> FWIW, I don't see the embedded PNG in Firefox, either.  Not even in
> the latest version 88 of Firefox.

Have you installed the PNG file in the location expected by the SVG
file?  Alternatively, you can adjust the embedded file name in the SVG
file.

For example, I saved the two files as /tmp/foo.svg and /tmp/foo.png and
edited the xlink:href attribute in /tmp/foo.svg to point to
/tmp/foo.png (a relative file name also works).

The result renders fine in Emacs 25 and 26 (w/ ImageMagick), Emacs 27
and 28 (w/ Cairo and w/o ImageMagick), as well as Firefox 86.0.1, with
the system librsvg 2.50.3:


[-- Attachment #2: 2021-05-18-135047_1920x1080_scrot-fs8.png --]
[-- Type: image/png, Size: 46162 bytes --]

[-- Attachment #3: Type: text/plain, Size: 65 bytes --]


So maybe the issue is in locating the embedded file?

-- 
Basil

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

* Re: SVG with embedded png
  2021-05-18 12:40 ` Joost Kremers
@ 2021-05-18 14:24   ` Joe Corneli via Emacs development discussions.
  2021-05-18 18:05     ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Corneli via Emacs development discussions. @ 2021-05-18 14:24 UTC (permalink / raw)
  To: Joost Kremers; +Cc: emacs-devel

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

Joost Kremers writes:

> If I manually change the link to a relative one on my computer, Emacs (27.2)
> shows the linked png just fine (provided the png image is in the directory
> pointed to, of course). Why your Emacs isn't able to find the png, I don't know.
> Perhaps you moved it in between viewing the svg in Firefox and Emacs?

OP here, apologies: I neglected to make the link in my demo code easily
transferrable for testing!  I’ve streamlined the reproduction case.

Please try this:

$ emacs -Q demo.org

...where the org file is the one that’s attached, and the PNG file
Tft1st.png is saved in the /tmp directory:

$ ls -lt /tmp/Tft1st.png
-rw-rw-r-- 1 joe joe 391204 May 18 15:00 /tmp/Tft1st.png

Lastly, evaluate the Org block with C-c C-c.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: demo.org --]
[-- Type: text/x-org, Size: 1960 bytes --]

* Please evaluate the following block with C-c C-c
#+begin_src emacs-lisp :results output silent
(setq org-preview-latex-default-process 'dvisvgm) ;; works if it is dvipng
(setq org-preview-latex-process-alist
      '((dvipng :programs
                ("latex" "dvipng")
                :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
                (1.0 . 1.0)
                :latex-compiler
                ("latex -interaction nonstopmode -output-directory %o %f")
                :image-converter
                ("dvipng -D %D -T tight -o %O %f"))
        (dvisvgm :programs
                 ("latex" "dvisvgm")
                 :description "dvi > svg"
                 :message "you need to install the programs: latex and dvisvgm."
                 :image-input-type "dvi" :image-output-type "svg"
                 :image-size-adjust (1.7 . .1)
                 :latex-compiler
                 ("latex -interaction nonstopmode -output-directory %o %f")
                 :image-converter
                 ("dvisvgm %f -n -e -c %S -o %O"))
        (imagemagick :programs
                     ("latex" "convert")
                     :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
                     (1.0 . 1.0)
                     :latex-compiler
                     ("pdflatex -interaction nonstopmode -output-directory %o %f")
                     :image-converter
                     ("convert -density %D -trim -antialias %f -quality 100 %O"))))
(org-toggle-inline-images)
(org-preview-latex-fragment '(16))
#+end_src

* Here is the file
[[file:/tmp/Tft1st.png]]

* Here it is from inside LaTeX, but that doesn't work properly

$$\mathit{Hello} \includegraphics[width=2cm,natwidth=445,natheight=661]{/tmp/Tft1st.png}$$


[-- Attachment #3: Tft1st.png --]
[-- Type: image/png, Size: 391204 bytes --]

[-- Attachment #4: Type: text/plain, Size: 360 bytes --]



I’ve attached a screenshot of what I see when I do this.  I noticed that

(setq org-preview-latex-default-process 'dvisvgm)

seems to be crucial for reproducing the problem.  If the variable is set
to use dvipng, then the picture does shows up as expected (but as inline
PNG format, not SVG).

(setq org-preview-latex-default-process 'dvipng)


[-- Attachment #5: Screenshot from 2021-05-18 15-18-59.png --]
[-- Type: image/png, Size: 425716 bytes --]

[-- Attachment #6: Type: text/plain, Size: 280 bytes --]



-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).

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

* Re: SVG with embedded png
  2021-05-18 14:24   ` Joe Corneli via Emacs development discussions.
@ 2021-05-18 18:05     ` Alan Third
  2021-05-18 18:09       ` Alan Third
  2021-05-19 12:57       ` Joe Corneli via Emacs development discussions.
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Third @ 2021-05-18 18:05 UTC (permalink / raw)
  To: Joe Corneli; +Cc: Joost Kremers, emacs-devel

On Tue, May 18, 2021 at 03:24:31PM +0100, Joe Corneli via Emacs development discussions. wrote:
> Joost Kremers writes:
> 
> > If I manually change the link to a relative one on my computer, Emacs (27.2)
> > shows the linked png just fine (provided the png image is in the directory
> > pointed to, of course). Why your Emacs isn't able to find the png, I don't know.
> > Perhaps you moved it in between viewing the svg in Firefox and Emacs?
> 
> OP here, apologies: I neglected to make the link in my demo code easily
> transferrable for testing!  I’ve streamlined the reproduction case.
> 
> Please try this:
> 
> $ emacs -Q demo.org
> 
> ...where the org file is the one that’s attached, and the PNG file
> Tft1st.png is saved in the /tmp directory:
> 
> $ ls -lt /tmp/Tft1st.png
> -rw-rw-r-- 1 joe joe 391204 May 18 15:00 /tmp/Tft1st.png
> 
> Lastly, evaluate the Org block with C-c C-c.

More than likely the problem is that the image file isn't within the
SVG file's sub-tree. Librsvg won't load URLs that aren't in the same
directory as the SVG file or in a subdirectory.

This is why people grabbing the two files and dumping them in the same
directory see the image, but if you put the png in /tmp it doesn't.

This is a security feature, apparently.

(I thought using :base_uri when loading the image was supposed to work
around this, but apparently not...)
-- 
Alan Third



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

* Re: SVG with embedded png
  2021-05-18 18:05     ` Alan Third
@ 2021-05-18 18:09       ` Alan Third
  2021-05-19 12:57       ` Joe Corneli via Emacs development discussions.
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Third @ 2021-05-18 18:09 UTC (permalink / raw)
  To: Joe Corneli, Joost Kremers, emacs-devel

On Tue, May 18, 2021 at 07:05:41PM +0100, Alan Third wrote:
> (I thought using :base_uri when loading the image was supposed to work
> around this, but apparently not...)

Actually, it does if you use the right option:

(insert-image (create-image "/wherever/your/image/is/Tft.svg" 'svg nil :base-uri "/tmp"))
-- 
Alan Third



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

* Re: SVG with embedded png
  2021-05-18 18:05     ` Alan Third
  2021-05-18 18:09       ` Alan Third
@ 2021-05-19 12:57       ` Joe Corneli via Emacs development discussions.
  1 sibling, 0 replies; 9+ messages in thread
From: Joe Corneli via Emacs development discussions. @ 2021-05-19 12:57 UTC (permalink / raw)
  To: Alan Third; +Cc: Joost Kremers, emacs-devel, telegraph

Alan Third writes:

> More than likely the problem is that the image file isn't within the
> SVG file's sub-tree. Librsvg won't load URLs that aren't in the same
> directory as the SVG file or in a subdirectory.
>
> This is why people grabbing the two files and dumping them in the same
> directory see the image, but if you put the png in /tmp it doesn't.
>
> This is a security feature, apparently.

Thanks Alan!

I can confirm that the following snippet works fully as expected
(assuming that the image placed in the location indicated), via M-x
org-toggle-latex-fragment:

$$\begin{tabular}{cc} \includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png} & \includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png}\end{tabular}$$

8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<

THE BACKSTORY

Gregor had written to me separately to ask what I wanted to achieve by
putting the PNG within the SVG, so I thought I would just to explain
what I was getting at, for completeness.

My goal was to get two images next to each other (which not directly
possible using standard Org mode markup).

I learned that it is possible to get an image and text side-by-side with
a suitable LaTeX fragment (https://emacs.stackexchange.com/a/50633/8406)

That made me wonder if I could get two images side-by-side using a
similar LaTeX trick.  (I don’t have any specific need to embed
everything in SVG, that’s just my usual setting for LaTeX fragments.)
When I noticed the missing image, I thought I had found a bug.

...Now it turns out it wasn’t a bug, but a security feature!

(Aside: I should have posted to the ‘bugs’ list, but it has been a while
since I submitted a bug report so I forgot all about that!)

On reflection: could the strange niche case I found actually motivate
any code or documentation changes in Org?  It seems unlikely, but maybe
there’s something here.  Maybe others have an opinion now that they’ve
seen the story has been presented in full.

> Actually, it does if you use the right option:
>
> (insert-image (create-image "/wherever/your/image/is/Tft.svg" 'svg nil
> :base-uri "/tmp"))


-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).



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

end of thread, other threads:[~2021-05-19 12:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-18 10:45 SVG with embedded png Joe Corneli via Emacs development discussions.
2021-05-18 12:25 ` Eli Zaretskii
2021-05-18 12:50   ` tomas
2021-05-18 12:54   ` Basil L. Contovounesios
2021-05-18 12:40 ` Joost Kremers
2021-05-18 14:24   ` Joe Corneli via Emacs development discussions.
2021-05-18 18:05     ` Alan Third
2021-05-18 18:09       ` Alan Third
2021-05-19 12:57       ` Joe Corneli via Emacs development discussions.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).