[Tex/LaTex] Indentation of equation numbers from left margin

equationsindentation

I seek help in finding an efficient way, upon creating a symbolic or textual expression by means of a \begin{equation} command, to indent from the left margin not only the expression but its parenthetically enclosed number. (Motivation for this consists in the editorial convention for logic that presents the premises and conclusion of a deductive argument, whether expressed in symbolic form or prose, as a sequence in which each statement occupies an indented line beginning with an assigned number.) The goal is to indent the numbers from the left margin by n pts. and to indent the statements by m pts. for 0 < n < m. Usually n is at least as great as \parindent. For example, n = 32, m = 48.

I'm a neophyte at TeX, and this is my first posting here. Learning from various sources, I began by trying the following.

\documentclass[12pt,letterpaper,leqno,fleqn]{article}
\usepackage{amsmath}
\usepackage{latexsym,amssymb}
\setlength{\mathindent}{24pt}
\newcommand{\texteq}[1]{\begin{equation}\text{\parbox{0.85\textwidth}   {#1}}\end{equation}}
\begin{document}
## [A] ##
\begin{equation}
p \implies q
\end{equation}
\begin{equation}
p
\end{equation}
\begin{equation}
∴ q
\end{equation}
## [B] ##
\texteq{All bachelors are unmarried.}
\texteq{Jones is a bachelor.} 
\texteq{∴ Jones is unmarried.}

\end{document}

[A] yields the following.

Prior text

(1) 𝑝 ⟹ 𝑞

(2) 𝑝

(3) ∴𝑞

Subsequent text

[B] yields

Prior text

(4) All bachelors are unmarried.

(5) Jones is a bachelor.

(6) Therefore Jones is unmarried.

Subsequent text

What I've tried to indicate above is that neither [A] nor [B] indents the numbers. They do place the expressions leftward from center, and at a suitable distance from the closing parens. Both also introduce excessive vertical space (about three lines, two too many) not shown above.

About [B], I mention that, wishing the opportunity for purely textual numbered expressions and statements, I took it that the \newcommand line above accomplished that, but observe that if '\text' is deleted therefrom, the result is unaffected. A further puzzle is the enclosing punctuation of '\text{\parbox{0.85\textwidth}.' So far as I can tell, this lacks one closing brace (and perhaps one at the beginning). I must not understand what is going on in this command. All attempts to alter the punctuation issue in error messages unsolvable except by restoring the quoted code.

I've tried to find ways to insert into the code for [A] and [B] some settings for leftmargin, rightmargin (whose widening also could be desirable in a given case), parsep, topsep, and more. I've looked for other approaches to solving the problem. None of the foregoing ploys have worked.

I've read of the align and multiline environments, but don't know whether or how to implement them for the present purpose.

An earlier posting evoked a solution for the complementary problem of indenting numbers (though not expressions) from the right margin (Controlling exact position of equation numbers). I do not sufficiently understand the programming code used there so as to glimpse whether it would be adaptable for use in the present context.

Lastly, one might relegate the present task to an enumeration or custom list, but that would forego the equation environment's typesetting capabilities for expressions written in symbolic logic, as well as the uncomplicated consecutivity of equation numbering notwithstanding interspersed main body text.


(Addendum 1)

Thanks to @Mico for your answer. I appreciate your accommodating my preference by specifying \displaystyle. I've found in experimenting that not only does the list work, but it appears that the labelindent option directed at the heart of my question, seems superfluous, as leftmargin seems to control displacement of labels and text from the left. There remains for me a preference for the equation environment as follows. I read one of your postings (Show inline math as if it were display math) in which you wisely admonished, on grounds of typographical appearance, against forcing features of display style on inline expressions. A publisher's production staff, with a keen eye for such things, might hold the same view, and at first glance, find code that imposes it an auctorial nuisance. They commonly emphasize that they prefer a file with as little formatting code as possible. If it suffices to use standard commands leqno and fleqn with a command to indent parenthetical numbers from the left, that might aid interactions with the publisher. In logic it is also valuable to produce annotations (usually premise numbers) to the right of enumerated sentences, which the mathematical 'align' environment is well-equipped to do, but I'm unclear whether that would work inline. I wonder also if there may flow from the equation treatment other benefits of which I am unaware. If you could espy a way to effect that treatment, it would be most appreciated.

(Addendum 2)

I thank @skpblack for this solution, which works beautifully. After considerable time studying it to discern the artistry, and exploration of changing the variables, I have come to understand some of what the code does, but would like to pose the following for clarification. (1) I wonder what [2][0.5] instructs. I see that changing 0.5 varies the distance between expression and annotation, and how far rightward annotation extends. The distance 0.5 gives a well-proportioned result, thank you. I also see that any substitute for 2 wreaks havoc. (2) Notwithstanding your two distance . . . comments, numbersep appears to be distance of numbers from left margin, and statementsep the distance between numbers and statements. So I have set them at 40pt and 28pt, respectively. (3) Noticing the alternation between \text and \texteqn in the premises, I found the commands to be functionally interchangeable everywhere except in the case of \texteq[0.4]. What is going on in the last line but not in the other lines? Here I do not understand the function of 0.4. Is it truly a matter of indifference which command one uses? (4) I am unclear what it means to align "by top." Upon deleting [t], the outcome doesn't appear to change. (5) If a document had equations for which one preferred the standard centered, reqno presentation, I gather that \everydisplay{\displayindent=\numbersep} would impose on those equations the leqno, fleqn presentation that you've astutely encoded for indentation. Does it make sense to house your code in the definition of another environment for numbered sentences, with separate counter, so as to leave equations undisturbed? (6) If it were desired to restart numbering at the end of an argument, I infer that one could write \setcounter{equation}{0} before the next, unless you recommend another way. (7) I wonder if one could add tags to numbered sentences, perhaps on the right in place of annotations. (8) I gather that the \mathindent line overrides any prior such command in the preamble. Should I delete any prior such command?

A great virtue of the products of what you've written is the absence of excessive vertical spacing. More generally, the gather solution is beautifully simple, and the align merely appears a little less so for scattered ampersands. Both signify deep insight, for which I greatly thank you.

Best Answer

Despite your stated preference for a numbered-equation type solution, I think you're better off creating a custom enumerated environment, using the machinery of the enumitem package. It's a very powerful package that lets you customize lists in just about any way imaginable -- and probably a few more ways you couldn't imagine... :-)

The following answer shows how some of the customization may be tackled. Note that it's no problem at all to restart the numbering of the list after some intervening material has occurred. The enumerated items can also be cross-referenced using the usual LaTeX tools.

enter image description here

\documentclass[12pt,letterpaper]{article}
\usepackage{amsmath,amssymb,lipsum}
\newcommand\logic[1]{$\displaystyle#1$} % helper macro

\usepackage{enumitem} % see https://www.ctan.org/pkg/enumitem
% Create a custom enumerated environment called "mylist":
\newlist{mylist}{enumerate}{1} % Depth: just 1 level
\setlist[mylist]{label=(\arabic*), % parentheses around labels; arabic numerals
                 ref=\arabic*,     % no parentheses in cross-references
                 labelindent=2\parindent, % distance to left-hand edge of text block
                 leftmargin = !, % compute as residual
                 rightmargin=1\parindent, % distance to right-hand edge of text block
                 resume % resume numbering automatically
                 }

% And, just for this example:
\usepackage[colorlinks]{hyperref} 
\usepackage[noabbrev]{cleveref} % package for advanced cross-referencing
\crefname{mylisti}{item}{items} % choose singular & plural names

\begin{document}
\noindent\dots
\begin{mylist}
\item \logic{p \implies q}
\item \logic{p}
\item \logic{\therefore\ q} \label{item:x}
\end{mylist}
\dots
\begin{mylist}  % numbering is resumed automatically
\item All bachelors are unmarried.
\item Jones is a bachelor.
\item \logic{\therefore\ \text{Jones is unmarried.}} 
\item \lipsum*[2] \label{item:y} % item with filler text
\end{mylist}

\hrule % to illustrate width of text block

\bigskip

% Use "\cref" to create cross-references to multiple items: 
Cross-references to \cref{item:x,item:y}.

\end{document}