0

Simply put, the nomencl package sees | as a special character (as mentioned here). I am interested in inserting a table with vertical lines. If I use | to denote a vertical line, the entry wouldn't show in the nomenclature list.

The ideas that I can think of to overcome this is generating the table as a standalone and importing the pdf in the entry or generate the entire table using TikZ, as shown here.

Is there a simpler approach to adapt to?

Here is a minimal example:

%pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
%makeindex %.nlo -s nomencl.ist -o %.nls
%pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
\documentclass[12pt]{article}
\usepackage{nomencl}

\makenomenclature  
\makeindex

\begin{document}
    \printnomenclature[1in]
    
    \nomenclature{Entry 1}{
        \begin{tabular}{ccc}
            a & a & a \\
            a & a & a \\
            a & a & a
        \end{tabular}
    }
    \nomenclature{Entry 2}{
        \begin{tabular}{|ccc|}
            b & b & b \\
            b & b & b \\
            b & b & b
        \end{tabular}
    }
\end{document}
8
  • Try to put !{\vrule} instead of | in the preamble of the tabular. – F. Pantigny Jul 5 '20 at 17:07
  • @F.Pantigny, unfortunately, I get Illegal character in array arg exception. – M. Al Jumaily Jul 5 '20 at 17:08
  • 1
    you need array package for ! – David Carlisle Jul 5 '20 at 17:08
  • @DavidCarlisle ! Package array Error: Illegal pream-token (\subitem): ``c' used is what I get. – M. Al Jumaily Jul 5 '20 at 17:15
  • I ran your example but get no error but empty nlo file? – David Carlisle Jul 5 '20 at 17:42
1

Thanks to F. Pantigny and David Carlisle for directing me to get to the solution.

I used the array package and declared my own newcolumntype as:

\newcolumntype{~}{!{\vrule width 1pt}}

or (as egreg's comment suggestion)

\newcolumntype{~}{|}

and used \begin{tabular}{~c~c~c~}...\end{tabular}.

Output

%pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
%makeindex %.nlo -s nomencl.ist -o %.nls
%pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
\documentclass[12pt]{article}
\usepackage{nomencl}
\usepackage{array}
\newcolumntype{~}{!{\vrule width 1pt}}

\makenomenclature  
\makeindex

\begin{document}
    \printnomenclature[1in]
    
    \nomenclature{Entry 1}{
        \begin{tabular}{ccc}
            a & a & a \\
            a & a & a \\
            a & a & a
        \end{tabular}
    }
    \nomenclature{Entry 2}{
        \begin{tabular}{~c~c~c~}
            b & b & b \\
            b & b & b \\
            b & b & b
        \end{tabular}
    }
\end{document}
2
  • What's wrong in \newcolumntype{~}{|}? – egreg Jul 6 '20 at 16:25
  • @egreg,sure! it works just as fine! It would be easier to change the width of the vertical line if needed. I did update my answer though :). – M. Al Jumaily Jul 6 '20 at 16:34

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.