Merge pull request #536 from drlippman/feature.hatcommand
Add \hat command
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js
index e0e2d99..483d591 100644
--- a/src/commands/math/commands.js
+++ b/src/commands/math/commands.js
@@ -474,6 +474,17 @@
};
});
+var Hat = LatexCmds.hat = P(MathCommand, function(_, super_) {
+ _.ctrlSeq = '\\hat';
+ _.htmlTemplate =
+ '<span class="mq-non-leaf">'
+ + '<span class="mq-hat-prefix">^</span>'
+ + '<span class="mq-hat-stem">&0</span>'
+ + '</span>'
+ ;
+ _.textTemplate = ['hat(', ')'];
+});
+
var NthRoot =
LatexCmds.nthroot = P(SquareRoot, function(_, super_) {
_.htmlTemplate =
diff --git a/src/css/math.less b/src/css/math.less
index e65ae15..389058c 100644
--- a/src/css/math.less
+++ b/src/css/math.less
@@ -304,6 +304,21 @@
display: block;
text-align: center;
}
+
+ .mq-hat-prefix {
+ display: block;
+ text-align: center;
+ line-height: .95em;
+ margin-bottom: -.7em;
+ transform: scaleX(1.5);
+ -moz-transform: scaleX(1.5);
+ -o-transform: scaleX(1.5);
+ -webkit-transform: scaleX(1.5);
+ }
+
+ .mq-hat-stem {
+ display: block;
+ }
.mq-large-operator {
vertical-align: -.2em;