LaTeX forum ⇒ LyXLyx preview: image inside TikZ picture

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

Lyx preview: image inside TikZ picture

Postby pireddag » Mon May 27, 2019 2:42 pm

Dear forum users,

the LyX preview does not work if I include a picture using \includegraphics inside a tikzpicture environment.
It works if I include the same picture on its own.

Here are two code snippets to insert inside a TeX code box in LyX

  1. \begin{tikzpicture}
  2. \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.4\textwidth]{example-image-a.jpg}};
  3. \end{tikzpicture}


(does not appear in preview)

  1. \includegraphics[width=0.4\textwidth]{example-image-a.jpg}


(appears in preview).

I have verified that the tikz picture appears in preview if I substitute the image with text.

As far as I know the image example-image-a.jpg is part of the mwe package so the two snippets should compile inside a LyX document if one puts the command \usepackage{tikz} in the preamble.

I have tried both with the standard article class and with the Koma article (I do not expect the class to be important for this).

Any ideas? Thanks in advance!

User avatar
thomasb
Posts: 132
Joined: Thu Aug 03, 2017 10:54 am

Postby thomasb » Thu May 30, 2019 10:34 pm


pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

Postby pireddag » Mon Jun 03, 2019 4:21 pm

Hi, thanks a lot for the answer.

I think I did not explain myself well. I am able to insert the image inside a TikZ picture (in the way that you said: I took the code from another StackExchange answer, this one: https://tex.stackexchange.com/questions/186389/how-can-i-annotate-an-image-with-arrow-and-text) . I can obtain the pdf from the LyX file then.

What I cannot do is to see the image in the LyX preview. The preview works for TikZ pictures, and for images, but not for images which are inside TikZ pictures: so I would like to know if it is possible to obtain it.

User avatar
thomasb
Posts: 132
Joined: Thu Aug 03, 2017 10:54 am

Postby thomasb » Wed Jun 05, 2019 2:20 pm

pireddag wrote:The preview works for TikZ pictures, and for images, but not for images which are inside TikZ pictures: so I would like to know if it is possible to obtain it.

Well, I don't even know what a preview is... If you're on Windows, try this viewer.

pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

Postby pireddag » Wed Jun 05, 2019 8:14 pm

thomasb wrote:Well, I don't even know what a preview is...


it is LyX's instant preview. It is explained here for equations: https://wiki.lyx.org/LyX/InstantPreview, but it works for many of the TeX code snippets that one inserts in LyX (the so called "Evil Red Text").

It works nicely for example for the packages siunitx and tcolorbox, and usually works for TikZ pictures (and graphs made with pgfplots).
I have figure out that it does not work if one inserts an image inside a TikZ picture. Maybe the LyX mailing list is the right place where to ask, I will do it. If I get an answer there, I will post it here.

But thanks for trying to answer the question!

User avatar
thomasb
Posts: 132
Joined: Thu Aug 03, 2017 10:54 am

Postby thomasb » Thu Jun 06, 2019 9:13 am

pireddag wrote:But thanks for trying to answer the question!

(give Sumatra a try, though : https://tex.stackexchange.com/questions ... -using-lyx ...)

pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

Postby pireddag » Thu Jun 06, 2019 11:51 am

thomasb wrote:
pireddag wrote:But thanks for trying to answer the question!

(give Sumatra a try, though : https://tex.stackexchange.com/questions ... -using-lyx ...)


I already use it :-)

User avatar
thomasb
Posts: 132
Joined: Thu Aug 03, 2017 10:54 am

Postby thomasb » Thu Jun 06, 2019 7:41 pm

pireddag wrote:I already use it :-)

that was my last cartridge...

pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

Postby pireddag » Fri Jun 07, 2019 12:13 am

thomasb wrote:
pireddag wrote:I already use it :-)

that was my last cartridge...


:-)

I find the LyX instant preview helpful :-)

User avatar
thomasb
Posts: 132
Joined: Thu Aug 03, 2017 10:54 am

Postby thomasb » Fri Jun 07, 2019 6:17 pm

pireddag wrote:I find the LyX instant preview helpful :-)


With Emacs, you can make a keyboard short-cut to compile. It's not as direct as preview though...


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 3 guests