1

During the writing of my thesis, I found that the long lines within the Nomenclature, created by longtable, always exceed the length limit of geometry in the preamble. Could you suggest me how to solve this problem? The following is the relevant code. Thanks for any help.

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{geometry}\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}

\clearpage
\chapter*{Nomenclature}
\addcontentsline{toc}{chapter}{Nomenclature}
\quad\; \textbf{\Large{Roman Letters}} \\
\begin{longtable}{p{50pt}p{400pt}}
$a$ & This is a long explanation of the symbol $a$ \\
\end{longtable}
2

Your MWE is incomplete (it's missing \usepackage{longtable} and the document environment). Here's a minor modification that creates a complete document that demonstrates the problem:

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{longtable}
\usepackage[showframe]{geometry}
\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}

\begin{document}
\chapter*{Nomenclature}

\begin{longtable}{p{50pt}p{400pt}}
\hline
$a$ & This is a long explanation of the symbol $a$ \\
\end{longtable}
\end{document}

The showframe option is a useful debugging option that shows the page layout and I've added \hline to demonstrate the full width of the table, which shows the overfull problem:

image of document

The transcript (.log) file shows the page dimensions. The pertinent value is:

* \textwidth=421.10089pt

So the total text width is 421.10089pt. The longtable is started with:

\begin{longtable}{p{50pt}p{400pt}}

so the first column is 50pt and the second is 400pt and 50pt+400pt=450pt, which means it's already wider than the text width, but there's additionally the space between the columns, which in this case is 4 times the value of \tabcolsep. You can find this value by adding

\showthe\tabcolsep

before the longtable. This shows the value in the transcript:

> 6.0pt.
l.9 \showthe\tabcolsep

Therefore the total width of the table is 4 × 6pt + 450pt = 474pt. Since the text width is 421.10089pt this means that the table is 52.89911pt too wide, which LaTeX informs you in the transcript file:

Overfull \hbox (52.89911pt too wide) in alignment at lines 9--12

So you have to make one or both of your column widths smaller. For example:

\begin{longtable}{p{50pt}p{347pt}}

Alternatively, you could use a more automated method, like this:

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{geometry}
\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}
\usepackage[symbols,record,style=alttreegroup]{glossaries-extra}

\glsxtrsetgrouptitle{roman}{Roman Letters}
\glsxtrsetgrouptitle{greek}{Greek Letters}

\glsxtrnewsymbol
 [group=roman,
  description={This is a long explanation of the symbol $a$}]
 {a}{$a$}
\glsxtrnewsymbol
 [group=roman,
  description={This is a long explanation of the symbol $b$}]
 {b}{$b$}

\glsxtrnewsymbol
 [group=greek,
  description={This is a long explanation of the symbol $\alpha$}]
 {alpha}{$\alpha$}
\glsxtrnewsymbol
 [group=greek,
  description={This is a long explanation of the symbol $\beta$
  with some filler text to make the explanation longer.}]
 {beta}{$\beta$}

% set up the width available for the symbol:
\setglossarypreamble[symbols]{\glssetwidest{MMMMM}}

\begin{document}
\tableofcontents

\printunsrtglossary[type=symbols,title={Nomenclature}]
\end{document}

image of glossary

  • @ Nicola Talbot many things to learn from you. Thank you. – jsxs Jan 18 '18 at 1:50

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.