[Tex/LaTex] Table Of Contents Title In Uppercase Letters

table of contents

I have generated a Table of Contents in a document and I would like to make the title "Contents" in uppercase letters, i.e. "CONTENTS". All I have found searching was how to customize the entries in the table and not the title. How can this be done?

I work in ShareLaTeX with XeLaTeX and my full preamble is:

\documentclass{article}

\usepackage
[   
    top=0.7in,
    bottom=1.2in,
    left=0.8in,
    right=0.8in,
]{geometry}

\usepackage{parskip}

\setlength{\parindent}{0cm}

\usepackage{amsmath}

\usepackage{unicode-math}

\usepackage{fontspec}


\usepackage[english,greek]{babel}

\setmainfont
[
    Ligatures=TeX,
    Extension=.otf,
    UprightFont=*,
    BoldFont=*Bold,
    ItalicFont=*It,
    BoldItalicFont=*BoldIt,
    Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}

\setmathfont{latinmodern-math.otf}

\setmathfont[range=\varnothing]{Asana-Math.otf}

\setmathfont[range=\int]{latinmodern-math.otf}

\usepackage{listings}

\usepackage{multicol}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

\usepackage{tikz}

\usepackage{lipsum}

\usepackage{hyperref}

\usepackage[normalem]{ulem}

\usepackage{mdframed}

Best Answer

Normally touhami's solution should work, but the special babel settings prevent his solution.

In this case, the redefinition of the \contentsname should be shifted after \begin{document} -- this can be done with \AtBeginDocument{...}.

Another possibility should be the \addto... way. I'll try to provide this as well.

Alternatively, say

\selectlanguage{greek}
\let\mtcontentsname\contentsname
\addto\captionsgreek{\typeout{foo}\renewcommand{\contentsname}{\MakeUppercase\mtcontentsname}}

in the preamble.

I believe, using polyglossia is the better variant in conjunction with XeLaTeX instead of babel.

\documentclass{article}

\usepackage
[   
    top=0.7in,
    bottom=1.2in,
    left=0.8in,
    right=0.8in,
]{geometry}

\usepackage{parskip}

\setlength{\parindent}{0cm}

\usepackage{amsmath}

\usepackage{unicode-math}

\usepackage{fontspec}


\usepackage[english,greek]{babel}

\setmainfont
[
    Ligatures=TeX,
    Extension=.otf,
    UprightFont=*,
    BoldFont=*Bold,
    ItalicFont=*It,
    BoldItalicFont=*BoldIt,
    Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}

\setmathfont{latinmodern-math.otf}

\setmathfont[range=\varnothing]{Asana-Math.otf}

\setmathfont[range=\int]{latinmodern-math.otf}

\usepackage{listings}

\usepackage{multicol}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

\usepackage{tikz}

\usepackage{lipsum}

\usepackage{hyperref}

\usepackage[normalem]{ulem}

\usepackage{mdframed}

\AtBeginDocument{%
  \let\mtcontentsname\contentsname
  \renewcommand\contentsname{\MakeUppercase\mtcontentsname}
}
\begin{document}

\tableofcontents
\section{Foo}
\end{document}

enter image description here