# Properly position labels in enumerate or itemize

Despite a lot of trying, experimenting with and without enumitem I cannot figure out how to shift labels in itemize to the left of the table cell in order to exploit the full cell width. Further difficulty is that I need to use hyperref, and it seems to interfere with vertical spacing in the table.

I would appreciate not only the working solution, but also a bit of explanation on how itemindent, labelwidth work. It seems to me that leftmargin does not have an effect either.

• I am inspired by this beautiful answer.

• I am bound to use xelatex, memoir, Arial font, and the specified page geometry. That is why my minimal example is somewhat long.

\documentclass[11pt,a4paper,onecolumn,openright,final,oneside]{memoir}
%===============================================
\settrims{0.cm}{0.cm}
\setbinding{0cm}
\setlrmarginsandblock{*}{2.5cm}{1}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout
%===============================================
\usepackage[dvipsnames,table]{xcolor}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
\renewcommand{\thetable}{\arabic{table}}
%===============================================
\begin{document}
\begin{table}[t]
\rowcolors{1}{}{gray!10}
\begin{tabularx}{\textwidth}[t]{llXX}
\arrayrulecolor{NavyBlue}
No.&Duration& Methodological developments& Systems and Applications\\\hline
% ======================= ======================= =======================
1.& X months &
\begin{minipage}[t]{\linewidth}%
\tightlists
\begin{enumerate}
\item  Very long and complicated name
\item  Even longer and more complicated name
\end{enumerate}
\end{minipage}
& Short name\\
% ======================= ======================= =======================
3.& Y months& Generalization towards some new scenario&
\begin{minipage}[t]{\linewidth}%
\tightlists
\begin{enumerate}
\item  Very long and complicated name
\item  Even longer and more complicated name
\end{enumerate}
\end{minipage}
\\
% ======================= ======================= =======================
4.& Z months & Short name & Short name
\end{tabularx}
\caption[]{\small Development plan}
\end{table}
\end{document}


With use of the enumitem and etoolbox packages and not using minipage for enumerate list, you can achieve the following result:

Edit. Now is considered comment Barbara Beeton's comment.

\documentclass[11pt,a4paper,onecolumn,openright,final,oneside]{memoir}
%===============================================
\settrims{0.cm}{0.cm}
\setbinding{0cm}
\setlrmarginsandblock{*}{2.5cm}{1}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout
%===============================================
\usepackage{ragged2e}
\newcolumntype{L}{>{\RaggedRight}X}
\usepackage[dvipsnames,table]{xcolor}
%===============================================
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
%    [Ligatures=TeX]{Helvetica Neue Condensed Bold}% I haven't this font
\renewcommand{\tablename}{Tab.}
\renewcommand{\thetable}{\arabic{table}}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[enumerate]{nosep,
leftmargin=*,
label={\arabic*.},
before=\vspace*{-0.5\baselineskip}, % <---
after=\vspace*{-\baselineskip},}    % <---
}
citecolor=blue,
urlcolor=blue]{hyperref}

\begin{document}
\begin{table}[ht]
\arrayrulecolor{NavyBlue}
\rowcolors{1}{white}{gray!10}
\begin{tabularx}{\textwidth}[t]{llXX}
No. &   Duration
&   Methodological developments
&   Systems and Applications    \\
\hline
1.  & X months
&  \begin{enumerate}
\item  Very long and complicated name
\item  Even longer and more complicated name
\end{enumerate}
& Short name                    \\
%
3.  &   Y months
&   Generalization towards some new scenario
&   \begin{enumerate}
\item  Very long and complicated name
\item  Even longer and more complicated name
\end{enumerate}     \\
%
4.  &   Z months
&   Short name
&   Short name
\end{tabularx}
\caption[]{Development plan}
\end{table}
\end{document}

• Nice, but may I suggest using \raggedright (or maybe better, \RaggedRight from ragged2e, to allow hyphenation) in the paragraphed cells. This example isn't bad, but sometimes the text is such that the spacing when there's more than one line is simply dreadful. – barbara beeton May 1 '20 at 22:37
• @barbarabeeton, this cross my mind, but now I can't remember why didn't do this :-(. Added to MWE. – Zarko May 1 '20 at 22:44
• Thank you! I would like to know why \RaggedRight is needed. It seem it just brakes the shorter item by putting the word name to the next line. Also, what is the purpose of etoolbox and why isn't it good to use minipage as in the linked post? – yarchik May 2 '20 at 7:29
• RagedRight is defined in the ragged2e package. It enable a smart way to make ragged/hyphenated text at right border. With it a text is better spaced in cells, etoolbox define \AtBeginEnvironment, which is used for formatting enumerate list in tables. Using minipage is fine, if you not use the hyperref package. With it is inserted some vertical space (this is probanly a bug) – Zarko May 2 '20 at 8:18

Here how to do it, without an explicit minipage, thanks to a command borrowed from an answer on this site and the enumitem package. I defined a tabenumerate list, with the relevant parameters:

\documentclass[11pt,a4paper,onecolumn,openright,final,oneside]{memoir}
%===============================================
\settrims{0.cm}{0.cm}
\setbinding{0cm}
\setlrmarginsandblock{*}{2.5cm}{1}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout
%===============================================
\usepackage[dvipsnames,table]{xcolor}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
\renewcommand{\thetable}{\arabic{table}}
%===============================================
\usepackage{enumitem}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\newlist{tabenumerate}{enumerate}{1}
\setlist[tabenumerate]{label=\arabic*., nosep, wide=0pt, leftmargin=*, before = \vspace*{-1.4ex}, after=\vspace*{-\baselineskip}}

\begin{document}

\begin{table}[t]
\rowcolors{1}{}{gray!10}
\begin{tabularx}{\textwidth}[t]{ll >{\compress\arraybackslash}X>{\compress\arraybackslash}X}
\arrayrulecolor{NavyBlue}
No.&Duration& Methodological developments& Systems and Applications\\\hline
% ======================= ======================= =======================
1.& X months &
\begin{tabenumerate}
\item Very long and complicated name
\item Even longer and more complicated name
\end{tabenumerate}
& Short name\\
% ======================= ======================= =======================
3.& Y months& Generalization towards some new scenario&
%\begin{minipage}[t]{\linewidth}%
% \tightlists
\begin{tabenumerate}
\item Very long and complicated name
\item Even longer and more complicated name
\end{tabenumerate}
\\
% ======================= ======================= =======================
4.& Z months & Short name & Short name
\end{tabularx}
\caption[]{\small Development plan}
\end{table}

\end{document}


• Thank you. First of all, it was unexpected that your solution works even when arraystrech is used. Second, I read the documentation of enumitem, but never reached the convenience option wide. These equivalent definitions are really hard to guess. I have three questions: 1)Why is it bad to use minipage? 2) What is the purpose of compress for I see not differences? 3) Why also wide without any argument works? – yarchik May 2 '20 at 7:16
• @yarchik: 1) It is not necessarily bad per se, but it makes the code more complex. 2) >{\compress] makes latex believe we've entered a minipage, and a list at the start of a minipage has no vertical space above. However, it does not always work fine (and here I had to add a small negative vertical spacing via before=, maybe due to the change in \arraystretch). 3) wide without argument uses \parindent as \labelindent by default, if I remember well. – Bernard May 2 '20 at 8:45