all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joe Corneli via "Emacs development discussions." <emacs-devel@gnu.org>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: emacs-devel@gnu.org
Subject: Re: SVG with embedded png
Date: Tue, 18 May 2021 15:24:31 +0100	[thread overview]
Message-ID: <877djwm868.fsf@Proteus> (raw)
In-Reply-To: <87sg2kgqdb.fsf@fastmail.fm>

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

  reply	other threads:[~2021-05-18 14:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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. [this message]
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.

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877djwm868.fsf@Proteus \
    --to=emacs-devel@gnu.org \
    --cc=joostkremers@fastmail.fm \
    --cc=joseph.corneli.em@hyperreal.enterprises \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.