# MakeIndex (first time user) on TeXMaker

I've looked online for how to create an index on LaTeX, and honestly, I have no idea why there isn't any good documentation on it. This reminds me of the time when I was trying to learn how to create a bibliography [on BibTeX, that is] and I spent at least 3 days just trying to figure it out due to just poor documentation online.

Anyway, here's my MWE:

\documentclass[12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath, amssymb, enumitem}
\usepackage [english]{babel}
\usepackage{icomma} %no space after commas
\usepackage{imakeidx}%for indexes
\makeindex%for indexes
\setlength{\parindent}{0pt}
\newcommand{\E}{\text{E}}
\newcommand{\Var}{\text{Var}}
\begin{document}
\textbf{Notation}. We write $\mu^{\prime}_{k} = \E\left[X^{k}\right]$, known as the \textbf{$k$th raw moment}\index{raw moment} and $\mu_{k} = \E\left[\left(X-\mu\right)^{k}\right]$, known as the \textbf{$k$th central moment}\index{central moment}.

\printindex
\end{document}


I ran LaTeX -> MakeIndex -> PDFLaTeX and this works fine. But typically, I have more in the Preamble:

\documentclass[12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath, amssymb, enumitem}
\usepackage [english]{babel}
\usepackage[utf8]{inputenc}
\usepackage [autostyle, english = american]{csquotes}
\usepackage{icomma} %no space after commas

\usepackage{imakeidx}%for indexes
\makeindex%for indexes

\MakeOuterQuote{"}
\setlength{\parindent}{0pt}
\pagenumbering{gobble} %remove page numbers
\frenchspacing %no space after periods
\usepackage{graphicx}
%put photo in same folder, do \includegraphics{"file name"}

\newcommand{\E}{\text{E}}
\newcommand{\Var}{\text{Var}}
\begin{document}
\textbf{Notation}. We write $\mu^{\prime}_{k} = \E\left[X^{k}\right]$, known as the \textbf{$k$th raw moment}\index{raw moment} and $\mu_{k} = \E\left[\left(X-\mu\right)^{k}\right]$, known as the \textbf{$k$th central moment}\index{central moment}.

\printindex
\end{document}


This doesn't work for generating the index if I run LaTeX -> MakeIndex -> PDFLaTeX. Why is that? I assume there's probably a conflict between inputenc and some other package.

-
How is LaTeX supposed to produce an index if you don't have any page numbers? – cfr Jul 26 '14 at 23:40
WOW, lol. Thank you! – Clarinetist Jul 26 '14 at 23:41
It is always easier to spot the obvious in other people's code ;) ! Did that work? I don't say everything else is fine. Just that stood out as at least one stumbling block... – cfr Jul 26 '14 at 23:48
Yep, that worked! Thank you @cfr! – Clarinetist Jul 26 '14 at 23:56

In order to produce an index, LaTeX needs page numbers. So you need to remove the line

\pagenumbering{gobble} %remove page numbers


Then

\documentclass[12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath, amssymb, enumitem}
\usepackage [english]{babel}
\usepackage[utf8]{inputenc}
\usepackage [autostyle, english = american]{csquotes}
\usepackage{icomma} %no space after commas

\usepackage{imakeidx}%for indexes
\makeindex%for indexes

\MakeOuterQuote{"}
\setlength{\parindent}{0pt}
\frenchspacing %no space after periods
\usepackage{graphicx}
%put photo in same folder, do \includegraphics{"file name"}

\newcommand{\E}{\text{E}}
\newcommand{\Var}{\text{Var}}
\begin{document}
\textbf{Notation}. We write $\mu^{\prime}_{k} = \E\left[X^{k}\right]$, known as the \textbf{$k$th raw moment}\index{raw moment} and $\mu_{k} = \E\left[\left(X-\mu\right)^{k}\right]$, known as the \textbf{$k$th central moment}\index{central moment}.

\printindex
\end{document}


produces

-