5

Using a solution provided by @egreg, I am experiencing some strange output when using the code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{lmodern}

\begin{document}

This is in English, but we also have
\textgreek{μια φράση στα ελληνικά}

\end{document}

When I compile, the output I get has semicolons in the place of the Greek letters:

enter image description here

My log file:

enter image description here

Any thoughts?

8
  • Welcome to TeX.SE!
    – Mensch
    Oct 27 at 21:49
  • Please, show also the contents of the log file.
    – egreg
    Oct 27 at 21:52
  • I can’t duplicate your problem, but here is another solution that might work for you,. It also lets you leave out \textgreek.
    – Davislor
    Oct 27 at 21:53
  • What happens if you add % !TEX encoding = UTF-8 Unicode at the very beginning of the file, save and rerun LaTeX?
    – egreg
    Oct 27 at 21:56
  • @egreg I'm a little confused...I can't just write TEX encoding=UTF-8 Unicode in my preamble, can I?
    – Sam Y.
    Oct 27 at 22:02
5

For strange reasons, TeXShop by default saves files in ISO-Latin-9 encoding. Indeed, if I run the following file

% !TEX encoding = IsoLatin9

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{lmodern}

\begin{document}

This is in English, but we also have
\textgreek{μια φράση στα ελληνικά}

\end{document}

I get the semicolons.

Change the first line to

% !TEX encoding = UTF-8 Unicode

and the problem will disappear.

Also go to the preferences and change the default encoding:

enter image description here

The relevant drop-down menu is under “Encoding”. This will save all files in UTF-8.

2
  • 1
    It’s an extremely poor choice for TexShop to save in a format other than the default that LaTeX expects, but even worse to lose data when it saves and not even warn the user about it.
    – Davislor
    Oct 27 at 22:06
  • 1
    @Davislor I fully agree.
    – egreg
    Oct 27 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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