LaTeX forum ⇒ 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

Postby swede.anka » Mon Jan 12, 2009 1:29 pm

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

My file look like this (example):
  1. \documentclass[a4paper]{report}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[swedish]{babel}
  4. \usepackage{makeidx} % Används för att kunna skapa index
  5. \usepackage{color}
  6. \usepackage{anysize}
  7. \marginsize{3cm}{2cm}{1cm}{1cm}
  8. \usepackage{amssymb, amsmath}
  9. \usepackage{graphicx}
  10. \setlength{\parindent}{0pt} % 0 pt = indrag
  11. \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.
  12.  
  13. \makeindex % Skapar index filen
  14.  
  15. \begin{document}
  16.  
  17. \textbf{Singulariteter:} Om en \index{graf} går mot $\pm\infty$\\
  18. Vill få en ekvation som är på formen $y=ax+b$\\
  19. \index{test}
  20.  
  21. \printindex % Skriver ut index listan i dokumentet
  22. \end{document}


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 :?

Stevie Hair
Posts: 2
Joined: Tue Jan 06, 2009 6:05 am

Postby Stevie Hair » Tue Jan 13, 2009 5:48 am

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

Postby swede.anka » Sat Jan 17, 2009 2:58 pm

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

Postby demon » Sat Feb 21, 2009 9:24 pm

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: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Feb 22, 2009 8:23 pm

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.
  1. How to put a word\index{word} into the index.

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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Postby demon » Mon Feb 23, 2009 10:40 am

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: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Mon Feb 23, 2009 10:44 am

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.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Postby demon » Mon Feb 23, 2009 11:18 am

All right, thanks. I hoped there's an automatic solution in LaTeX. :roll:

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Mon Feb 23, 2009 6:21 pm

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.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

demon
Posts: 26
Joined: Thu Nov 27, 2008 3:45 pm

Postby demon » Mon Feb 23, 2009 6:43 pm

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.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest