# Babel not working on OS X? [closed]

I'm using a MacBook Air, with OS X, and I have great difficulties in using Latex in my native language (serbian).

If I use the standard babel package in TexShop:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english, serbian]{babel}


And set keyboard input language to Serbian-latin, when i type letters like

ž, š, ć, etc.

I get question marks on the output pdf when I typeset it (PdfTex). As far I understand, OS X uses UTF-8 encoding, so this shouldn't happen, yet it does. Any solutions? :)

P.S. Of course, I can use \v s for š and \' c for ć, but its very tedious to write like that.

-

## closed as too localized by lockstep, Jubobs, Speravir, Kurt, Martin SchröderApr 7 '13 at 20:56

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! You should check that your text editor (what is it, by the way?) uses UTF-8. – egreg Apr 7 '13 at 19:28
do you get errors when you process the document, such as ! Package inputenc Error: Unicode char \u8:�,e not set up for use with LaTeX.  – David Carlisle Apr 7 '13 at 19:33
@egreg Yeah, I use TexShop, I figured it's the best one, but I'm open to changing it, don't really like it :) And yes, I've just seen that it uses 'Western (Mac OS Roman)' encoding. Should I change it to UTF8? At David, no, I don't get any errors. :) – Vidak Apr 7 '13 at 19:43
@Vidak Yes, change in the preferences to UTF-8. – egreg Apr 7 '13 at 19:45
@Vidak yes saving in utf-8 is probably the thing to do (although you could use an matching inputenc option instead) I guessed (wrongly) iso-8859-2 and the error I posted was what you get from your input string if you mis-label it as utf8. If the mac encoding gets through without error it's just (un)lucky and producing nonsense/ – David Carlisle Apr 7 '13 at 19:47

What encoding is used by the operating system is not relevant; the editor you use for typing LaTeX documents might use another.

This is indeed the case for TeXShop, that initially is set up to use MacOSRoman, that is, Latin-1 (or ISO 8859-1).

Check in the Preferences panel, "Source" tab: under "Encoding" you find a drop-down menu, choose Unicode (UTF-8).

Take also the habit of putting at the start of your LaTeX file the line

% !TEX encoding = UTF-8 Unicode


that will prevent encoding problems.

Here's an example document (the text is from http://sr.wikipedia.org/sr-el/Београд)

% !TEX encoding = UTF-8 Unicode
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[serbian]{babel}

\begin{document}

Beograd je glavni i najveći grad Srbije. Jedan je od
najstarijih gradova u Evropi. Prva naselja na teritoriji
Beograda datiraju iz praistorijske Vinče, 4.800 godina pre
nove ere. Sam Beograd su osnovali Kelti u 3. veku pre n. e,
pre nego što je postao rimsko naselje Singidunum. Slovensko
ime „Beligrad“ (slov.~Bjelgrad) prvi put je zabeleženo
878. godine, u čemu je sadržan utisak izgleda tadašnje
tvrđave. Beograd je glavni grad Srbije od 1405. godine i bio
je prestonica raznih južnoslovenskih država od 1918. pa
do 2003, kao i Srbije i Crne Gore od 2003. do 2006.

\end{document}


-