将文本与项目符号对齐到行的顶部

将文本与项目符号对齐到行的顶部

我想将项目符号文本与单元格顶部对齐。我该怎么做?这是 tex 语法:

\begin{sidewaystable}
    \begin{tabular}[t]{p{0.1\textwidth}p{0.2\textwidth}p{0.3\textwidth}p{0.3\textwidth}}
        \hline
        \toprule[0.05em]
        Category & Methods & Advantages & Disadvantanges \\ 
        \hline
 
        Conventional HE
        & Gonzalez
        & \begin{itemize}[noitemsep,topsep=0pt]
            \item Improve the contrast.
            \item Simple and no parameter tuning required.
        \end{itemize}
         
        & \begin{itemize}[noitemsep,topsep=0pt]
            \item Unable to adjust the degree of enhancement.
            \item Often produce unwanted visual artifacts.
            \item Produce unnatural image appearance, such as the mean brightness of image is 
                  different between the original image and enhanced image. 
        
        \end{itemize} \\
     \addlinespace
        
        Local-based HE
        & \begin{itemize}[noitemsep,topsep=0pt] 
          \item AHE 
          \item CLAHE 
          \item CEDHE 
        \end{itemize}
    
        & \begin{itemize}[noitemsep,topsep=0pt]
            \item Can preserve the details
          \end{itemize}
        
        & \begin{itemize}[noitemsep,topsep=0pt]
            \item Increase computational time and complexity
            \item Might caused overenhancement and blocking effect  
        \end{itemize}   \\
        \addlinespace
                
 \hline
 
\end{tabular}
\end{sidewaystable} 

上述代码的结果如下图所示: 在此处输入图片描述

我想将文本与项目符号对齐到单元格的顶部。

谢谢

答案1

由于您正在使用该enumitem包,我建议您使用该包\newlist\setlist宏来创建一个定制的类似 itemize 的环境,该环境自动(a)嵌入到环境中minipage(以删除顶部和底部的空格)和(b)设置选项nosepleft=0pt(为了促进列表的紧凑性)。

哦,不要使用\hline(或) ,\cline而是专门使用包的线条绘制宏booktabs-- \toprule,,,,和。\midrule\cmidrule\bottomrule\addlinespace

在此处输入图片描述

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{rotating,enumitem,booktabs,ragged2e}

\newlist{myitemize}{itemize}{1} % create a bespoke itemize-like env.
\setlist[myitemize,1]{label=\textbullet,nosep,left=0pt,
            before={\begin{minipage}[t]{\hsize}\RaggedRight},
            after ={\end{minipage}}}
\begin{document}

\begin{sidewaystable}
\centering
    \begin{tabular}{@{} p{0.14\textwidth}
                        p{0.16\textwidth}
                        p{0.3\textwidth}
                        p{0.3\textwidth} @{}}
        %%%%%\hline
        \toprule %[0.05em]
        
        Category & Methods & Advantages & Disadvantanges \\ 
        %%%%%\hline
        \midrule
 
        Conventional HE
        & Gonzalez
        & \begin{myitemize}
            \item Improve the contrast.
            \item Simple and no parameter tuning required.
        \end{myitemize}       
        & \begin{myitemize}
            \item Unable to adjust the degree of enhancement.
            \item Often produce unwanted visual artifacts.
            \item Produce unnatural image appearance, such as the  
                  mean brightness of image is different between 
                  the original image and enhanced image.       
        \end{myitemize} \\
        
        \addlinespace
        
        Local-based HE
        & \begin{myitemize} 
          \item AHE 
          \item CLAHE 
          \item CEDHE 
        \end{myitemize} 
        & \begin{myitemize}
            \item Can preserve the details
          \end{myitemize}   
        & \begin{myitemize}
            \item Increase computational time and complexity
            \item Might caused overenhancement and blocking effect  
        \end{myitemize} \\  
                     
        %%%%%\hline
        \bottomrule
    \end{tabular}
\end{sidewaystable} 

\end{document}

答案2

我建议使用这个\compress命令来简化代码,它使 Latex 相信单元格的开始是小页面的开始,从而抑制列表上方的所有间距。

我还删除了项目符号前的水平间距。

\documentclass{article}
\usepackage{array, rotating}
\usepackage{booktabs}
\usepackage{enumitem}
    \makeatletter
        \newcommand*{\compress}{\@minipagetrue}
    \makeatother

\begin{document}

\begin{sidewaystable}
\setlist[itemize]{left=0pt, nosep}
    \begin{tabular}[t]{p{0.1\textwidth}>{\compress}p{0.2\textwidth}>{\compress}p{0.3\textwidth}> {\compress}p{0.3\textwidth}}
        \hline
        \toprule[0.05em]
        Category & Methods & Advantages & Disadvantanges \\
        \midrule
        Conventional HE
        & Gonzalez
        & \begin{itemize}
            \item Improve the contrast.
            \item Simple and no parameter tuning required.
        \end{itemize}

        & \begin{itemize}
            \item Unable to adjust the degree of enhancement.
            \item Often produce unwanted visual artifacts.
            \item Produce unnatural image appearance, such as the mean brightness of image is
                  different between the original image and enhanced image.
        \end{itemize} \\
     \addlinespace

        Local-based HE
        & \begin{itemize}
          \item AHE
          \item CLAHE
          \item CEDHE
        \end{itemize}

        & \begin{itemize}
            \item Can preserve the details
          \end{itemize}

        & \begin{itemize}
            \item Increase computational time and complexity
            \item Might caused overenhancement and blocking effect
        \end{itemize} \\
        \bottomrule
\end{tabular}
\end{sidewaystable}

\end{document} 

在此处输入图片描述

答案3

{NiceTabular}使用时nicematrix,类型列的单元格中的列表p不以垂直空格开头。

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{nicematrix}

\begin{document}

\begin{sidewaystable}
\setlist[itemize]{left=0pt, nosep}
    \begin{NiceTabular}[t]{p{0.1\textwidth}p{0.2\textwidth}p{0.3\textwidth}p{0.3\textwidth}}
        \hline
        \toprule[0.05em]
        Category & Methods & Advantages & Disadvantanges \\
        \midrule
        Conventional HE
        & Gonzalez
        & \begin{itemize}
            \item Improve the contrast.
            \item Simple and no parameter tuning required.
        \end{itemize}

        & \begin{itemize}
            \item Unable to adjust the degree of enhancement.
            \item Often produce unwanted visual artifacts.
            \item Produce unnatural image appearance, such as the mean brightness of image is
                  different between the original image and enhanced image.
        \end{itemize} \\
     \addlinespace

        Local-based HE
        & \begin{itemize}
          \item AHE
          \item CLAHE
          \item CEDHE
        \end{itemize}

        & \begin{itemize}
            \item Can preserve the details
          \end{itemize}

        & \begin{itemize}
            \item Increase computational time and complexity
            \item Might caused overenhancement and blocking effect
        \end{itemize} \\
        \bottomrule
\end{NiceTabular}
\end{sidewaystable}

\end{document} 

上述代码的输出

相关内容