我需要写一个包含项目列表的定义。
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
环境:
笔记:
- 我用了包裹
enumitem
因为它提供了更大的灵活性。 - 包裹
calc
是\widthof{}
宏所需要的。
代码:
\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}