4

Can anyone tell me how to get \hfill like spacing in double dollar environment? Please find the image to know what exactly I am asking for.enter image description here

1
  • Are ou compiling i plain TeX?
    – Bernard
    Mar 16, 2018 at 9:33

3 Answers 3

5

You need not to use \hfil TeX primitive but \eqno TeX primitive:

\def\n||#1||{\mathopen{\Vert}#1\mathclose{\Vert}}

\noindent{\bf Definition.} A normed linear space $A, \n||.||$ over $C$ is said
be a {\it normed algebra}, if $A$ is an algebra and
$$
  \n||xy|| \le \n||x|| \n||y|| \eqno (x, y \in A)
$$

\bye
0
3

Here are two possible LaTeX-based solutions. The first solution uses the \tag* directive to place (x,y\in A). at the right-hand edge. A possible downside of this notation is that (x,y\in A). might be misinterpreted as some kind of equation "number". The second solution therefore places this element closer to the other material of the displayed equation.

enter image description here

Note the creation of a "high-level" macro named \alg to denote algebras. In the definition, \alg is set to use \mathcal; depending on your preferences and the notational conventions you may need to satisfy, other possible choices are \mathscr, \mathfrak, and \mathsf. (Writing $A$ may not be enough to create a sufficient visual distinction for uppercase letters that are supposed to denote algebras.)

\documentclass{report}
\usepackage{mathtools}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\usepackage{amssymb}
\newcommand{\alg}[1]{\mathcal{#1}} % or: \mathsf, \mathfrak, \mathscr
\usepackage{amsthm}
\theoremstyle{definition} % upright (non-italic) text in body of env.
\newtheorem{defn}{Definition}[section]

\begin{document}
\setcounter{chapter}{1} % just for this example
\setcounter{section}{1}
\setcounter{defn}{1}

%% first solution
\begin{defn}
A normed linear space $(\alg{A},\norm{\cdot})$ over $\mathbb{C}$ is said
to be a \emph{normed algebra} if $\alg{A}$ is an algebra and
\[
\norm{xy} \le \norm{x}\norm{y} \tag*{($x,y\in\alg{A}$).}
\]
\end{defn}

\refstepcounter{section} % optional

%% second solution
\begin{defn}
A normed linear space $(\alg{A},\norm{\cdot})$ over $\mathbb{C}$ is said
to be a \emph{normed algebra} if $\alg{A}$ is an algebra and
\[
\norm{xy} \le \norm{x}\norm{y} \quad \forall\ x,y\in\alg{A}\,.
\]
\end{defn}

\end{document} 
2
  • In my opinion one should type ... if $A$ is an algebra and, for all $x,y\in A$,\[\norm{xy}\le\norm{x}\norm{y}.\]. The “x,y in A” in parentheses at the right margin means nothing and is at least distracting. I know it's frequently seen like in the picture, but it doesn't make it better.
    – egreg
    Mar 16, 2018 at 12:42
  • @egreg - Thanks for this. It was precisely because I believed that "(x,y in A)" at the right-hand margin verges on being misleading or distracting that I came up with the second solution shown above. I fully agree that placing "x,y in A" *before" the display-equation part is even better than what I wrote...
    – Mico
    Mar 16, 2018 at 13:24
1

Using \tag*{} in a right-numbered environment is a "hack" that hijacks the equation numbering mechanism (works fine if all equations are numbered on the right).

For a more general solution, working for displayed equations in LaTeX is to use the flalign environment, which also works with left-numbered equations:

enter image description here

Columns are separated with & as usual and the first column is aligned to the very left, the last column to the very right (same effect as using \hfill).

Here is the code for the above picture

\documentclass[leqno]{article}
\usepackage{mathtools}
\usepackage{amsthm,amssymb}
\theoremstyle{definition}
\numberwithin{equation}{section}
\newtheorem{definition}[equation]{Definition}

\begin{document}

\section{Definitions}

\begin{definition}
A normed linear space $(A, \lVert {\cdot} \rVert)$ over $\mathbb{C}$ is said
to be a \emph{normed algebra} if $A$ is an algebra and
\begin{flalign*}
&& \lVert xy \rVert \leq \lVert x \rVert \lVert y \rVert && (x, y \in A).
\end{flalign*}
\end{definition}

You can also remove the asterisk to get a numbered equation.

\begin{definition}
A normed linear space $(A, \lVert {\cdot} \rVert)$ over $\mathbb{C}$ is said
to be a \emph{normed algebra} if $A$ is an algebra and
\begin{flalign}
\label{normedalgebra}
&& \lVert xy \rVert \leq \lVert x \rVert \lVert y \rVert && (x, y \in A).
\end{flalign}
\end{definition}

The condition (\ref{normedalgebra}) is called XYZ.

\end{document}

You must log in to answer this question.

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