I have .tex document into which "thinspace" was inserted, most likely while copying text from another document.

I am currently using \DeclareUnicodeCharacter{2009}{\,} to skip over this occurrence. Is it possible to search and delete this character from the document itself as it is not required.

I am using a Linux Mint 20.1, pdflatex and Texmaker as the frontend.


3 Answers 3


You should be able to remove the character in any editor, but as you are on linux so probably have perl, you could use a commandline script:

perl -C -p -e 's/\x{2009}//g' file.tex > file-new.tex

will make a version of the file with all U+2009 removed.


If you are using a Unicode engine (XeTeX or LuaTeX) then you can set this character as ignored in TeX processing:

\catcode`\^^^^2009 = 9

since you are on linux, the good old Stream EDitor (sed)

sed -i 's/old-text/new-text/g' input.tex

or the more friendly to handle rpl

rpl "old-text" "new-text" --encoding UTF-8 -q input.tex

would be my choice if you have to do it on the command line.

for some more possible ways on linux have a look at unix.stackexchange.com

otherwise, just use your text editor of choice.

Not the answer you're looking for? Browse other questions tagged .