[Tex/LaTex] Index sorted in alphabetical order

indexing

I'd like to know why does my index prints in an alphabetical order.

enter image description here

EDIT:

\documentclass[a4paper]{article}
\usepackage[portuguese]{babel}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[export]{adjustbox}
\usepackage{makeidx}

\makeindex




\begin{document}

\setlength{\textwidth}{16cm}
\setlength{\textheight}{22cm}

\title{....} %stuff here

\author{....} %more stuff

\maketitle
\thispagestyle{empty}

\newpage

\printindex

\section{Introdução}
\index{Introdução}


\begin{small}
\onehalfspacing

Introduction text

\end{small}

%\sections all over the document in \index{Introduction}

\end{document}

Best Regards

Best Answer

This is usual for an index. Indeed, this is, really, the whole point of an index: people can find stuff provided they know the relevant alphabet.

The index usually comes at the end of a document, especially a book or other longer document. It contains a list of key words and topics with a list of page numbers showing where those words and topics appear in the body of the text.

I strongly suspect that the problem is that you do not really want an index at all. I think that you probably want to produce a table of contents instead.

The table of contents usually comes near the beginning of a document and lists the main divisions of the document in the order in which they appear, usually with the page number on which each section starts. This might include chapters, sections etc.

For example:

toc

If that's what you want, that is actually much easier than an index:

\documentclass[a4paper,portuguese]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[width=160mm,height=220mm]{geometry}
\begin{document}
\title{....} %stuff here

\author{....} %more stuff

\maketitle
\thispagestyle{empty}

\newpage

\tableofcontents

\section{Introdução}

Some text.

\section{Bulbous Brandishes}

Some more.

\section{Aardvark Antics}

Yet further stuff.

\end{document}
Related Question