5

I want to display a numbered math expression without creating a new line. Example:

\textbf{Claim}:
            \begin{equation}\label{fpreservesorder}
            m,n\in{}\mathbb{Z}\,\,\,\wedge{}\,\,\,n<m\implies{}f(n)<f(m)
            \end{equation}

enter image description here

What is the proper way to eliminate the new line? If I use inline mode I lose the numbering. \align and \equation create the new line. \aligned and \multlined seem not to number the expressions.

5
  • 1
    Theoretically you could put it into a small minipage, but you would still waste all that vertical space. You could use inline math with \quad\refstepcounter{equation}(\theequation). Mar 15, 2022 at 17:43
  • 1
    unrelated but don't use {} as in \in{} and \wedge{} they create empty math atoms that will in general mess up your spacing, Mar 15, 2022 at 23:49
  • Appreciate that! I had no idea.
    – Gary
    Mar 16, 2022 at 0:44
  • Putting an equation into a wrapfigure might be interesting. Mar 16, 2022 at 15:19
  • Depending on the spacing you want, you could use \medskip\textbf{Claim}:\vspace{-\baselineskip}
    – Sandy G
    Mar 19, 2022 at 22:14

3 Answers 3

3

(I've augmented this answer to address the OP's follow-up question, about how to allow the claim to be split -- more or less automatically, I think -- across two or more lines.)

You could render the material in inline math and place it, along with the word Claim and the equation number, in a center environment. The reason I suggest you embed the material in a center environment that it'll provide some vertical whitespace padding, which is probably what you want anyway. In the code below, this is achieved by placing the claim in the argument of a macro called \Claim.

If the claim is too long to fit on a single line, you could use a variant of \Claim -- called \BoxClaim in the code below -- that places the material in a \parbox (sorry for the LaTeX jargon) of width, say, 0.7\textwidth. If you go this route, be sure not to overuse \left and \right since material in a \left...\right group cannot be line-broken. You may also need to supply suitably placed \allowbreak directives to nudge LaTeX toward placing line breaks in mathematically (as opposed to typographically) superior locations.

enter image description here

\documentclass{report} % or some other suitable document class
\usepackage{amsmath,amssymb}
\counterwithin{equation}{section} % just for this example

\newcommand\Claim[1]{\refstepcounter{equation}
   \begin{center}
      \textbf{\textup{Claim}}\hfill$\displaystyle #1$\hfill%
      \textnormal{(\theequation)}
   \end{center}}
