7

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?

7
  • Please, show also the contents of the log file.
    – egreg
    Oct 27, 2021 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, 2021 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, 2021 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, 2021 at 22:02
  • Don't forget the leading %
    – egreg
    Oct 27, 2021 at 22:02

1 Answer 1

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.

1
  • 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, 2021 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .