13

I am used to the fact that LaTeX will only know letters like ä, ö, ü, or ß if I use packages like

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

Today, I tried LaTeX on a Mac for the first time, using the MacTeX distribution and texmaker. Without writing down any packages, all umlauts and ß were accepted correctly from scratch. Why is that and will the usage of special letters without using the packages cause any problems?

Alan Munn
  • 218,180
TiMauzi
  • 841
  • 14
    Since 2018, the default encoding for files is UTF-8, so inputenc is not needed for files so encoded. You still need fontenc, though, if you want better hyphenation of words with accented and “special” characters. Note also that ucs and utf8x have been unmaintained for several years and are not recommended. – egreg Jan 22 '20 at 14:57
  • Interesting to know! There are a lot of tutorials out there still using the packages mentioned. As a relative newbie, I never noticed that these are deprecated. Thanks for advice! Is there any official documentation about when these changes happened, though? – TiMauzi Jan 22 '20 at 15:03
  • 2
    @TiMauzi Here: https://www.latex-project.org/news/latex2e-news/ltnews28.pdf All significant changes to the LaTeX kernel are announced with a LaTeX News issue, which you can find here – Phelype Oleinik Jan 22 '20 at 15:07

2 Answers2

20

Since the April 2018 release, LaTeX considers UTF-8 as default input encoding

enter image description here

enter image description here

Thus calling \usepackage[utf8]{inputenc} at the start is no longer required. If a file has a different encoding than UTF-8, the proper encoding should, of course, be declared.

The utf8x add-on, together with the ucs package, used to be needed for some special application or, mostly, for typesetting Greek. The situation has very much changed and utf8x should be avoided (also ucs) as it has been unmaintained for several years and utf8 (the default) behaves much better.

On the other hand, loading fontenc is still required in order to use the T1 encoding and get better results with hyphenation of words containing accented letters or special glyphs used in European languages.

Why don't manuals and guides mention this? Because inertia prevails. :-(

egreg
  • 1,121,712
2

I don't have enough reputation to comment, but I'd like to add that in 2022 (after April 2018?) \usepackage[T1]{fontenc} is not just unnecessary but can be harmful for certain engines.

I used to include these packages in BibTex, together with \usepackage[ngerman]{babel} , following some old tutorials. ä ö ü worked fine but every ß was complied to SS.

This problem is solved by this question and an another explanition here( see https://tex.stackexchange.com/a/641959/278331)

In 2022 for unicode-aware engines as XeTex and LuaTex, just delete all of these package declarations

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

then you would be able use all letters from ä to ß in source code directly

Edit: \usepackage[ngerman] is still required for a correct hyphenation

IAN16
  • 21
  • ... if you are using an unicode-aware engine (XeTeX and LuaTeX). For pdfTeX, \usepackage[T1]{fontenc} is more or less required if you are writing anything more complicated than English – Phelype Oleinik Sep 25 '22 at 13:33
  • @ Phelype Oleinik Thank you for this introduction on difference among engines! I have corrected my answer. – IAN16 Sep 25 '22 at 13:50
  • You still need \usepackage[ngerman]{babel} or words won’t be correctly hyphenated. – Javier Bezos Sep 25 '22 at 15:25
  • @Javier Bezos Thank you I have not noticed hyphenations. I have concluded this point in the answer . – IAN16 Sep 25 '22 at 18:21