# How organize definitions in a thesis document

I am writing my master thesis and I would like to define each new term with a sentence starting with keyword Definition followed by a counter and corresponding meaning of the term. for instance:

Definition 1 (Operating System).

An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. All computer programs, excluding firmware, require an operating system to function.

As there are many definitions in the documents, how can I organize them in a way that (ordered in level of importance for me) :

1. An automatic numbering for each definition is generated (more interesting if more complex format like section number followed by a counter can be used)
2. Easily generate "list of definitions" similar to "List of figures" and "List of tables" at the beginning of document
3. Making a glossary. i.e. having all definitions together with corresponding meanings at the end of document"

It can be nice if someone can also share a document with a similar format.

• Feel free to modify title and body of this question as I am somehow new with advanced feature of latex. – Woeitg Aug 26 '16 at 11:39
• Is 1st the highest order of importance? ;-) – user31729 Aug 26 '16 at 12:55
• Just some pointers: 1./2.: The KOMA classes use the tocbasic package. One can easily create floating or non-floating environments with their own counters and "list of …" with it (see the manual, chapter 15). 3. The glossaries package should be your friend here! It provides \ifglsused. I think you could use this in a formatting directive to include the float if the term has never been used before or to print just the term. – Andreas Aug 26 '16 at 13:01

Here is a tcolorbox version with nice boxes for definitions etc. There are \newtcbtheorem versions but \newtcolorbox is more flexible, in my point of view.

\documentclass{book}

\usepackage[most]{tcolorbox}

\newtcolorbox[auto counter,list inside=defs,number within=section]{definition}[2][]{title={Definition~\thetcbcounter},colback={white!30!yellow},colbacktitle={gray},coltitle=black,#1}

\newcommand{\listofdefinitions}{%
\tcblistof[\section*]{defs}{List of Definitions}
}
\begin{document}
\listofdefinitions

\chapter{Foo}

\section{Foobar}

\begin{definition}[label=latex]{On \LaTeXe}
\LaTeXe is very nice!
\end{definition}

\begin{definition}[label=MWE]{On MWE}
Providing a MWE helps
\end{definition}

\end{document}


Update with other list entry.

\documentclass{book}

\usepackage[most]{tcolorbox}

\newtcolorbox[auto counter,
list inside=defs,
number within=section]{definition}[2][]{
list entry={{\bfseries\thetcbcounter~#2}},
title={Definition~\thetcbcounter},
colback={white!30!yellow},
colbacktitle={gray},
coltitle=black,
#1
}

\newcommand{\listofdefinitions}{%
\tcblistof[\section*]{defs}{List of Definitions}
}
\begin{document}
\listofdefinitions

\chapter{Foo}

\section{Foobar}

\begin{definition}[label=latex]{\LaTeXe}
\LaTeXe is very nice!
\end{definition}

\begin{definition}[label=MWE]{MWE}
Providing a MWE helps
\end{definition}

\end{document}


Screenshot of the list:

• I run this error when running the code: LaTeX error "unknown-argument-type" Unknown argument type 'v' replaced by 'm'. Fingers crossed ... For immediate help type H <return>. ...Box{\tcboxverb}{ O{} v }{verbatim,#1}{#2} – Woeitg Aug 26 '16 at 17:10
• @Woeitg: You have to update your TeX distribution then! Apparently, it's outdated! – user31729 Aug 26 '16 at 17:20
• I had to reinstall everything to make it work and now it works! Before I accept your answer, can you fix the only problem? in the list of definitions, I would like to have name of terms instead of section+counter. Is it possible fix it? for instance in your example, it would be more proper to have "latex" and "MWE" in the list of definitions – Woeitg Aug 28 '16 at 10:44
• Here is the screenshot of list of definitions: preview.overleaf.com/public/mpbwxxdvpypr/images/… – Woeitg Aug 28 '16 at 10:47
• @Woeitg: You want something like 1.1 On LaTeXe, with the definition counter as prefix? If yes, doable ;-) – user31729 Aug 28 '16 at 10:50

Have you already looked at the amsthm package? See its documentation here.

In section 7 Other packages it refers to the thmtools package which provides a list of theorems command \listoftheorems.

A small example where one theorem definition is numbered according to the section (definitionsec) and one is numbered according to the chapter (definitionchapter) (I've used the book documentclass to allow for chapters):

\documentclass{book}

\usepackage{amsthm}
\usepackage{thmtools}

\theoremstyle{definition}
\newtheorem{definitionsec}{Definition}[section] % numbered by section
\newtheorem{definitionchapter}{Definition}[chapter] % numbered by chapter

\begin{document}

\chapter{Bar}

\begin{definitionchapter}[Operating System]
An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. All computer programs, excluding firmware, require an operating system to function.
\end{definitionchapter}

\section{Foo}

\begin{definitionsec}[Operating System]
An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. All computer programs, excluding firmware, require an operating system to function.
\end{definitionsec}

\listoftheorems

\end{document}
`

• The downside of this solution is that there are two type of definitions but in reality we need to keep track of one type. – Woeitg Aug 28 '16 at 6:18
• @Woeitg Honestly, i would have done the same since you say you want to order the defs by importance. I thought you want something like Normal note and important definition. You may want to specify your question. – Johannes_B Aug 28 '16 at 7:30
• @Woeitg: Well, I think you have to make a decision about the counting per chapter or per section, but in my opinion, that the number does say anything about the importance here. The definitions appear in an order that is determined by your thesis topic/content and are numbered as such. There are other ways to mark certain definitions as being outstanding! – user31729 Aug 28 '16 at 9:48
• @Woeitg I agree with ChristianHupfer that your text flow determines the importance. The earlier you introduce a definition the more fundamental it is and the lower its numbering. You could use markers or colors but that's from my POV inappropriate for a master thesis. – dnl Aug 28 '16 at 10:07