MakeIndex, Nomenclature, Glossaries and AcronymsHow do I create index

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
swede.anka
Posts: 2
Joined: Mon Jan 12, 2009 1:10 pm

How do I create index

Post by swede.anka »

Im using TeXShop on Mac and want to create a index in a document.

My file look like this (example):

Code: Select all

Code, edit and compile here:
\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[swedish]{babel}
\usepackage{makeidx} % Används för att kunna skapa index
\usepackage{color}
\usepackage{anysize}
\marginsize{3cm}{2cm}{1cm}{1cm}
\usepackage{amssymb, amsmath}
\usepackage{graphicx}
\setlength{\parindent}{0pt} % 0 pt = indrag
\pagestyle{headings} %Anger att sidnummer och kapitelrubriken anges överst på varje sida. "Plain" = endast nummer längst ner. "Empty" lämnar tomt uppe och nere.
\makeindex % Skapar index filen
\begin{document}
\textbf{Singulariteter:} Om en \index{graf} går mot $\pm\infty$\\
Vill få en ekvation som är på formen $y=ax+b$\\
\index{test}
\printindex % Skriver ut index listan i dokumentet
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
When i compile this it creates a file "filename".idx
Then I have read that i´m supposed to create a file "filename".ind with the command called makeindex.
But where do I do that? In the file or with som other program or what?

Please help :?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
Stevie Hair
Posts: 2
Joined: Tue Jan 06, 2009 6:05 am

Re: How do I create index

Post by Stevie Hair »

I run latex in a shell (after writting it in some sort of text editor), by typing in "latex `filename'" In the same shell I then type "makeindex `filename'" and then "latex `filename'" again. This does the job. If you've got fancier front end where you just press a button somewhere, then I don't know I'm afraid. I take it you've tried hunting through the menu's ?
swede.anka
Posts: 2
Joined: Mon Jan 12, 2009 1:10 pm

How do I create index

Post by swede.anka »

Stevie Hair wrote: If you've got fancier front end where you just press a button somewhere, then I don't know I'm afraid. I take it you've tried hunting through the menu's ?
I found the way to do it in TeXshop. Every time i compile the code i press a button called "typeset". Next to that button there is a dropdown menu where i can change to makeindex, then i "typeset" it and finally i change the dropdown menu back to latex and then i "typeset" it one last time.
Finished
demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Re: How do I create index

Post by demon »

Hi there,

I've got a minor question on the same topic: If I define a word as an index, do I need to put any instance of this word to the index by hand? Is there some kind of automatic indexing?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How do I create index

Post by localghost »

demon wrote:[...] If I define a word as an index, do I need to put any instance of this word to the index by hand? [...]
I wonder what you mean with "instance" in this context. Just use the makeidx package, add a word to the index and run makeindex on your document.

Code: Select all

How to put a word\index{word} into the index.
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
There's nothing more to do except you want to give the index another format. Then you have to create an index style file on your own.


Best regards
Thorsten¹
demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Re: How do I create index

Post by demon »

I'll try to explain with an example: Let's take the word 'LaTeX'. It appears 10 times on various pages inside the thesis. Do I need to put an '\index{}' around very appearance, or just the first one?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: How do I create index

Post by localghost »

Of course you have to mark it at every place where it appears. You could use the search-and-replace function of your editor to do that.
demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Re: How do I create index

Post by demon »

All right, thanks. I hoped there's an automatic solution in LaTeX. :roll:
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How do I create index

Post by localghost »

demon wrote:[...] I hoped there's an automatic solution in LaTeX. [...]
I sometimes wonder what people expect from LaTeX. I don't know any other software that makes creating an index easier.
demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Re: How do I create index

Post by demon »

Well, if I would do a simple search&replace, why just can't LaTeX do that for me. Ok, it's not too much work with my six chapters, but how with a book, 20-30 chapters? Search&replace in each file can be really annoying.
Post Reply