Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\begin{document}

Polska, Rzeczpospolita Polska -- państwo unitarne w Europie Środkowej,
położone między Morzem Bałtyckim na północy a Sudetami i Karpatami na południu,
w dorzeczu Wisły i Odry. Powierzchnia administracyjna Polski wynosi 312 679 km$^2$,
co daje jej 70.\ miejsce na świecie i dziewiąte w Europie.
Zamieszkana przez ponad 38,5 miliona ludzi, zajmuje pod względem liczby
ludności 34.\ miejsce na świecie, a szóste w Unii Europejskiej.

\end{document}

In Sumatra PDF when I try to copy and paste I get:

Polska, Rzeczpospolita Polska – państwo unitarne w Europie Środkowej, położone
międzyMorzemBałtyckimnapółnocyaSudetamiiKarpataminapołudniu,wdorzeczu
Wisły i Odry. Powierzchnia administracyjna Polski wynosi 312 679 km2, co daje jej
70. miejsce na świecie i dziewiąte w Europie. Zamieszkana przez ponad 38,5 miliona
ludzi, zajmuje pod względem liczby ludności 34. miejsce na świecie, a szóste w Unii
Europejskiej

In some places there is no space between words. The problem is not visible when just looking at the output pdf. It only happens when you try to copy a text.

In Acrobat Reader I don't see this problem. What is more, the problem is not present when I remove tgtermes so it is not entirely fault of the reader.

Any way to fix this?

share|improve this question
    
The line without spaces corresponds exactly to one line in the typeset text which is set very narrow. TeX doesn't really output "space characters", so I assume the reader has to guess where the word boundaries are. It seems Sumatra PDF does a bad job here. Not knowing tgtermes, I found it has an option oldspacing which makes the text come out a bit wider. Maybe this helps? Otherwise, don't use Sumatra. –  Stephan Lehmke Aug 28 '12 at 17:33
    
Ok, but I need to extract text from generated pdf file. Sumatra does it well (or would do it well if there were spaces where they should be). Acrobat reader does terrible job because if I export to pdf, there is one word per line in output file. Olso I tried some pdf to text convertors and they all have the same problem as Sumatra. –  Ichibann Aug 28 '12 at 17:36
    
BTW, oldspacing did the job. Thank you! –  Ichibann Aug 28 '12 at 17:38
    
See also this answer for a possible way to "turn on" space generation. –  Stephan Lehmke Aug 28 '12 at 17:43
    
I do not experience the problems you describe when running your MWE through TeXLive2012 and pdflatex and then view the pdf file using SumatraPDF, version 2.1.1. (I.e., all interword spaces are right where they're supposed to be.) Which version of SumatraPDF do you use? –  Mico Aug 28 '12 at 18:18
show 2 more comments

1 Answer

up vote 6 down vote accepted

The line without spaces corresponds exactly to one line in the typeset text which is set very narrow. TeX doesn't really output "space characters", so I assume the reader you're using has to guess where the word boundaries are.

It seems Sumatra PDF does a bad job here. In the tgtermes source, I found it has an option oldspacing which makes the text come out a bit wider. Maybe this helps? Otherwise, don't use Sumatra.

See also this answer for a possible way to "turn on" generation of space characters.

share|improve this answer
add comment

Your Answer

 
discard

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.