Displayed, single line equations with quantifiers aligned to the left
Is there an environment (or standard framework) to typeset a (single line) displayed equation with a "short" quantification that gives the following result?
That is, the "main" part of the equation is centered (as if nothing else were there), and the quantifier part is aligned to the left with some indentation. I don't think this is supposed to work for longer strings, and I am not looking for a solution that does.
I have found similar questions here (e.g. equation center, quantifier push right), but solutions like
begin{flalign}
forall x in X &&& P(x) &&
end{flalign}
are not what I'm looking for since $P(x)$ is not centred within the page, and $forall xin X$ is not indented. Adding
begin{flalign}
qquad forall x in X &&& P(x) &&
end{flalign}
does seem to get the desired indentation, but $P(x)$ is now even less centred.
spacing equations alignment
add a comment |
Is there an environment (or standard framework) to typeset a (single line) displayed equation with a "short" quantification that gives the following result?
That is, the "main" part of the equation is centered (as if nothing else were there), and the quantifier part is aligned to the left with some indentation. I don't think this is supposed to work for longer strings, and I am not looking for a solution that does.
I have found similar questions here (e.g. equation center, quantifier push right), but solutions like
begin{flalign}
forall x in X &&& P(x) &&
end{flalign}
are not what I'm looking for since $P(x)$ is not centred within the page, and $forall xin X$ is not indented. Adding
begin{flalign}
qquad forall x in X &&& P(x) &&
end{flalign}
does seem to get the desired indentation, but $P(x)$ is now even less centred.
spacing equations alignment
2
your image shows an unnumbered equation but your code fragments useflalign
rather thanflalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)
– David Carlisle
Dec 16 at 21:42
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13
add a comment |
Is there an environment (or standard framework) to typeset a (single line) displayed equation with a "short" quantification that gives the following result?
That is, the "main" part of the equation is centered (as if nothing else were there), and the quantifier part is aligned to the left with some indentation. I don't think this is supposed to work for longer strings, and I am not looking for a solution that does.
I have found similar questions here (e.g. equation center, quantifier push right), but solutions like
begin{flalign}
forall x in X &&& P(x) &&
end{flalign}
are not what I'm looking for since $P(x)$ is not centred within the page, and $forall xin X$ is not indented. Adding
begin{flalign}
qquad forall x in X &&& P(x) &&
end{flalign}
does seem to get the desired indentation, but $P(x)$ is now even less centred.
spacing equations alignment
Is there an environment (or standard framework) to typeset a (single line) displayed equation with a "short" quantification that gives the following result?
That is, the "main" part of the equation is centered (as if nothing else were there), and the quantifier part is aligned to the left with some indentation. I don't think this is supposed to work for longer strings, and I am not looking for a solution that does.
I have found similar questions here (e.g. equation center, quantifier push right), but solutions like
begin{flalign}
forall x in X &&& P(x) &&
end{flalign}
are not what I'm looking for since $P(x)$ is not centred within the page, and $forall xin X$ is not indented. Adding
begin{flalign}
qquad forall x in X &&& P(x) &&
end{flalign}
does seem to get the desired indentation, but $P(x)$ is now even less centred.
spacing equations alignment
spacing equations alignment
edited Dec 16 at 20:42
Bernard
165k769193
165k769193
asked Dec 16 at 20:18
prt13463
1307
1307
2
your image shows an unnumbered equation but your code fragments useflalign
rather thanflalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)
– David Carlisle
Dec 16 at 21:42
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13
add a comment |
2
your image shows an unnumbered equation but your code fragments useflalign
rather thanflalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)
– David Carlisle
Dec 16 at 21:42
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13
2
2
your image shows an unnumbered equation but your code fragments use
flalign
rather than flalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)– David Carlisle
Dec 16 at 21:42
your image shows an unnumbered equation but your code fragments use
flalign
rather than flalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)– David Carlisle
Dec 16 at 21:42
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13
add a comment |
3 Answers
3
active
oldest
votes
Here's a proposal that does the centering when feasible, resorting to standard centering otherwise. (Thanks to Mico for the coding.)
documentclass{book}
usepackage{amsmath,amssymb,amsthm}
usepackage{environ}
theoremstyle{definition}
newtheorem{defn}{Definition}[section]
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
makeatletter
NewEnviron{quantifiedequation}[1]{% #1 is the quantifiers
begin{equation}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation}
}
NewEnviron{quantifiedequation*}[1]{% #1 is the quantifiers
begin{equation*}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation*}
}
newcommand{make@quantifiedequation}[2]{%
m@th % remove mathsurround
sboxz@{$displaystyle#2$}% measure the quantifiers
sboxtw@{letlabel@gobble$displaystyle#1$}
ifdimdimexpr 1em+wdz@+0.5wdtw@+2em>0.5displaywidth
% centering is not possible
#2qquad#1
else
makebox[0pt][r]{%
makebox[dimexpr0.5displaywidth-0.5wdtw@][l]{quadboxz@}%
}#1
fi
}
makeatother
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
label{qeq}
end{quantifiedequation}
end{defn}
Here's the reference eqref{qeq}.
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
+bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
end{document}
add a comment |
I'm not aware of a ready-made environment or "standard framework" that does exactly what you're looking to achieve. However, it's not too much work to create a custom macro that gets the job done.
Note that the macro quant
-- you're obviously free to choose a different name for this macro -- takes 2 arguments: the quantifier (which is indented by quad
from the left-hand edge of the text block; feel free to change the indentation amount) and the actual equation. Do note that because the equation is centered exactly on the line, the whitespace to its left and right won't be of equal length (since the whitespace on the left is reduced by the presence of the quantier).
Observe that equation numbering isn't an option, but then I got the impression that automatic equation numbering isn't a requirement. Do advise if it is.
Observe also that if quantifier and/or the equation are quite long, they will likely overlap in a very unsightly way. I gather, though, that this is not likely to be an issue.
documentclass{report}
usepackage[T1]{fontenc}
usepackage{amsmath,amssymb,amsthm}
theoremstyle{definition}
newtheorem{defn}{Definition}
counterwithin{defn}{section}
%% Set up a macro called "quant":
newcommand{quant}[2]{par%
vspace{abovedisplayskip}%
noindent%
parbox{0pt}{mbox{quad$displaystyle #1$}}
hfil $displaystyle #2$ hfillpar
vspace{belowdisplayskip}}
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
quant{forall,bff,bfgin C^infty(p)}{%
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)}
end{defn}
end{document}
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
add a comment |
How about this?
documentclass{article}
usepackage{showframe}
renewcommand{ShowFrameLinethickness}{0.3pt}
usepackage{mathtools}
begin{document}
begin{flalign}
quad mathrlap{forall x in X} &&& P(x) &&
end{flalign}
end{document}
With this approach,P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?
– Mico
Dec 16 at 21:06
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding aquad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.
– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466127%2fdisplayed-single-line-equations-with-quantifiers-aligned-to-the-left%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here's a proposal that does the centering when feasible, resorting to standard centering otherwise. (Thanks to Mico for the coding.)
documentclass{book}
usepackage{amsmath,amssymb,amsthm}
usepackage{environ}
theoremstyle{definition}
newtheorem{defn}{Definition}[section]
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
makeatletter
NewEnviron{quantifiedequation}[1]{% #1 is the quantifiers
begin{equation}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation}
}
NewEnviron{quantifiedequation*}[1]{% #1 is the quantifiers
begin{equation*}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation*}
}
newcommand{make@quantifiedequation}[2]{%
m@th % remove mathsurround
sboxz@{$displaystyle#2$}% measure the quantifiers
sboxtw@{letlabel@gobble$displaystyle#1$}
ifdimdimexpr 1em+wdz@+0.5wdtw@+2em>0.5displaywidth
% centering is not possible
#2qquad#1
else
makebox[0pt][r]{%
makebox[dimexpr0.5displaywidth-0.5wdtw@][l]{quadboxz@}%
}#1
fi
}
makeatother
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
label{qeq}
end{quantifiedequation}
end{defn}
Here's the reference eqref{qeq}.
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
+bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
end{document}
add a comment |
Here's a proposal that does the centering when feasible, resorting to standard centering otherwise. (Thanks to Mico for the coding.)
documentclass{book}
usepackage{amsmath,amssymb,amsthm}
usepackage{environ}
theoremstyle{definition}
newtheorem{defn}{Definition}[section]
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
makeatletter
NewEnviron{quantifiedequation}[1]{% #1 is the quantifiers
begin{equation}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation}
}
NewEnviron{quantifiedequation*}[1]{% #1 is the quantifiers
begin{equation*}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation*}
}
newcommand{make@quantifiedequation}[2]{%
m@th % remove mathsurround
sboxz@{$displaystyle#2$}% measure the quantifiers
sboxtw@{letlabel@gobble$displaystyle#1$}
ifdimdimexpr 1em+wdz@+0.5wdtw@+2em>0.5displaywidth
% centering is not possible
#2qquad#1
else
makebox[0pt][r]{%
makebox[dimexpr0.5displaywidth-0.5wdtw@][l]{quadboxz@}%
}#1
fi
}
makeatother
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
label{qeq}
end{quantifiedequation}
end{defn}
Here's the reference eqref{qeq}.
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
+bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
end{document}
add a comment |
Here's a proposal that does the centering when feasible, resorting to standard centering otherwise. (Thanks to Mico for the coding.)
documentclass{book}
usepackage{amsmath,amssymb,amsthm}
usepackage{environ}
theoremstyle{definition}
newtheorem{defn}{Definition}[section]
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
makeatletter
NewEnviron{quantifiedequation}[1]{% #1 is the quantifiers
begin{equation}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation}
}
NewEnviron{quantifiedequation*}[1]{% #1 is the quantifiers
begin{equation*}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation*}
}
newcommand{make@quantifiedequation}[2]{%
m@th % remove mathsurround
sboxz@{$displaystyle#2$}% measure the quantifiers
sboxtw@{letlabel@gobble$displaystyle#1$}
ifdimdimexpr 1em+wdz@+0.5wdtw@+2em>0.5displaywidth
% centering is not possible
#2qquad#1
else
makebox[0pt][r]{%
makebox[dimexpr0.5displaywidth-0.5wdtw@][l]{quadboxz@}%
}#1
fi
}
makeatother
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
label{qeq}
end{quantifiedequation}
end{defn}
Here's the reference eqref{qeq}.
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
+bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
end{document}
Here's a proposal that does the centering when feasible, resorting to standard centering otherwise. (Thanks to Mico for the coding.)
documentclass{book}
usepackage{amsmath,amssymb,amsthm}
usepackage{environ}
theoremstyle{definition}
newtheorem{defn}{Definition}[section]
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
makeatletter
NewEnviron{quantifiedequation}[1]{% #1 is the quantifiers
begin{equation}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation}
}
NewEnviron{quantifiedequation*}[1]{% #1 is the quantifiers
begin{equation*}
expandaftermake@quantifiedequationexpandafter{BODY}{#1}
end{equation*}
}
newcommand{make@quantifiedequation}[2]{%
m@th % remove mathsurround
sboxz@{$displaystyle#2$}% measure the quantifiers
sboxtw@{letlabel@gobble$displaystyle#1$}
ifdimdimexpr 1em+wdz@+0.5wdtw@+2em>0.5displaywidth
% centering is not possible
#2qquad#1
else
makebox[0pt][r]{%
makebox[dimexpr0.5displaywidth-0.5wdtw@][l]{quadboxz@}%
}#1
fi
}
makeatother
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
label{qeq}
end{quantifiedequation}
end{defn}
Here's the reference eqref{qeq}.
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
begin{quantifiedequation*}{forall,bff,bfgin C^infty(p)}
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)
+bff(p)X(bfg)+bfg(p)X(bff)
end{quantifiedequation*}
end{defn}
end{document}
answered Dec 16 at 21:45
egreg
708k8618813163
708k8618813163
add a comment |
add a comment |
I'm not aware of a ready-made environment or "standard framework" that does exactly what you're looking to achieve. However, it's not too much work to create a custom macro that gets the job done.
Note that the macro quant
-- you're obviously free to choose a different name for this macro -- takes 2 arguments: the quantifier (which is indented by quad
from the left-hand edge of the text block; feel free to change the indentation amount) and the actual equation. Do note that because the equation is centered exactly on the line, the whitespace to its left and right won't be of equal length (since the whitespace on the left is reduced by the presence of the quantier).
Observe that equation numbering isn't an option, but then I got the impression that automatic equation numbering isn't a requirement. Do advise if it is.
Observe also that if quantifier and/or the equation are quite long, they will likely overlap in a very unsightly way. I gather, though, that this is not likely to be an issue.
documentclass{report}
usepackage[T1]{fontenc}
usepackage{amsmath,amssymb,amsthm}
theoremstyle{definition}
newtheorem{defn}{Definition}
counterwithin{defn}{section}
%% Set up a macro called "quant":
newcommand{quant}[2]{par%
vspace{abovedisplayskip}%
noindent%
parbox{0pt}{mbox{quad$displaystyle #1$}}
hfil $displaystyle #2$ hfillpar
vspace{belowdisplayskip}}
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
quant{forall,bff,bfgin C^infty(p)}{%
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)}
end{defn}
end{document}
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
add a comment |
I'm not aware of a ready-made environment or "standard framework" that does exactly what you're looking to achieve. However, it's not too much work to create a custom macro that gets the job done.
Note that the macro quant
-- you're obviously free to choose a different name for this macro -- takes 2 arguments: the quantifier (which is indented by quad
from the left-hand edge of the text block; feel free to change the indentation amount) and the actual equation. Do note that because the equation is centered exactly on the line, the whitespace to its left and right won't be of equal length (since the whitespace on the left is reduced by the presence of the quantier).
Observe that equation numbering isn't an option, but then I got the impression that automatic equation numbering isn't a requirement. Do advise if it is.
Observe also that if quantifier and/or the equation are quite long, they will likely overlap in a very unsightly way. I gather, though, that this is not likely to be an issue.
documentclass{report}
usepackage[T1]{fontenc}
usepackage{amsmath,amssymb,amsthm}
theoremstyle{definition}
newtheorem{defn}{Definition}
counterwithin{defn}{section}
%% Set up a macro called "quant":
newcommand{quant}[2]{par%
vspace{abovedisplayskip}%
noindent%
parbox{0pt}{mbox{quad$displaystyle #1$}}
hfil $displaystyle #2$ hfillpar
vspace{belowdisplayskip}}
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
quant{forall,bff,bfgin C^infty(p)}{%
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)}
end{defn}
end{document}
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
add a comment |
I'm not aware of a ready-made environment or "standard framework" that does exactly what you're looking to achieve. However, it's not too much work to create a custom macro that gets the job done.
Note that the macro quant
-- you're obviously free to choose a different name for this macro -- takes 2 arguments: the quantifier (which is indented by quad
from the left-hand edge of the text block; feel free to change the indentation amount) and the actual equation. Do note that because the equation is centered exactly on the line, the whitespace to its left and right won't be of equal length (since the whitespace on the left is reduced by the presence of the quantier).
Observe that equation numbering isn't an option, but then I got the impression that automatic equation numbering isn't a requirement. Do advise if it is.
Observe also that if quantifier and/or the equation are quite long, they will likely overlap in a very unsightly way. I gather, though, that this is not likely to be an issue.
documentclass{report}
usepackage[T1]{fontenc}
usepackage{amsmath,amssymb,amsthm}
theoremstyle{definition}
newtheorem{defn}{Definition}
counterwithin{defn}{section}
%% Set up a macro called "quant":
newcommand{quant}[2]{par%
vspace{abovedisplayskip}%
noindent%
parbox{0pt}{mbox{quad$displaystyle #1$}}
hfil $displaystyle #2$ hfillpar
vspace{belowdisplayskip}}
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
quant{forall,bff,bfgin C^infty(p)}{%
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)}
end{defn}
end{document}
I'm not aware of a ready-made environment or "standard framework" that does exactly what you're looking to achieve. However, it's not too much work to create a custom macro that gets the job done.
Note that the macro quant
-- you're obviously free to choose a different name for this macro -- takes 2 arguments: the quantifier (which is indented by quad
from the left-hand edge of the text block; feel free to change the indentation amount) and the actual equation. Do note that because the equation is centered exactly on the line, the whitespace to its left and right won't be of equal length (since the whitespace on the left is reduced by the presence of the quantier).
Observe that equation numbering isn't an option, but then I got the impression that automatic equation numbering isn't a requirement. Do advise if it is.
Observe also that if quantifier and/or the equation are quite long, they will likely overlap in a very unsightly way. I gather, though, that this is not likely to be an issue.
documentclass{report}
usepackage[T1]{fontenc}
usepackage{amsmath,amssymb,amsthm}
theoremstyle{definition}
newtheorem{defn}{Definition}
counterwithin{defn}{section}
%% Set up a macro called "quant":
newcommand{quant}[2]{par%
vspace{abovedisplayskip}%
noindent%
parbox{0pt}{mbox{quad$displaystyle #1$}}
hfil $displaystyle #2$ hfillpar
vspace{belowdisplayskip}}
newcommandbff{mathbf{f}}
newcommandbfg{mathbf{g}}
begin{document}
setcounter{chapter}{1}
setcounter{section}{1}
setcounter{defn}{12}
begin{defn}
Let $M$ be a manifold. A emph{derivation} at a point $pin M$
is an $mathbb{R}$-linear map $Xcolon C^infty(p)tomathbb{R}$
which satisfies the emph{Leibniz rule}
quant{forall,bff,bfgin C^infty(p)}{%
X(bffbfg)=bff(p)X(bfg)+bfg(p)X(bff)}
end{defn}
end{document}
edited Dec 16 at 22:17
answered Dec 16 at 20:54
Mico
273k30369756
273k30369756
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
add a comment |
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
Thank you. Actually, yes, it's not a huge deal-breaker, but it would be helpful if this supported equation numbering. I understand that egreg improved your code to implement this. Thanks to both!
– prt13463
Dec 16 at 22:42
add a comment |
How about this?
documentclass{article}
usepackage{showframe}
renewcommand{ShowFrameLinethickness}{0.3pt}
usepackage{mathtools}
begin{document}
begin{flalign}
quad mathrlap{forall x in X} &&& P(x) &&
end{flalign}
end{document}
With this approach,P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?
– Mico
Dec 16 at 21:06
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding aquad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.
– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
add a comment |
How about this?
documentclass{article}
usepackage{showframe}
renewcommand{ShowFrameLinethickness}{0.3pt}
usepackage{mathtools}
begin{document}
begin{flalign}
quad mathrlap{forall x in X} &&& P(x) &&
end{flalign}
end{document}
With this approach,P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?
– Mico
Dec 16 at 21:06
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding aquad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.
– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
add a comment |
How about this?
documentclass{article}
usepackage{showframe}
renewcommand{ShowFrameLinethickness}{0.3pt}
usepackage{mathtools}
begin{document}
begin{flalign}
quad mathrlap{forall x in X} &&& P(x) &&
end{flalign}
end{document}
How about this?
documentclass{article}
usepackage{showframe}
renewcommand{ShowFrameLinethickness}{0.3pt}
usepackage{mathtools}
begin{document}
begin{flalign}
quad mathrlap{forall x in X} &&& P(x) &&
end{flalign}
end{document}
answered Dec 16 at 20:53
Bernard
165k769193
165k769193
With this approach,P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?
– Mico
Dec 16 at 21:06
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding aquad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.
– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
add a comment |
With this approach,P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?
– Mico
Dec 16 at 21:06
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding aquad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.
– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
With this approach,
P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?– Mico
Dec 16 at 21:06
With this approach,
P(x)
won't be place exactly in the center of the entire line. Instead, it will be centered on the line segment that stretches from the left-hand edge of the text block to (but not including) the equation number. Is there a way to achieve full centering (which seems to be one of the OP's formatting objectives)?– Mico
Dec 16 at 21:06
1
1
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding a
quad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.– Bernard
Dec 16 at 21:36
@Mico: Strangely, my code is the closest to the expected result (lengths difference < 1pt between both blank spaces). Adding a
quad
on the right side makes the difference greater (6 to 7 pt). So clearly there are placement details I have no control on.– Bernard
Dec 16 at 21:36
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
Although I have accepted egreg's answer, this also works well and produces the desired output.
– prt13463
Dec 16 at 23:10
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466127%2fdisplayed-single-line-equations-with-quantifiers-aligned-to-the-left%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
your image shows an unnumbered equation but your code fragments use
flalign
rather thanflalign*
so produce numbered equations. (This has a bearing on the answers see for example Mico's comment on @Bernard's question which wouldn't apply in the unnumbered case)– David Carlisle
Dec 16 at 21:42
That's true, and I apologise for the confusion. As I mentioned in a comment under Mico's answer, I was looking for a solution that would support equation numbering.
– prt13463
Dec 16 at 23:13