如何在 Latex 中的定义中设置列表?

如何在 Latex 中的定义中设置列表?

我需要写一个包含项目列表的定义。

    What is science : Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                      - List item 1
                      - List item 2
                      - List item 3

                      Another lorem ipsum dolor sit amet, consectetur adipiscing elit.

我有这个,但它没有实现上述功能:

\paragraph{What is science}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\begin{itemize}
  \item List item 1
  \item List item 2
  \item List item 3
\end{itemize}

输出如下:

    What is science : Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    - List item 1
    - List item 2
    - List item 3

答案1

您可以使用tabular环境或其变体之一:

\documentclass{article}
\usepackage{tabularx}
\begin{document}

\noindent\begin{tabularx}{\linewidth}{l@{\space}X}
What is science: & Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\begin{itemize}
  \item List item 1
  \item List item 2
  \item List item 3
\end{itemize} \\
& Another lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{tabularx}

\end{document}

在此处输入图片描述

答案2

我建议改用description环境:

在此处输入图片描述

笔记:

代码:

\documentclass{article}
\usepackage{calc}
\usepackage{enumitem}

\begin{document}
\begin{description}[leftmargin=\widthof{\bfseries What is science:~}]
    \item [What is science:] Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    \begin{itemize}
        \item List item 1
        \item List item 2
        \item List item 3
    \end{itemize}
    Another lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{description}
\end{document}

答案3

仅记录一个minipage没有tabular环境的解决方案:

\documentclass{article}
\usepackage{calc}
\newlength{\wis}
\settowidth{\wis}{\bf What~is~science:~}

\begin{document}

\paragraph{What~is~science:~}
\hfill\begin{minipage}[t]{\textwidth-\wis}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 
\begin{itemize}
\setlength\itemsep{0ex}
  \item List item 1
  \item List item 2 
  \item List item 3
\end{itemize}
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
\end{minipage}

\end{document}

在此处输入图片描述

相关内容