如何在LaTeX中给项目编号并在其下方编写无缩进段落
解决LaTeX enumerate环境下段落无缩进的问题
方法一:使用enumitem包(推荐)
enumitem是LaTeX中自定义列表格式的常用工具包,能轻松实现你要的Word样式效果,彻底避免段落缩进。示例代码如下:
\documentclass{article} \usepackage{enumitem} \begin{document} The methods are: \begin{enumerate}[leftmargin=*, labelindent=1em, itemindent=0pt, listparindent=0pt] \item \textbf{Classic} The best for almost all cases. This is very used and it's the easiest option. We recommend you to use it too over other options \item \textbf{Advanced} The best for advanced users. \end{enumerate} \end{document}
参数说明:
leftmargin=*:自动适配列表左侧边距,根据编号宽度动态调整labelindent=1em:控制编号与页面左侧的距离,匹配示例中的缩进效果itemindent=0pt:取消项目文本的额外缩进listparindent=0pt:彻底取消列表内段落的首行缩进
方法二:原生LaTeX参数调整(无需额外包)
如果不想引入新包,可手动调整列表长度参数:
\documentclass{article} \begin{document} The methods are: \begin{enumerate} \setlength{\itemindent}{0pt} \setlength{\listparindent}{0pt} \setlength{\leftmargin}{1.5em} % 手动设置左侧缩进,匹配编号位置 \item \textbf{Classic} The best for almost all cases. This is very used and it's the easiest option. We recommend you to use it too over other options \item \textbf{Advanced} The best for advanced users. \end{enumerate} \end{document}
这种方法需要手动微调leftmargin的值来达到理想的编号缩进位置,灵活性不如enumitem包。
内容的提问来源于stack exchange,提问作者sigma5563
相关产品推荐
相关产品推荐

