4

I'm trying to include a enumerate list in an tabularly environment, but the numbering gets wrong when I add more than one level of depth to the list.

\begin{table}[H]
\begin{minipage}{\linewidth}
\setlength{\tymax}{0.8\linewidth}
\centering
\small
\begin{tabulary}{\textwidth}{@{}LL@{}}
Wrong row&
\begin{enumerate}
\item First.
\begin{enumerate}
\item Second
\end{enumerate}
\end{enumerate}\\
\end{tabulary}
\end{minipage}
\end{table}

This code generates the following output for the row:

Wrong row 
           1   1.1 First
                   1.1 Second

If i add another nested level the output gets messy with overlapping numbers.

Outside of any table, enumerate is being working fine thorught all my document.

EDIT:

I have simplified the example to the maximum and I could make it work, think it was the column type, which now is set to P.

\documentclass[11pt]{book}
\begin{document}
\begin{tabular}{|Lp{10cm}|}
    row1&value\\
    row2&
    \begin{enumerate}
        \item First
        \begin{enumerate}
            \item Second
        \end{enumerate}
    \end{enumerate}
\\
\end{tabular}
\end{document}

Which now generates the correct output:

row1     value
row2     1. First
            1.2 Second
4
  • Can you turn this into a complete compilable example? Your code as it stands doesn't compile.
    – Alan Munn
    Jul 1, 2012 at 12:40
  • 3
    No, make this a complete compilable document (with \documentclass{}\usepackage{}...\begin{document}...\end{document}. Don't post fragments.
    – Alan Munn
    Jul 1, 2012 at 13:25
  • Excuse me, I'm new to Latex world. I have corrected the second example and it is working now for me. The problem with first was the column type. Jul 1, 2012 at 16:23
  • 1
    So have you effectively solved your problem? If so, perhaps we should close the question as too localized. (BTW, your sample document still doesn't compile: you haven't defined the L columntype or loaded a package which defines it.) Since you're new, this is one thing you definitely need to get used to. People will be very happy to help you, but you should almost always post complete, compilable documents that show your problem. Sometimes just the process of making one can help you solve things yourself. See this question for more info.
    – Alan Munn
    Jul 1, 2012 at 16:29

1 Answer 1

1

I don't think any of the code fragments that you posted compile however the basic issue is that tabulary enables display math but not other display environments in L columns. A small patch fixes this.

\documentclass{article}
\usepackage{tabulary}

\makeatletter
\let\oldTYtab\TY@tab
\def\TY@tab{\expandafter\TY@xtab\oldTYtab}

\def\TY@xtab#1\bgroup{%
#1\bgroup
\let\list\@gobbletwo
\let\trivlist\relax
\let\endtrivlist\relax
\let\item\relax}

\begin{document}


\noindent
\begin{minipage}{\linewidth}
\setlength{\tymax}{0.8\linewidth}
\small
\noindent
\begin{tabulary}{\textwidth}{@{}LL@{}}
Wrong row&
\begin{enumerate}\item First.
\begin{enumerate}\item Second\end{enumerate}
\end{enumerate}
\end{tabulary}
\end{minipage}

\end{document}

You must log in to answer this question.

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