对齐编号的段落

时间:2019-06-02 10:29:27

标签: latex

我正在尝试交叉引用一些带编号的段落。我正在使用\ numpar,但第一个总是未对齐。 (\项目无效)

这是我所做的:

\section{First section}
\subsection*{Subsection1}
\numpar\label{A1} blablabla1
\numpar\label{A2} blablabla2
\numpar\label{A3} blablabla3

\section{Second section}
Statement \ref{A2} = 2 must be true.

结果为:

enter image description here

我需要所有数字都对齐而不影响未编号的段落。我愿意接受其他命令而不是\ numpar。任何建议表示赞赏。

1 个答案:

答案 0 :(得分:1)

您为什么不使用enumerate?解决了这种问题。

\documentclass{article}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
\section{Second section}
Statement \ref{A2} = 2 must be true.

\end{document}

enter image description here

如果需要,您可以使用enumitem包自定义外观。

例如,要增加缩进量,请加载程序包,然后从开始枚举:

\begin{enumerate}[leftmargin=3cm]`

enumitem包中的许多选项,它肯定可以满足您的需求。

编辑: 请注意,\ item将缩进其后的任何内容。如果您不希望出现这种情况,请在段落前关闭枚举。然后,您可以重新启动枚举,但是必须注意项目编号(请参见下文)。

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1

  This paragraph will be indented

\end{enumerate}

But this one will not.

\begin{enumerate}\setcounter{enumi}{1}
  % This insures that item numbering will be coherent
  % set it to the value of the last item
  % If using the enumitem package, there is a simpler way with 'resume'
  % \begin{enumerate}[resume]
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}

And another non indented par

\section{Second section}
Statement \ref{A2} = 2 must be true.

\end{document}
相关问题