TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to create a horizontal space in LaTeX that is visible to the reader but invisible to the computer when selecting and copying text (using PDFLaTeX)?

An example of the problem: When I read a PDF that has a bank account number in it and I want to manually type/write it into a banking form, it helps a lot to have regular spacing in the number, e.g. "Bank Account no. 123 456 789". However, when I use online banking, the form field does not expect spaces in the number and additionally has a limited length. So when I copy&paste the number from the PDF, all I get in the form field is "123 456 7", because it's limited to 9 characters and it copied the spaces.

So the question is: Can I get LaTeX to show spaces that help readability but that are not selected/copied when copying the text? I still want to read "123 456 789", but when I select and copy that text, I want "123456789" in my clipboard.

I searched for spacing-related topics and tutorials, but only found the usual commands (such as \hspace or \hskip). Using tables or arrays does not help either, there's always a selectable space or even a newline.

Thanks a lot in advance for any help!

share|improve this question
You can use the accsupp package to provide alternative text: tex.stackexchange.com/a/18509/2388 – Ulrike Fischer Feb 6 '14 at 10:18
Thank You very much! – Fred Feb 6 '14 at 17:57
up vote 18 down vote accepted

You can use the accsupp package to specify which text should be copied:


Account number: \BeginAccSupp{ActualText=123456789}%
123 456 789%

A quick test suggests that this works with pdflatex and lualatex, but not with xelatex.

share|improve this answer
Does it work with PdfLaTeX, XeLaTeX, LuaLaTeX or all of them? I'm just asking since this information might turn out helpful. – yo' Feb 6 '14 at 10:21
@tohecz: Good point. I've edited my answer. – Jake Feb 6 '14 at 10:28
Also, does this work with all PDF viewers or only some? I guess you can't know that, but which did you test? I know they often behave different with respect to what is copied. – cfr Feb 6 '14 at 17:15
Thanks a lot! This solution is perfect! I tested it with evince, okular and Adobe Reader on Linux and it works with all of them (though okular swallows a space sometimes, apparently). – Fred Feb 6 '14 at 17:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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