0

This question already has an answer here:

I am writing articles using Kile on Windows 7. I have a problem with search in the output file. For some reason, Okular doesn't recognize the text. Trying to copy something with the option text selection tool returns rubbish, for example this is the copypaste of the word 'Conditionally': ❈♦♥❞✐t✐♦♥❛❧❧2, and this is the copypaste of the word 'some': s♦♠❡.

How do I make Okular to correctly recognize a piece of text?

Edit. This is a working example:

\documentclass[11pt]{article}

\usepackage[T1]{fontenc}

\begin{document}
   Minimal example
\end{document}

The output as a PDF file looks fine, but copying it gives ▼✐♥✐♠❛❧ ❡1❛♠♣❧❡. I use PDFLaTeX + ViewPDF, the selected configuration for the tool ViewPDF is Okular unique.

marked as duplicate by Martin Schröder, Mensch, Claudio Fiandrino, Mico, Maarten Dhondt Jun 15 '16 at 18:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    It would help if you would post a mwe for us to look at and try and reproduce your problem. Additionally know what you use to compile your doc would also be useful. That being said, this looks like an encoding problem and adding \usepackage[T1]{fontenc} to your preamble may fix your issue. – ArTourter Jun 7 '16 at 22:08
  • inputenc and fontenc have two completely different roles and can (should) be use together. inputenc describes the character encoding used in your source file. Whereas fontenc describes the font encoding in the output. I am not quite sure why replacing fontenc with inputenc would solve the problem when your mwe doesn't use any characters outside of ascii, unless Kile was messing things up for you. I would use both, your inputenc and the fontenc line in your code if you can. – ArTourter Jun 8 '16 at 1:02
  • I agree with @ArTourter That solution doesn't make any sense. In any case, please do not edit questions to include answers. If somebody suggests something in a comment which works, ask them to write an answer. Or, if you discover the solution yourself, answer your own question. This way things are tidier and easier to navigate. – cfr Jun 8 '16 at 1:07
  • For what it is worth, it works for me in Okular, compiling the original MWE in Kile using pdfLaTeX. It also works if I remove fontenc as well. It works no matter what. It's only ASCII, after all, so this isn't surprising. – cfr Jun 8 '16 at 1:08
0

Tnank ArTourter for suggestion about encoding. Replacing \usepackage[T1]{fontenc} with \usepackage[utf8]{inputenc} in the above example produces desired outcome.

I found this by chance. ArTourter also commented that inputenc and fontenc have completely different roles. However, if I just add \usepackage[utf8]{inputenc} to the original code not taking out \usepackage[T1]{fontenc}, I still get garbage copypaste. Maybe it has something to do with Windows?

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