自定义列表环境,每项后都有水平线

自定义列表环境,每项后都有水平线

我有这个 LaTeX 代码:

\documentclass[12pt, a4paper]{book}

%%%   Packages
\usepackage[margin = 20mm]{geometry}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}

%%%   Macors
\newenvironment{aims}{
    \begin{tcolorbox}[breakable,% allow a box to spread over mor than one page
        after skip = 5mm,       
        enhanced,% more control tools
        frame hidden,% hie defalut border of the box
        top = 9mm, % offset the text from top edge
        interior style = {left color = blue!10!white,
            right color = blue!10!white,
            middle color = blue!30!white,}, % box background color  
        sharp corners, %set all corners to be sharp (to edit later)
        arc = 7mm, rounded corners = downhill, % set radius and corners to be rounded
        attach boxed title to top center={yshift = -5mm},% add title box
        fonttitle = \bfseries ,% bold text
        coltitle = black,% title text color
        boxed title style = {frame hidden, arc = 3mm, sharp corners, rounded corners = uphill,
            interior style={top color =  blue!10!white,
                bottom color = blue!10!white,
                middle color = blue!30!white},},    
        title = {First Language ~ Second Language ~ Third Language},]
                    
        \begin{itemize}
}
{
        \end{itemize}
    \end{tcolorbox}
}


\newcommand{\tlitem}[3]{
    \begin{minipage}{0.30\textwidth} #1 \end{minipage}%
    \hfill%
    \begin{minipage}{0.30\textwidth} \color{blue!60!black}{#2} \end{minipage}%
    \hfill%
    \begin{minipage}{0.30\textwidth} #3 \end{minipage}%
    \par\noindent\dotfill
}



\begin{document}

    \begin{aims}
        \item \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \item \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \item \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \item \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}                                                    
    \end{aims}

\end{document}

由此产生了如下结果: 在此处输入图片描述

我不希望列表中最后一个项目后面有点线。实际上每两个项目之间都需要有点线,但最后一个项目后面不需要。请问我该如何实现?

答案1

\documentclass[12pt, a4paper]{book}

%%%   Packages
\usepackage[margin = 20mm]{geometry}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}

%%%   Macors
\newenvironment{aims}{
    \begin{tcolorbox}[breakable,% allow a box to spread over mor than one page
        after skip = 5mm,       
        enhanced,% more control tools
        frame hidden,% hie defalut border of the box
        top = 9mm, % offset the text from top edge
        interior style = {left color = blue!10!white,
            right color = blue!10!white,
            middle color = blue!30!white,}, % box background color  
        sharp corners, %set all corners to be sharp (to edit later)
        arc = 7mm, rounded corners = downhill, % set radius and corners to be rounded
        attach boxed title to top center={yshift = -5mm},% add title box
        fonttitle = \bfseries ,% bold text
        coltitle = black,% title text color
        boxed title style = {frame hidden, arc = 3mm, sharp corners, rounded corners = uphill,
            interior style={top color =  blue!10!white,
                bottom color = blue!10!white,
                middle color = blue!30!white},},    
        title = {First Language ~ Second Language ~ Third Language},]
                    
        \begin{itemize}
}
{
        \end{itemize}
    \end{tcolorbox}
}

\newif \ifaimssep 
\newcommand{\tlitem}[3]{%
    \ifaimssep \par \noindent \dotfill \fi
    \aimsseptrue
    \item 
    \begin{minipage}{0.30\textwidth} #1 \end{minipage}%
    \hfill%
    \begin{minipage}{0.30\textwidth} \color{blue!60!black}{#2} \end{minipage}%
    \hfill%
    \begin{minipage}{0.30\textwidth} #3 \end{minipage}%
}



\begin{document}

    \begin{aims}
        \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}

        \tlitem{A sentence in First Language}
                    {The sentence in other Language}
                    {And the sentence in third Language}                                                    
    \end{aims}

\end{document}

在此处输入图片描述

相关内容