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. Commented Jul 5, 2020 at 17:07
  • @F.Pantigny, unfortunately, I get Illegal character in array arg exception. Commented Jul 5, 2020 at 17:08
  • 1
    you need array package for ! Commented Jul 5, 2020 at 17:08
  • @DavidCarlisle ! Package array Error: Illegal pream-token (\subitem): ``c' used is what I get. Commented Jul 5, 2020 at 17:15
  • I ran your example but get no error but empty nlo file? Commented Jul 5, 2020 at 17:42

1 Answer 1

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
    Commented Jul 6, 2020 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 :). Commented Jul 6, 2020 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .