In a theorem-like environment that begins with a (parenthesized) enumeration, how can the horizontal extra space before the item be eliminated but:
without destroying correct indentation of the body of the items, including lines after the first one in an item; and
without requiring no blank line before the body of the first item; and
without unduly shrinking the space between the first item's label and its body text?
In the output from the source below, the first red arrow marks where the extra unwanted horizontal space appears.
As we can see in "1.3 Examples", the attempt to eliminate the extra horizontal space of the first item destroys the uniform horizontal indentation of the first item. In "1.4 Examples", the body of the first item begins a separate paragraph after its label. In "1.5 Examples", the latter issue is avoided by eliminating the blank line in the source, but there is too little space between the first item's label and its body text.
\documentclass{article}
\usepackage[left=1.2in,right=1.2in,top=1in,bottom=1in]{geometry}
\newcommand{\sometxt}{%
Some text begins this. The identity is $\sin^2(\theta) + \cos^2(\theta) = 1$ %
and in very simple terms $(a + b)^2 \neq a^2 + b^2$.%
On the other hand, we do have the basic law of powers that $(a b)^2 = a^2 b^{2}$.
}
\usepackage{enumitem}
\usepackage{mathtools,amsthm,thmtools}
\newlist{pexenum}{enumerate}{1}
\setlist[pexenum,1]{label= \upshape(\arabic*)}
\swapnumbers
\declaretheorem[name=Theorem,numberwithin=section]{theorem}
\declaretheoremstyle[
headfont= \bfseries, headpunct={\bfseries.},
postheadspace=0.5em,
spaceabove=12pt,spacebelow=12pt
]{exstyle}
\declaretheorem[
style=exstyle, numberlike=theorem,
]
{examples}
\begin{document}
\section{The section}
\noindent This is OK with text within the environment precedes the enumeration:
\begin{examples}
Text before the enumeration.
\begin{pexenum}
\item
\sometxt
\setcounter{pexenumi}{9}
\item \sometxt
\end{pexenum}
\end{examples}
\noindent \textbf{The problem}, when \emph{no} text precedes enumeration---too much horizontal space before 1st label:
\begin{examples}
\begin{pexenum}
\item
\sometxt
\setcounter{pexenumi}{9}
\item \sometxt
\end{pexenum}
\end{examples}
\noindent Attempted fix---\verb!leftmargin=*! etc.. \emph{Wrong}---entire 1st item exdented:
% From https://tex.stackexchange.com/a/17487/13492:
\begin{examples}
\begin{pexenum}[leftmargin=*]
\item
\sometxt
\end{pexenum}\vspace*{-2\partopsep}
\begin{pexenum}[resume]
\setcounter{pexenumi}{9}
\item \sometxt
\end{pexenum}
\end{examples}
\noindent Attempted fix---use \verb!\fixitem!.. \emph{Wrong}---1st item body begins new paragraph after item label:
% From https://tex.stackexchange.com/a/17500/13492:
\newcommand*\fixitem{\item[]%
\refstepcounter{pexenumi}\hskip-\leftmargin\labelpexenumi\hskip0.5\labelsep}
\begin{examples}
\begin{pexenum}
\fixitem % The blank line before the item's text is deliberate!
\sometxt
\item \sometxt
\setcounter{pexenumi}{9}
\item \sometxt
\end{pexenum}
\end{examples}
\noindent Attempted fix---use \verb!\fixitem!.---no blank line. This works, but \emph{awkward} having to avoid the blank line:
\begin{examples}
\begin{pexenum}
\fixitem
%
\sometxt
\item \sometxt
\setcounter{pexenumi}{9}
\item \sometxt
\end{pexenum}
\end{examples}
\end{document}
Edit: The @label method shown in https://tex.stackexchange.com/a/17465/13492 seems to work!
Related:
The question is similar to that of Annoying space before the first item in an enumeration which starts a theorem, except that now:
- the enumeration is done with parenthesized numbers (which may affect spacing); and
- each item has more than one line, whereas in the original question each item had a single line which obscured the shortcoming in the answers provided there.
The source shows just one method that tries to remove the unwanted horizontal space before the first item, but the other methods given in answers to Annoying space before the first item in an enumeration which starts a theorem suffer the same shortcoming.
See also my "non-answer" https://tex.stackexchange.com/a/586852/13492.





pexenum, we would need corresponding separate versions ofmyfirsstitem. Caution: would need some change in (unlikely) situation of more than 99 items! – murray Mar 13 '21 at 22:40myfirst...method: A blank line between the\begin{pexenum}[first=\myfirstitem]and the first\itemcauses the body of the first item to begin a new paragraph. Ordinarily, blank lines between a\begin{enumerate}and the first\itemcause no such behavior. – murray Mar 16 '21 at 19:00