1

I am trying to load many definitions from a separate file into my main file. I tried:

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[doublespacing]{setspace}
\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}

\makeglossaries
\setacronymstyle{long-short}
\loadglsentries{glossary.tex}
\begin{document}

    \tableofcontents
    \listoffigures

    \singlespacing
    \printglossary[type=acronym,style=long]
    \doublespacing
    \input{Introduction/intro.tex} % Introduction

\end{document}

I have even tried:

\printglossary[title={List of Abbreviations}]

where glossary.tex is:

\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum dolor}
\newacronym[type=\glsdefaulttype]{stc}{STC}{sit amet consectetuer}

and everytime I try to compile and run this I get following error:

Package glossaries Error: Glossary type `acronym' has not been defined. }

It's getting very frustrating. What am I doing wrong?

EDIT 1 Since I have many other packages that can cause any conflicts I paste the actual packages I use in my main.tex

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage{amsthm}
\usepackage{chngcntr}
\usepackage{caption}
\usepackage{bm}
\usepackage[doublespacing]{setspace}
\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}
\usepackage{pdfpages}
\usepackage{subcaption}
\usepackage{color}   %May be necessary if you want to color links
\usepackage{hyperref}
\hypersetup{
    colorlinks=true, %set true if you want colored links
    linktoc=all,     %set to all if you want both sections and subsections linked
    linkcolor=black,  %choose some color if you want links to stand out
    citecolor=black,    
}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\usepackage{lmodern,textcomp}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{placeins}
\usepackage{float}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage[subnum]{cases}
\setcounter{chapter}{0}
\theoremstyle{definition}
\newtheorem{exmp}{Example}[section]
%-------------------- Assumptions -----------------------%
\newtheorem{assumption}{Assumption}

% Glossaries
\makeglossaries
\setacronymstyle{long-short}
\loadglsentries{glossary.tex}

    \begin{document}
        \lstset{frame=tb,
            language=Matlab,
            aboveskip=1mm,
            belowskip=1mm,
            showstringspaces=false,
            columns=flexible,
            basicstyle={\small\ttfamily},
            numbers=none,
            numberstyle=\tiny\color{gray},
            keywordstyle=\color{blue},
            commentstyle=\color{dkgreen},
            stringstyle=\color{mauve},
            breaklines=true,
            breakatwhitespace=true,
            tabsize=3
        }
        \includepdf [pages={1}]{title/kth-cover1680268267433659770.pdf}
        \input{abstract/abstract.tex} % Abstract
        \input{acknowledgments/acknowledgments.tex} % Acknowledgments
        \newpage
        \input{Thankyou/xaxa.tex}
        \cleardoublepage
        \pagenumbering{roman} 
        \tableofcontents
        \listoffigures


        \printglossary[title={List of Abbreviations}]


        \cleardoublepage
        \pagenumbering{arabic}
        \newpage 
%--------------------PAGE DESIGN-------------------------%        
        \pagestyle{fancy}
        \fancyhf{}
        \fancyhead[ER]{\nouppercase\leftmark}
        \fancyhead[OL]{\nouppercase\rightmark}
        \fancyhead[EL,OR]{\thepage}
%--------------------PAGE DESIGN END-------------------------%        
        \input{Introduction/intro.tex} % Introduction
\end{document}

EDIT 2 I edited the \usepackage command to:

\usepackage[acronym,toc,style=super,nonumberlist]{glossaries}

The error disappeared but nothing is showing on the page

EDIT 3 Edited a line to this :

 \glsaddall
 \printglossary[type=acronym,style=long]

still nothing appears

0
1

With the revised glossaries package invocation, you need only issue \glsaddall prior to your \printglossary command.

Note that specifying type=acronym in your \printglossary will prevent the acronyms from being displayed, since they were defined with type=\glsdefaulttype. You should not use type=acronym in your \printglossary command. The style=long option is also unnecessary here. You also may as well remove type=\glsdefaulttype from the definitions, as it does not appear to serve any purpose.

Accordingly, you should issue only the following commands, instead of your current \printglossary[type=acronym, style=long] command:

\glsaddall

\printglossary

Finally, note that with your current setup, you cannot use the acronym package option when loading glossaries. The package user manual states:

acronym This creates a new glossary with the label acronym.

Since you are not presently using the package in this manner, you should omit this option.

Alternatively, depending upon the naming of your glossary file and your compilation procedure, you may want to use both the acronym and nomain options.

0
0

There is at least one, probably two and possibly three issues:

  1. As Cody Viner says, if you use type=\glsdefaulttype for the entries, you need to make sure you print the same type when you print the list of acronyms. By default, this is main.

  2. You need to run makeglossaries after compiling the document and then compile the document again.

  3. You need to use at least one acronym in the document or force the addition of all entries.

Here's an MWE:

\begin{filecontents}{glossary.tex}
\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum dolor}
\newacronym[type=\glsdefaulttype]{stc}{STC}{sit amet consectetuer}  
\end{filecontents}

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[doublespacing]{setspace}
\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}

\makeglossaries
\setacronymstyle{long-short}
\loadglsentries{glossary.tex}
\begin{document}

\tableofcontents
\listoffigures

\singlespacing
\printglossary[type=\glsdefaulttype,style=long]% note that the type here matches the type of the entries, regardless of what \glsdefaulttype expands to
\doublespacing

\chapter*{Introduction}% note that we now use some of the entries defined
\gls{lid}
\gls{stc}


\end{document}

To create the document, you need to run

pdflatex <filename>
makeglossaries <filename>
pdflatex <filename>
pdflatex <filename>

where is the name of you .tex document without the extension. pdflatex is used in this example, but you can use another engine, if that's what you need.

list of acronyms

Obviously, you probably want to change the title if you do it this way, but you already know how to do that.

0
0

Well the solution is if you want to make a glossary from a separate file you have to do as following:

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[doublespacing]{setspace}
\usepackage[acronym,nomain]{glossaries} % nomain is needed

\makeglossaries
\loadglsentries{glossary.tex} % name of the glosary file
\begin{document}

    \tableofcontents
    \listoffigures

    \glsaddall
    \printglossary[title={my list}]



\end{document}

The glossary.tex is :

\newacronym{MS}{MS}{Microsoft}
\newacronym{CD}{CD}{Compact Disc}
\newacronym{Mac}{Mac}{Short form of Apple Mac}

And then compiled it using TexStudio.

The error and non displaying behavior I got earlier was because of that I didn't have any nomain in \usepackage[acronym,nomain]{glossaries} and I didn't have any \glsaddall Thanks to @CobyViner for his guidance.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.