GeneralSplit nomenclature over two lines, with content alligned on same lines under "nomenclature"

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
LaTeX_monty
Posts: 3
Joined: Sat Nov 04, 2023 10:29 pm

Split nomenclature over two lines, with content alligned on same lines under "nomenclature"

Post by LaTeX_monty »

Hi, I would like to split the nomenclature over two lines. I found a "code" for this at https://copyprogramming.com/howto/if-tw ... umns-latex
which states the following:

Code: Select all

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{verbatim}%to make comments
\usepackage{multicol}%for multiple columns
\usepackage{etoolbox}
%Nomenclature Package
%----------------------------------------------
\usepackage{nomencl}
\makenomenclature
\setlength{\nomitemsep}{8pt}
\newcommand{\nomunit}[1]{%
  \renewcommand{\nomentryend}{\hspace*{\fill}#1}%
}
\renewcommand\nomgroup[1]{% 
  \item[\bfseries
  \ifstrequal{#1}{A}{Stuff}{%
  \ifstrequal{#1}{B}{Other Stuff}{%
  \ifstrequal{#1}{C}{More Stuff}{}}}%
]}
\patchcmd{\thenomenclature}
 {\section*{\nomname}}
 {\begin{multicols}{2}[\section*{\nomname}]}
 {}{}
\appto\endthenomenclature{\end{multicols}}
\setlength{\columnsep}{2pc}
%----------------------------------------------
\title{Nomenclatures Example}
\author{}
\date{\today}
\begin{document}
\maketitle
\newpage
\printnomenclature
\nomenclature[A]{$m$}{Mass \nomunit{[kg]}}
\nomenclature[A]{$V$}{Velocity \nomunit{[m/s]}}
\nomenclature[A]{$t$}{Time \nomunit{[s]}}
\nomenclature[B, 03]{${R}$}{Real Numbers}
\nomenclature[B, 02]{${C}$}{Complex Numbers}
\nomenclature[B, 01]{${H}$}{Quaternions}
\nomenclature[C]{$V$}{Constant Volume}
\nomenclature[A]{$\rho$}{Friction Index}
\end{document}

However, it does not compile mye desired outcome, as it states that something is wrong in line 23 and 24 with the "{" and "}" marks. I can not figure what is wrong. At the website you can see the desired outcome under "Solution" to question 2.
Any suggestions to this?
Last edited by Stefan Kottwitz on Mon Nov 06, 2023 1:00 pm, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Split nomenclature over two lines, with content alligned on same lines under "nomenclature"

Post by Stefan Kottwitz »

Great that you found a solution! Thanks for letting us know.

Stefan
LaTeX.org admin
Post Reply