\newcommand\mybox[1]{\parbox[t]{0.7\textwidth}{\raggedright $#1$}}
\newcommand\BoxClaim[1]{\Claim{\mybox{#1}}}

\newcommand\blurb{%  % supplied by the OP
   \exists m\,\bigl[(m\in A \enspace\lor\enspace m\in B) \enspace\wedge\enspace 
   \forall a\forall b\bigl((a\in A \enspace\wedge\enspace b\in B) 
   \allowbreak \implies a\leq m \enspace\wedge\enspace m\leq b \bigr)\bigr]}

\begin{document} 

\setcounter{chapter}{1} % just for this example
\setcounter{section}{5}

\noindent
Some text \dots
\Claim{m,n\in\mathbb{Z}\quad\wedge\quad n<m\implies f(n)<f(m)} \label{claim:mn}
A cross-reference to equation \eqref{claim:mn}.
\BoxClaim{\blurb}\label{claim:blurb}
A cross-reference to equation \eqref{claim:blurb}.

\end{document}

Addendum to address some of the OP's follow-up questions:

  • \refstepcounter{<somecounter>} increments the counter named somecounter by 1, in such a manner that if you were to add a \label directive, you could then cross-reference the object (here: an equation) via the standard \label-\ref mechanism.

  • \textup{(\theequation)} prints the representation of the equation number (here: section prefix plus dot plus actual equation number), surrounded by parentheses, using the upright font shape. The \textup directive is there to ensure that the composite equation number is always printed upright even if occurs in an evironment (such as a theorem-like environment) that typesets its contents in italics by default.


Second addendum: Do please look into the capabilities of the amsthm and ntheorem packages. The following sample code merely scratches the surface of what these packages can do.

\documentclass{article}
\usepackage{amsthm}       % or: \usepackage{ntheorem}
\newtheorem{claim}{Claim} % create a theorem-like environment called 'claim'
\begin{document}

\begin{claim} \label{claim:trivial}
We hold the following truth to be unalienable:
\begin{equation}
1+1=2
\end{equation}
\end{claim}
A cross-reference to Claim \ref{claim:trivial}.
\end{document}
9
  • Could you explain the function of \refstepcounter{equation}\textup{(\theequation)} ? I noticed that the spacing gets messed up when I omit it. Also, when the claim gets too long this has problems. Is there a way to break a long claim into multiple lines without generating another equation number?
    – Gary
    Mar 19, 2022 at 18:02
  • 1
    @Gary - Please see the addendum I just posted, on the meaning of \refstepcounter{equation}\textup{(\theequation)}. Please provide more information on the topic of "the claim gets too long".
    – Mico
    Mar 19, 2022 at 18:30
  • Thanks for the addendum. I'll check it out. If the proposition/claim gets long like $\exists m\left((m\in A\enspace \lor \enspace m\in B)\enspace \wedge \enspace \forall a \forall b((a\in A \enspace \wedge \enspace b\in B)\implies a\leq m \enspace \wedge \enspace m\leq b )\right)$, then the "Claim" text shoots up a line and the equation number gets displaced down a line (or more). Basically I don't know how to break the proposition/claim into multiple lines while keeping the numbering and "Claim" text intact.
    – Gary
    Mar 19, 2022 at 18:34
  • 1
    @Gary - I've modified my answer to show how the solution may be augmented (with a new macro called \BoxClaim) to handle claims that are "long" -- say, wider than 0.7\textwidth.
    – Mico
    Mar 20, 2022 at 8:43
  • The screenshot looks beautiful! So many math books have propositions/claims like these but LaTeX has no built in support for them, shocking. Did your addendum go missing? I didn't have a chance to read it yet. I am surprised that you used \newcommand for \blurb. Is that something you recommend for longer expressions? My instinct is to put the expression directly into \BoxClaim{} in the main body.
    – Gary
    Mar 20, 2022 at 17:12
4

You could abuse flalign or do a hand-made job using some low-level tricks.

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\noindent X\dotfill X
\begin{flalign}
&\textbf{Claim:} && m,n\in\mathbb{Z} \wedge n<m \implies f(n)<f(m) &
\label{fpreservesorder}
\end{flalign}

\noindent X\dotfill X
\begin{equation*}\refstepcounter{equation}
\hspace{0pt}
\makebox[0pt][l]{\textbf{Claim:}}
\hspace{1000pt minus 1fil}
m,n\in\mathbb{Z} \wedge n<m \implies f(n)<f(m)
\hspace{1000pt minus 1fil}
\makebox[0pt][r]{\eqref{fpreservesorder2}}
\label{fpreservesorder2}
\end{equation*}
Another equation to see that the numbering is good
\begin{equation}
1=1
\end{equation}

\end{document}

enter image description here

Beware that in the second case the equation might overlap “Claim”, if too long. Also, \label is mandatory in this construct.

Of course, if you have several of these claims, it's better to define a new environment. I provide definitions for both methods, take your pick. This also supports hyperref; in case you don't use it, leave out the definition of \eqrefstar and change \eqrefstar into eqref. The claim2 environment doesn't require a \label inside it.

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{hyperref}

% for the first
\NewDocumentEnvironment{claim1}{b}
 {\begin{flalign}&\textbf{Claim:}&&#1&\end{flalign}}
 {}

\makeatletter
\newcounter{claim}
\newcommand{\eqrefstar}[1]{\textup{\tagform@{\ref*{#1}}}}
\newenvironment{claim2}
 {%
  \begin{equation*}
  \refstepcounter{equation}
  \stepcounter{claim}
  \ltx@label{claim-\theclaim}
  \hspace{0pt}
  \makebox[0pt][l]{\textbf{Claim:}}
  \hspace{1000pt minus 1fil}
 }
 {%
  \hspace{1000pt minus 1fil}
  \makebox[0pt][r]{\eqrefstar{claim-\theclaim}}
  \end{equation*}\ignorespacesafterend
 }
\makeatother

\begin{document}

\noindent X\dotfill X
\begin{claim1}
m,n\in\mathbb{Z} \wedge n<m \implies f(n)<f(m)
\label{fpreservesorder}
\end{claim1}

\noindent X\dotfill X
\begin{claim2}
m,n\in\mathbb{Z} \wedge n<m \implies f(n)<f(m)
\label{fpreservesorder2}
\end{claim2}
Another equation to see that the numbering is good
\begin{equation}
1=1
\end{equation}

\ref{fpreservesorder}

\ref{fpreservesorder2}

\end{document}

enter image description here

Final suggestion: leave “Claim:” on a line by itself.

4
  • In what sense is the first method an abuse of flalign?
    – Gary
    Mar 19, 2022 at 17:10
  • Also, it seems that breaking with \\ when the claim gets too long leads to another equation numbering on the following line. I do not want this.
    – Gary
    Mar 19, 2022 at 17:19
  • @Gary I said it is a bad way to do such things… And you didn't specify you wanted line breaks, did you? Use the flalign method, with \notag in the first line.
    – egreg
    Mar 19, 2022 at 17:24
  • I'm asking why it's bad/abuse. As for the line breaks: I am hoping to find a method that will work for a large variety of claims. Certainly many claims will take up more than a single line.
    – Gary
    Mar 19, 2022 at 17:59
3

You can use the fleqn environment, from nccmath, like this:

\documentclass{article}
\usepackage{showframe}

\usepackage{amsmath, amssymb, nccmath}

\begin{document}

\begin{fleqn}
    \begin{align}\label{fpreservesorder}
    &\textbf{Claim:} & & m,n\in{}\mathbb{Z}\,\,\,\wedge{}\,\,\,n<m\implies{}f(n)<f(m)
    \end{align}
    \end{fleqn}

\end{document} 

enter image description here

4
  • As soon as I \usepackage{nccmath}, I get an error: ! LaTeX Error: Command \darray already defined.
    – Gary
    Mar 15, 2022 at 20:14
  • @Gary: Strange … Maybe you're loading a package that's incompatible with nccmath?
    – Bernard
    Mar 15, 2022 at 20:48
  • mathtools, breqn, amssymb are the other packages I have loaded.
    – Gary
    Mar 15, 2022 at 21:09
  • The only one I never used is breqn (because it is said it has some problems). The other two are quite standard.
    – Bernard
    Mar 15, 2022 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .