GeneralIndex, glossary, reference and bibliography

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Index, glossary, reference and bibliography

Post by jannetta »

Hi there folks

Now that I have sorted my front page out with the help of all the kind people in the forum, I'd like to get onto the next problem.

I wish to include an index, glossary, reference section and bibliography in my document. How do I go about doing this? I have the glossary working, but not the index. I have the reference section working, but if I try to also add a bibliography, my reference section turns into the bibliography. The reference section off course should only include cited references while the bibliography should include everything in my BibTex file.

Below is my MWE:

Code: Select all

\documentclass[a4paper,12pt]{report}
\usepackage[cleanlook, english]{isodate} % for formatting the date of \today
\usepackage{natbib} % Use the natbib bibliography and citation package
\usepackage{xcolor} % Driver-independent color extensions for LaTeX and pdfLaTeX.
\usepackage{hyperref}
\usepackage{appendix}
\usepackage{makeidx}
\makeindex
\usepackage[style=altlist]{glossary}
\makeglossary

\begin{document}
\begin{titlepage}
\centering
\vspace*{11\baselineskip}
\large 
\bfseries
Big Title\\
\normalfont
\small
Sub Title\\
\vfill
My Name\\
(student number)\\[2\baselineskip]
\textbf{\today}\\[2\baselineskip]
Word Count: {\color{red}\input{wordcount2.tex}}\\
\end{titlepage}

\setcounter{page}{1}
\renewcommand{\thepage}{\roman{page}}

\newpage
\addcontentsline{toc}{chapter}{Preface}
\subsection*{Preface}
Thanks to this one, that one, and the other one.\\
\tableofcontents
\listoftables
\listoffigures
\newpage
\begin{abstract}
An abstract
\end{abstract}

\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{page}}
\chapter{One}
The\index{the} quick\index{quick} brown\index{brown} fox\index{fox} \cite{Gamma2007}.

\chapter{Two}
The quick brown fox. SOC is explained in the glossary.\glossary{name={SOC}, description={Service Oriented Computing, also known as SOA or Service Oriented Architecture, focuses on the development and integration of systems to provide business processes. The systems are packaged as interoperable services}}.

%index
\newpage
\printindex

%glossary
\newpage
\addcontentsline{toc}{chapter}{Glossary}
\printglossary

%appendices
\appendix
\appendixpage
\addappheadtotoc
\chapter{one}
The quick brown fox.
\chapter{two}
The quick brown fox.

%References
\newpage
\addcontentsline{toc}{chapter}{References}
\bibliography{M801_References}
\bibliographystyle{dcu}

\end{document}
I create my pdf document in a Fedora Core 4 environment with the following script.

Code: Select all

1 #!/bin/sh
      2 rm *.bbl
      3 rm $1.pdf
      4 rm *.aux
      5 rm *.glo
      6 rm *.glg
      7 rm *.ist
      8 rm *.blg
      9 rm *.gls
     10 rm *.toc
     11 rm *.log
     12 rm wordcount.tex
     13 ./texcount_2_1.pl -1 Introduction.tex Aim.tex Contribution.tex BodyOfKnowledge.tex RESTful_POG.tex > wordcount.tex
     14 cat wordcount.tex |sed 's/\([0-9]*\)+.*/\1/' > wordcount2.tex
     15 pdflatex -interaction=scrollmode --src-specials $1.tex
     16 bibtex $1
     17 pdflatex -interaction=scrollmode --src-specials $1.tex
     18 makeindex -s $1.ist -t $1.glg -o $1.gls $1.glo
     19 pdflatex -interaction=scrollmode --src-specials $1.tex
The first few lines just remove all temporary files and the pdf etc. I like to start clean to make sure things are done properly and we aren't left with any artifacts from the previous compilation that mess things up. I then use texcount, a perl script, to count my words in the files that I want included in the word count. texcount returns a few things that I don't want, so I use sed to strip the unwanted off. That leaves me with wordcount2.tex and just the word count. I include this file in the MWE above.

The next few lines, I have to admit, I only have a very basic understanding of. When I started with LaTex, I was trying to use MikTex and TeXlipse and a few other things, but at best these environments were unstable so I settled on the way I work now, which works every time. (Plus the main advantage is that when my legal paid for M$ decides to go blue screen of death for a few weeks, my free pendrive installation of Puppy Linux still works perfectly :D ). Anyway, lines 15 to 19 were just copied from the original environments and I just carried on doing it that way because it worked! I think what I'm doing is to create a pdf from the tex files with pdflatex, then run bibtex to create the bibliography, run pdflatex again to include the bibliography, run makeindex to create the glossary and then run pdflatex again to include that in the pdf doc. It would be great if someone could confirm or explain this in more detail.

