TransWikia.com

How to embed greek text in the pdf using Textstudio

TeX - LaTeX Asked by seralouk on March 15, 2021

I have generated a pdf that includes some greek text.

When I open the compiled pdf and I copy the greek sentence and then past it somewhere e.g. in a txt file, I get weird results.

Example:

I get: H arq thc sofÐac eÐnai h anaz thsh.

Instead of: H αρχή της σοφίας είναι η αναζήτηση

How can I embed the greek text to the pdf?

For my tex documnt I use:

begin{raggedleft}
        foreignlanguage{greek}{H αρχή της σοφίας είναι η αναζήτηση}. 
     ---  foreignlanguage{greek}{Σωκράτης}
end{raggedleft}

One Answer

texstudio is just the editor you used to write the file so is not involved, other than to make sure you save in UTF-8.

You did not provide any example or show if you got an error in the log file so hard to give specific help other than say that this produces the expected result:

From xelatex or lualatex cut and paste should work by default but for pdftex you need to enable the glyph to unicode mapping with the two lines as below, until the next release when they will be enabled already in the latex format.

enter image description here

If I cut and paste from xpdf to here I get

Some text.
Η αρχή της σοφίας είναι η αναζήτηση.
— Σωκράτης

Source file:

documentclass{article}

usepackage[LGR,T1]{fontenc}
usepackage[greek,english]{babel}

input{glyphtounicode}
pdfgentounicode=1

begin{document}

Some text.

begin{raggedleft}
        foreignlanguage{greek}{H αρχή της σοφίας είναι η αναζήτηση}. 
     ---  foreignlanguage{greek}{Σωκράτης}
end{raggedleft}
end{document}

Correct answer by David Carlisle on March 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP