在枚举或逐项列举中正确放置标签

在枚举或逐项列举中正确放置标签

尽管我尝试了很多次,尝试了有和没有,但enumitem我还是无法弄清楚如何将标签移到itemize表格单元格的左侧以利用整个单元格宽度。另一个困难是我需要使用hyperref,但它似乎会干扰表格中的垂直间距。

itemindent我不仅希望得到可行的解决方案,还希望得到关于如何工作的一点解释labelwidth。在我看来,这leftmargin也没有效果。

在此处输入图片描述

  • 我受到启发这个漂亮的答案

  • 我必须要使用xelatex、、memoir字体Arial和指定的页面几何。这就是为什么我的最小示例有点长。


\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[colorlinks,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
\newfontfamily{\headingfont}[Ligatures=TeX]{Helvetica Neue Condensed Bold}
\renewcommand{\tablename}{\headingfont Tab.}
\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}

答案1

使用enumitemetoolbox包而不是使用minipageforenumerate列表,您可以获得以下结果:

在此处输入图片描述

编辑。 现在被视为 Barbara Beeton 的评论。

\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}
%\newfontfamily{\headingfont}%
%    [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},}    % <---
                        }
\usepackage[colorlinks,
            linkcolor=blue,
            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}

答案2

这里介绍如何操作,无需显式的迷你页面,这要感谢从此站点和包中的答案中借用的命令enumitem。我定义了一个tabenumerate列表,其中包含相关参数:

\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[colorlinks,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
%\newfontfamily{\headingfont}[Ligatures=TeX]{Helvetica Neue Condensed Bold}
\newcommand{\headingfont}{\bfseries}
\renewcommand{\tablename}{\headingfont Tab.}
\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} 

在此处输入图片描述

相关内容