Search code examples
latextexmaker

How to disable numbering in latex?


I am new to latex and I wrote the below tex code on Texmaker editor.

What I want to do is to add the "University" section without any numbering preceeding it and to be centered horizontally, because when I run the code I find that the word "University" is displayed but it is preceeded by a number and I do not want to display any number preceeding that word.

code:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\section{University}
\end{document}

Solution

  • All you have to do is to edit your line 9:

    \section{University}
    

    this way:

    \section*{\centering University}
    

    since the command \section* produces unnumbered sections.

    Further, if you want to to include an unnumbered section to your table of contents, you can add

    \addcontentsline{toc}{section}{University}
    

    (this time without \centering) just after. The resulting code:

    \documentclass[12pt,a4paper]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[english]{babel}
    \usepackage{graphicx}
    \usepackage{kpfonts}
    \author{Anan}
    \pagestyle{plain}
    \begin{document}
    \tableofcontents
    \section*{\centering University}
    \addcontentsline{toc}{section}{University}
    Text.
    \end{document}