Well, I hope that is enough information. If I have left anything out, please just ask.

Thank you very much in advance for any help
Kind Regards
Jannetta

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Index, glossary, reference and bibliography

Post by gmedina »

Hi,

the multbib package can take care of the two bibliographical sections. Please refer to the package documentation for further information (the example on page 4 can be particularly useful).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Index, glossary, reference and bibliography

Post by jannetta »

gmedina wrote:
the multbib package can take care of the two bibliographical sections. Please refer to the package documentation for further information (the example on page 4 can be particularly useful).
Looking at multibib, I found a reference to bibtopic. bibtopic seems to generate the perfect reference and bibliography except for one thing. It is not using the correct style. I need it to use dcu, but when I specify it totally messes up both sections. I'll attach one page here so you can see what it does.
Attachments
refsection.pdf
(23.4 KiB) Downloaded 228 times
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Index, glossary, reference and bibliography

Post by nlct »

Hi,

The reason your index hasn't appeared is because you haven't created it using makeindex (you've only used makeindex to create the glossary). So you need to add the following line before or after line 18:

Code: Select all

makeindex $1.idx
Note that the glossary package is obsolete and is no longer supported. It's been replaced by the glossaries package which is much more flexible and less likely to go wrong. So you can replace

Code: Select all

SOC is explained in the glossary.\glossary{name={SOC}, description={Service Oriented Computing, also known as SOA or Service Oriented Architecture, focuses on the development and integration of systems to provide business processes. The systems are packaged as interoperable services}}.
with the following in the preamble[*]

Code: Select all

\newglossaryentry{soc}{name={SOC},description={Service Oriented Computing, also known as SOA or Service Oriented Architecture, focuses on the development and integration of systems to provide business processes. The systems are packaged as interoperable services}}
and then in the text, either:

Code: Select all

SOC is explained in the glossary.\glsadd{soc}
or

Code: Select all

\gls{soc} is explained in the glossary.
You will also need to replace \usepackage[style=altlist]{glossary} with

Code: Select all

\usepackage[style=altlist,toc]{glossaries}
and replace \makeglossary with \makeglossaries

If you use the toc package option (as in the above code) you don't need

Code: Select all

\addcontentsline{toc}{chapter}{Glossary}
Line 18 in your script can then be changed to

Code: Select all

makeglossaries $1
You may need to move the second pdflatex after you make the glossary and index to ensure the table of contents is correct.

Regards
Nicola Talbot

* With the newer versions, \newglossaryentry doesn't have to go in the preamble
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Index, glossary, reference and bibliography

Post by jannetta »

Hi Nicola

Thank you very much for your post. I did come across the glossaries package in my searches yesterday, but I thought I'd just try to stick to what I thought was working. However after your detailed explanation I thought I'd feel guilty if I didn't at least try to use it. So I did :D , but I ran into a problem :cry: .

Firstly I downloaded the package from http://www.ctan.org/tex-archive/macros/ ... /glossary/.

Then I unzipped it into my working directory. I have been lazy so for the moment all these new packages I'm playing with have just been going into my working directory. I then did latex glossary.ins

like it says in the documentation. I also searched and downloaded the makeglossaries perl script. But the glossaries.sty file is missing. So, I'm stuck ...

... please help!!
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Index, glossary, reference and bibliography

Post by jannetta »

Oh duh! Ignore me for a while. I discovered I haven't downloaded glossaries.zip only glossary.zip
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Index, glossary, reference and bibliography

Post by localghost »

jannetta wrote:Oh duh! Ignore me for a while. I discovered I haven't downloaded glossaries.zip only glossary.zip
The modern LaTeX distributions (MiKTeX, TeX Live) come with a package manager that makes installation of packages very easy. But you didn't yet write anything about the distribution you are using.


Best regards
Thorsten¹
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Index, glossary, reference and bibliography

Post by jannetta »

localghost wrote:But you didn't yet write anything about the distribution you are using.
I think I did somewhere else, but I don't remember where. I'm running latex on a Fedora Core 4 machine. For the moment my work station is running XP, but I hate Windows with a passion which is probably why it dies on me every so often. If not the operating system then the software on it. I use JabRef for my bibliography and Texmaker and vi as my editors because these apps will run on whatever operating system is running at the time (especially vi :D ).

I have been installing the packages the long way. Read the README or INSTALL file and then do what it says.
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

Re: Index, glossary, reference and bibliography

Post by jannetta »

Oh it's working (well at least on my MWE), despite my "moment". I can go to bed now.

Thank you so much for your help!

Regards
Jannetta
Post Reply