# Import an image using Matex without the path of the image inserted in the output

I am playing with MaTeX to include an image. It works but it also displays the path of the image in the output which messes things out.

Here is a MWE (on windows with 11.3)

<< MaTeX
SetOptions[MaTeX, "Preamble" -> {"\\usepackage{graphicx}"}];
MaTeX["This is a test \\includegraphics[width=.5\\textwidth]{C:/Program Files/Wolfram Research/Mathematica/11.3/Documentation/English/System/ExampleData/pearls.png} with data"]


which gives

I'd like the path of the images not to show in the text output.

Is there a way to do that?

MaTeX Version 1.7.4, Mathematica 11.3 on windows 10.

Could someone on windows 10 please try to see if they can reproduce this?

Updated

I also tried using \text{}

<<MaTeX
MaTeX["\\text{Test \\includegraphics[width=.5\\textwidth]{C:/Program Files/Wolfram Research/Mathematica/11.3/Documentation/English/System/ExampleData/pearls.png} image}","Preamble"->{"\\usepackage{graphicx}"}]


• I just tried this on macOS with MacTeX 2018 and I cannot reproduce the problem. I see only the images, not the path. I don't know why the path appears for you. i.stack.imgur.com/U8Bw2.png – Szabolcs Jan 27 '19 at 18:39
• @Szabolcs thanks for trying. It might be a Platform related then? There are no errors or warning generated also. – Nasser Jan 27 '19 at 18:49
• Can you try putting it in \text{}? Does it work then? – Szabolcs Jan 27 '19 at 19:19
• @Szabolcs I did. I tried exactly your example. It did not work. I will now post that as well. – Nasser Jan 27 '19 at 19:24
• I suggest you create a TeX-only minimal example and ask on TeX.SE. Do let me know if you found out why it happens or if you have a solution! To create a minimal example, do ClearMaTeXCache[] before the MaTeX call and add the option "TeXFileFunction" -> Print. This will show you the TeX source that MaTeX generates. As a first simplification, replace the \MaTeX{ ... } with simply $...$. Then you can remove most of the preamble (which just serves to define \MaTeX). – Szabolcs Jan 27 '19 at 19:43

"Preamble" -> {"\\usepackage{graphicx}", "\\usepackage{grffile}"}