自定义列表环境

自定义列表环境

考虑以下 MWE:

\documentclass[letterpaper]{article}
\usepackage[letterpaper,top=2.5cm,bottom=2.5cm,lmargin=2.5cm,rmargin=2.5cm]{geometry}
\usepackage{array,booktabs,tabularx}
\usepackage{ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}
\begin{center}
\renewcommand\arraystretch{2}
    \begin{tabularx}{\linewidth}{>{\textbullet}c@{\hskip0.5em} >{\RaggedRight\arraybackslash}p{0.2\textwidth} L}
&sample& very logn sentence with math symbols sample  very logn sentence with math symbols sample very logn sentence with math symbols sample \\
&sample& very logn sentence with math symbols sample  very logn sentence with math symbols sample very logn sentence with math symbols sample \\
\end{tabularx}
\end{center}
\end{document}

在此处输入图片描述

是否可以使用该enumitem包重新创建相同的设置?

我们的目标是实现如下效果: 在此处输入图片描述

不幸的是,由于表格中的条目太多,所以无法正确分解。

答案1

使用基础list环境构建新环境Description

\documentclass{article}

\usepackage{calc}
\newenvironment{Description}%
  {\begin{list}{}{\let\makelabel\Descriptionlabel 
    \setlength\labelwidth{3.8cm}% 
    \setlength\leftmargin{\labelwidth+\labelsep}}}% 
    {\end{list}}
    
\newcommand*\Descriptionlabel[1]
  {\raisebox{0pt}[1ex][0pt]%
    {\makebox[\labelwidth][l]%
      {\textbullet\hspace{0.5em}\parbox[t]{\labelwidth-\widthof{\textbullet}-0.5em}%
        {\hspace{0pt}\textsf{#1}}}}}

\begin{document}
\begin{Description}
  \item[Volume of prism] $V=ah$, where $a$ is the area of a cross section and $h$ is the perpendicular length
  \item[Volume of cylinder] $V=\pi r^2h$, where $r$ is the radius of the base and $h$ is the perpendicular height
  \item[Volume of a right pyramid] $V = \frac13 ah$, where $a$ is the area of the base and $h$ is the perpendicular height
\end{Description}
\end{document}

在此处输入图片描述

相关内容