0

My report features Abbreviations and List of symbols in the following format:

enter image description here

enter image description here

The list of symbols has been customized to have the unit column instead of the index column. When I compile everything works, but I get numerous errors of the format (with slight variations):

Missing $ inserted.

$ l.6 ...etentrycounter[]{page}\glsnumberformat{3}}} % I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.

! Extra }, or forgotten $. @textcolor ...otect \leavevmode {\color #1{#2}#3}

I am using overleaf and pdfLaTeX. I suspect it has something to do with overriding the index with the unit column but have not been able to fix it.

MWE:

\documentclass[11pt]{report}
\usepackage[table]{xcolor}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=1.75cm,footskip=.5cm]{geometry}
\definecolor{cyan}{cmyk}{1,0,0,0}
\usepackage[colorlinks=true, allcolors=cyan, urlcolor=black, acronym=black]{hyperref}
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\color{cyan}\normalfont\huge\bfseries}{\thechapter.}{5pt}{\normalfont\huge\bfseries}
\titlespacing*{\chapter}{0pt}{-30pt}{10pt}

%%% --- Customise glossaries
\usepackage[acronym,style=super]{glossaries}
\renewcommand*{\glstextformat}[1]{\textcolor{black}{#1}} %hyperlink set to black
\renewcommand*\glspostdescription{\hfill}
\renewcommand*{\glsnamefont}[1]{\textbf{#1}} %hyperlink set to bold
\setacronymstyle{long-short} %will spell out the first occurrence using \gls{}

%%% --- make the glossaries
%% make list of symbols
\newglossary[slg]{symbolslist}{syi}{syg}{List of symbols}
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}

%% make abbreviations, load all glossaries
\makeglossaries
%\loadglsentries{glossary}  %avoided for MWE 


%%% ---  Define List of Symbols style
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
  \begin{longtable}{lp{0.9\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
  {\end{longtable}}%
%
\renewcommand*{\glossaryheader}{%  Change the table header
  \bfseries Sign & \bfseries Description & \bfseries Unit \\
  \hline
  \endhead}
\renewcommand*{\glossentry}[2]{%  Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1} \tabularnewline
}
}

%%%%%%%% -------------- DOCUMENT --------------- %%%%%%%%
\begin{document}

%%% ABBREVIATIONS
\newacronym{adcs}{ADCS}{Attitude Determination \& Control subsystem}
\newacronym{vleo}{VLEO}{Very Low Earth Orbit}

%%% SYMBOLS
\newglossaryentry{symb:Pi}{
    name = \ensuremath{\pi},
    description = {Geometrical value},
    unit = {-},
    type = {symbolslist}
}
\newglossaryentry{mu}{
    name = \ensuremath{\mu},
    description = {Earth's gravitational parameter},
    unit = {m^3/s^2},
    type = {symbolslist}
}

%% sample example
\textbf{These are some abbreviations:} \gls{adcs}  \gls{vleo} \\
\textbf{These are some symbols:} \gls{symb:Pi} \gls{mu}

%% print the glossaries
\setlength\glsdescwidth{0.9\textwidth} %\textwidth-9\tabcolsep is used in the full document
\printglossary[type=\acronymtype,title={Abbreviations}]
\printglossary[type=symbolslist, style=symbunitlong]


\end{document}

I also get a hyperref package error.

Any tips on removing the errors, without changing the layout and hyperlinks?

As a side question I was also trying to store abbreviations and list of symbol entries in two separate files and use \loadglsentries twice, but that would not work, suggestions on separating them?

Your Answer

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

Browse other questions tagged or ask your own question.