How to locate an invisible character in Latex

2 min readJan 16, 2021


I usually use Latex to write reports I love it because it allows me to produce beautiful documents.

I use VSCode to write in Latex and sometimes I faced a tedious problem.
If I copy a text from a pdf or from a web page to a .tex file sometimes the compiler shows up an error like the one you can see in this screenshot.

The problem is caused by an invalid character that usually is invisible. It is impossible to find it and to solve the problem.
I used to solve this problem by manually reviewing all the text I pasted in the .tex file but I had to admit that it is boring.

Luckily I found this question that helped me to solve this problem.

  • Suppose you have an error like this, VSCode is notifying you that the character “U+200B” is invalid.
  • First of all, launch a browser (I tried with Google Chrome, it should work on Firefox too), then you have to open the console.
  • To solve the error with the character “U+200B”, type in the console the following command:


  • The “invisible” character will be copied in your clipboard and you can now search for it in VSCode.

The previous command works for the characters in range “U+0000” to “U+FFFF” while the command copy(“\u{200B}”) will work for all the characters in the range “U+0000” to “U+10FFFF”.




Computer Science student 🎓👨🏻‍💻🎧