Nicole
Nicole

Reputation: 57

Aligning numbered paragraphs

I am trying to cross reference some numbered paragraphs. I am using \numpar but the first one always is off aligned. (\item didn't work)

Here is what I did:

\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.

which results in:

enter image description here

I need all numbers to be aligned without affecting on unnumbered paragraphs. I am open to other commands instead of \numpar if any. Any advice is appreciated.

Upvotes: 0

Views: 1274

Answers (1)

Alain Merigot
Alain Merigot

Reputation: 11547

Why don't you use enumerate? It is done for that kind of problem.

\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

If required, you can customize the appearance with the enumitem package.

For instance, to increase the indentation, load the package, and start enumerate with :

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

Many options in the enumitem package and it can certainly fit your needs.

Edit: Note that \item will indent anything that is after it. If you dont want this behavior, close the enumerate before your paragraph. Then you can restart the enumerate, but you must take care of the item numbering (see below).

\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}

Upvotes: 1

Related Questions