5

MWE:

\documentclass[a4paper,12pt]{report}

\usepackage{geometry}

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

\begin{document}

\selectlanguage{english}
\uppercase{\textgreek{τα κεφαλαία δεν δουλεύουν}}

\selectlanguage{greek}
\uppercase{τα κεφαλαία δεν δουλεύουν}

\end{document}

Output:

uppercase doesnt work

As it can be seen the \uppercase command doesn't seem to work with greek characters, or it seems to work partly.

  • With a recent (less than two years) TeX distribution, loading LGR is not necessary. – egreg Jun 3 '17 at 17:30
  • @egreg So only \usepackage[T1]{fontenc} is needed, or is that unnecessary too? – svart Jun 3 '17 at 17:34
  • That's not required too, if the language with Latin alphabet you use is English. – egreg Jun 3 '17 at 17:39
4

You should use \MakeUppercase instead of \uppercase:

\documentclass[a4paper,12pt]{report}

\usepackage{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}
\usepackage[english,greek]{babel}

\begin{document}

\selectlanguage{english}
\uppercase{\textgreek{τα κεφαλαία δεν δουλεύουν}}

\selectlanguage{greek}
\uppercase{τα κεφαλαία δεν δουλεύουν}

\MakeUppercase{τα κεφαλαία δεν δουλεύουν}

\end{document}

enter image description here

  • \MakeUppercase works! But, why doesn't \uppercase work? – svart Jun 3 '17 at 17:31
  • @egreg: Done already before you commented ;-) – user31729 Jun 3 '17 at 17:31
  • @svart: \MakeUppercase expands its argument: τ etc. are actually no characters but macros here, \uppercase alone will not extract the full information of those macros and look for the relevant upper case version. – user31729 Jun 3 '17 at 17:34
3

To complement Christian’s answer, let me recall what \uppercase does.

When you do \uppercase{<text>}, the characters in <text> (as opposed to commands) are converted to their uppercase equivalent as established by a vector loaded into memory.

For example, a will turn into A, because the vector contains, at the slot 0x61 the value 0x41; on the other hand commas and so on will not change, because in the corresponding slots the vector has 0 (which is the marker telling TeX not to change the character).

Now, for LaTeX, a tau is not a single character, but two (due to UTF-8), precisely the characters in slots 0xCF and 0x84 (hexadecimal).

Here is the correspondence table when LaTeX starts up:

80->80    81->81    82->82    83->83    84->84    85->85    86->86    87->87
88->88    89->89    8A->8A    8B->8B    8C->8C    8D->8D    8E->8E    8F->8F

90->90    91->91    92->92    93->93    94->94    95->95    96->96    97->97
98->98    99->99    9A->9A    9B->9B    9C->9C    9D->9D    9E->D0    9F->0

A0->80    A1->81    A2->82    A3->83    A4->84    A5->85    A6->86    A7->87
A8->88    A9->89    AA->8A    AB->8B    AC->8C    AD->8D    AE->8E    AF->8F

B0->90    B1->91    B2->92    B3->93    B4->94    B5->95    B6->96    B7->97
B8->98    B9->99    BA->9A    BB->9B    BC->9C    BD->0     BE->0     BF->0

C0->C0    C1->C1    C2->C2    C3->C3    C4->C4    C5->C5    C6->C6    C7->C7
C8->C8    C9->C9    CA->CA    CB->CB    CC->CC    CD->CD    CE->CE    CF->CF

D0->D0    D1->D1    D2->D2    D3->D3    D4->D4    D5->D5    D6->D6    D7->D7
D8->D8    D9->D9    DA->DA    DB->DB    DC->DC    DD->DD    DE->DE    DF->DF

E0->C0    E1->C1    E2->C2    E3->C3    E4->C4    E5->C5    E6->C6    E7->C7
E8->C8    E9->C9    EA->CA    EB->CB    EC->CC    ED->CD    EE->CE    EF->CF

F0->D0    F1->D1    F2->D2    F3->D3    F4->D4    F5->D5    F6->D6    F7->D7
F8->D8    F9->D9    FA->DA    FB->DB    FC->DC    FD->DD    FE->DE    FF->DF

(just the characters beyond 0x7F are shown here). There are reasons behind these values, but it would take too long to explain them.

Anyway, you see that 0xCF and 0x84 don't change, so a tau will remain unchanged. On the other hand a kappa is input as 0xCE and 0xBA; the first part doesn't change, the second one becomes 0x9A and the combination 0xCE followed by 0x9A in UTF-8 is indeed an uppercase Greek kappa.

There's no way this can work for every UTF-8 character; moreover, control sequences would remain the same, which would be a nuisance for other languages (for instance, in German \ss should become \SS, for proper output).

Thus LaTeX has introduced \MakeUppercase that “does the right thing”, using \uppercase in some cases, a different conversion table in others.

Similarly, \lowercase should not be used in LaTeX: the correct command is \MakeLowercase.

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.