From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joe Corneli via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: SVG with embedded png Date: Wed, 19 May 2021 13:57:23 +0100 Message-ID: <874keynaoc.fsf@Proteus> References: <87pmxomibv.fsf@Proteus> <87sg2kgqdb.fsf@fastmail.fm> <877djwm868.fsf@Proteus> Reply-To: Joe Corneli Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17728"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Joost Kremers , emacs-devel@gnu.org, telegraph@gmx.com To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 19 15:34:38 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljMLL-0004JU-1C for ged-emacs-devel@m.gmane-mx.org; Wed, 19 May 2021 15:34:35 +0200 Original-Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljMLJ-0002wY-IO for ged-emacs-devel@m.gmane-mx.org; Wed, 19 May 2021 09:34:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLlU-0002qu-C8 for emacs-devel@gnu.org; Wed, 19 May 2021 08:57:32 -0400 Original-Received: from box.hyperreal.enterprises ([85.159.211.210]:36905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljLlR-00048I-HV for emacs-devel@gnu.org; Wed, 19 May 2021 08:57:32 -0400 Original-Received: from authenticated-user (box.hyperreal.enterprises [85.159.211.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.hyperreal.enterprises (Postfix) with ESMTPSA id 396E1432C3; Wed, 19 May 2021 13:57:25 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hyperreal.enterprises; s=mail; t=1621429045; bh=1+IMQ388U8IO2HIXWtXz3tn9R+SS4s03m/wWz410ka0=; h=References:From:To:Cc:Subject:In-reply-to:Date:From; b=CX2UYfdWwXQ/QoOxGkD4aoDT7iCa7PMyt2u6pmvgXzH/kv47rHXoSvkSMT/8HoUh5 0KPnhVo54NYYzJ/0y848n1XS0qMHUvBm7p+dFuEBNfjpxfhKlps6XApZtTjp4VVFWH 5ug0t6kVdDb8S4x3HaS3ZrL70GnMry5j+pFP8hbzRtEGx6Si8ePK6ldyDw5a7afjCH A50tUjTidSJ7kiObGSetTrNwjjx/dxOon0+k7HcB/nExA4xa6rGYxmCqR0SP8Djw2F kbgtig/jLZqDiWpUKkzFzXRUdD4zSBAfnHIRRmXGhYXtMGxBIs0qcZ79KDhA+5XdBX jR18vAG5Ge4fQ== In-reply-to: Received-SPF: pass client-ip=85.159.211.210; envelope-from=joseph.corneli.em@hyperreal.enterprises; helo=box.hyperreal.enterprises X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269477 Archived-At: 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=3D4cm,natwidth=3D445,natheight= =3D661]{/home/joe/ltximg/Tft1st.png} & \includegraphics[width=3D4cm,natwidt= h=3D445,natheight=3D661]{/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=E2=80=99t have any specific need to embed everything in SVG, that=E2=80=99s 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=E2=80=99t a bug, but a security feature! (Aside: I should have posted to the =E2=80=98bugs=E2=80=99 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=E2=80=99s something here. Maybe others have an opinion now that they= =E2=80=99ve 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")) --=20 Dr Joseph A. Corneli (https://github.com/holtzermann17) HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorpora= ted 25th, June 2019 as Company Number 634284 on the Register of Companies for Scotland (https://beta.companieshouse.gov.uk/company/SC634284).