0

I try to define a newenvironment for a new way of itemizing, but when I use the newenvironment (named itemize-compact) I get the error 'missing item' (within tabular) or 'missing list environment'.

(FYI: in the end I would like to use the newenvironment to define a list with less space between, above, under, and left of the items, using functions as labelsep and parsep, to be used within tabular.)

Below a somewhat MWE with both the use of the newly defined itemize in a tabular and in general text. I've enclosed a picture of its result.

Thank you so much in advance!

\documentclass{book}
\usepackage{array,enumitem}  

\newenvironment{itemize-compact}%
  {\begin{itemize}
    %no alternative properties included yet, because this already gives the errors stated below
    \end{itemize}}

\begin{document}

\begin{tabular}{|m{5cm}|m{10cm}|}
\hline
Text    & 
\begin{itemize}
\item itemize within tabular works fine
\end{itemize}
\\
\hline
\end{tabular}

\begin{tabular}{|m{5cm}|m{10cm}|}
\hline
Text    & 
\begin{itemize-compact}
\item the newly defined environment `itemize-compact' within tabular gives the error: *there's something wrong, perhaps a missing item*
\end{itemize-compact}
\\
\hline
\end{tabular}

\begin{itemize}
\item itemize works fine
\end{itemize}

\begin{itemize-compact}
\item the newly defined environment `itemize-compact' gives the error: *lonely item, perhaps a missing list environment*
\end{itemize-compact}

\end{document}

results of the newly defined itemize-compact with tabular and in general text

campa
  • 31,130
Aldine
  • 1
  • I can't test now but I think you are simply missing the second argument: \newenvironment{name}{start code}{end code}. Right now you have \newenvironment{itemize-compact}{\begin{itemize}\end{itemize}}, while you should write \newenvironment{itemize-compact}{\begin{itemize}}{\end{itemize}}. – campa May 15 '20 at 15:01
  • May be of use: https://tex.stackexchange.com/questions/406116/compact-bulleted-points-in-table – Fintan May 15 '20 at 15:02
  • 1
    Since, you load enumitem, why don't you use its \setlist command? – Bernard May 15 '20 at 16:07
  • Thank you all so much! The problem is resolved now:-) @campa: yes, apparently the brackets for the two arguments were not positioned correctly. Thank you for pointing this out to me! Fintan: I have not been able to get the commands in that post running in my code, but thank you for the suggestion nevertheless! Bernard: I only intended to change the lay-out of the list in specific occasions. I believe \setlist changes the lay-out of every list in the document, which was not what I intended to achieve. Actually, I didn't know \setlist until now, so I've learned something new. Thanks! – Aldine May 19 '20 at 14:06

0 Answers0