5

I have a problem with a path to a image. The image path looks like this:

\includegraphics[]{C:/Users/JOHN~1.WEL/AppData/test.png}

If i put mouse over the image path it shows up but when i try to compile give me some error because of "~". The entire username is JOHN.WELSH

Error is:

Missing \endcsname inserted. ^^I^^I}{}

I don't hava alternatives. The path to the image is given in this way(are added automaticaly). How can i add this image in my document using this type of path?

Thank you all.

0

1 Answer 1

6

As ~ is an active character (i.e. is actually a macro) the file path is not a normal string. You need to place a string version of ~. This can be done by appending the TeX primitive \string in front of it.

The following should do it:

\includegraphics[]{C:/Users/JOHN\string~1.WEL/AppData/test.png}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.