Comments (13)
- yep, same went for
\sqrt[n]{}
and still goes for whitespace (\,
,
\:
,\;
,\!
) - yeah,
\vector
is meant for column vectors:
http://en.wikipedia.org/wiki/Column_vector
matrices are basically not supported at all. If you like, you could try
implementing a\matrix
command that's similar to\vector
but uses
<table><tr><td></table>
as it'shtml_template
. You may have to override
MathCommand::initBlocks
.
Han
On Fri, Apr 22, 2011 at 12:37 PM, jenseng <
[email protected]>wrote:
it looks like there are a couple problems around matrices:
- when you create a matrix in mathquill, the generated latex cannot
actually be parsed by mathquill. e.g. typing \vectorab
gives you the latex \begin{matrix}a\b\end{matrix}. when you try to
write that to mathquill, the rendered latex in mathquill just looks like
begin{matrix.- mathquill matrices don't really support columns. you can separate
elements in a row with spaces, but you can't actually make true columns
(separated by &) in latex. the effect is that it's difficult/impossible to
get your columns lined up when cells are different sizes. e.g. we should be
able to do stuff like this: http://latex.codecogs.com/gif.latex
?\begin{matrix}a+1&b\c&d\end{matrix}Reply to this email directly or view it on GitHub:
https://github.com/laughinghan/mathquill/issues/31
from mathquill.
k that makes sense, i'll take a stab at it ... i guess the only real issue with vectors is that mathquill doesn't parse the generated latex. that might be a little tricky to fix short of implementing matrices
from mathquill.
from mathquill.
what, two weeks of working with LaTeX doesn't make me an expert? :P
if i do anything around this, it'll be in its own experimental branch
from mathquill.
just intresting how current selection will work with table
<table>
<tr>
<span class="selection">
<td>1<td><td>2
</span>
<tr><td>3<td><td>4<td></tr>
</table>
from mathquill.
uh, does it? It would depend a lot on how the table is represented in the Math DOM
from mathquill.
Does it means that I can not to select a row? just td or table
from mathquill.
Matrix draft version
.mathquill-rendered-math .mtable {
text-align: center;
display: inline-table;
}
.mathquill-rendered-math .mtr {
margin: .2em 0;
display: table-row !important;
display: block;
}
.mathquill-rendered-math .mtd {
white-space: nowrap;
padding: 0 .1em;
display:table-cell !important;
display:inline-block;
}
function Matrix(replacedFragment) {
MathCommand.call(this, '\\matrix', undefined, undefined, replacedFragment);
}
_ = Matrix.prototype = new MathCommand;
_.html_template = ['<table class="mtable"><tr class="mtr"><td class="mtd"></td></tr></table>'];
_.initBlocks = function(replacedFragment) {
var self = this;
var newBlock, prev;
this.firstChild = newBlock = prev =
(replacedFragment && replacedFragment.blockify()) || new MathBlock;
newBlock.jQ = $("<span></span>")
.data(jQueryDataKey, {block: newBlock})
.append(newBlock.jQ)
.appendTo(self.jQ.find("td"));
newBlock.blur();
self.lastChild = newBlock;
newBlock.parent = self;
};
_.placeCursor = function(cursor) {
this.cursor = cursor.appendTo(this.firstChild);
};
_.latex = function() {
return '\\begin{matrix}' + this.foldChildren([], function(latex, child) {
latex.push(child.latex());
return latex;
}).join('\\\\') + '\\end{matrix}';
};
_.text = function() {
return '[' + this.foldChildren([], function(text, child) {
text.push(child.text());
return text;
}).join() + ']';
}
_.keydown = function(e) {
var currentBlock = this.cursor.parent;
var self = this;
if (currentBlock.parent === this) {
if (e.which === 13) { //enter
var tr = $('tr:last', this.jQ).clone(true);
var cb;
tr.find("td").html('').each(function(){
$(this).addClass("mtd");
var newBlock = new MathBlock;
cb = cb || newBlock;
newBlock.parent = self;
newBlock.jQ = $('<span></span>').data(jQueryDataKey, {block: newBlock}).appendTo(this);
newBlock.prev = self.lastChild;
self.lastChild.next = newBlock;
self.lastChild = newBlock;
self.cursor.appendTo(newBlock);
});
self.cursor.appendTo(cb).redraw();
tr.appendTo(this.jQ);
return false;
}
else if (e.which === 9 && !e.shiftKey && !currentBlock.next && self.jQ.find("tr").length == 1) { //tab
var newBlock = new MathBlock;
newBlock.parent = this;
var td = $('<td class="mtd"></td>').appendTo(currentBlock.jQ.parent().parent());
newBlock.jQ = $('<span></span>').data(jQueryDataKey, {block: newBlock}).appendTo(td);
this.lastChild = newBlock;
currentBlock.next = newBlock;
newBlock.prev = currentBlock;
this.cursor.appendTo(newBlock).redraw();
return false;
} else if (e.which === 8) { //backspace
if (currentBlock.isEmpty()) {
if (currentBlock.prev) {
this.cursor.appendTo(currentBlock.prev);
} else {
this.cursor.insertBefore(this);
}
return false;
}
else if (!this.cursor.prev)
return false;
}
}
return this.parent.keydown(e);
};
from mathquill.
damn it you're right, you can't select td
s or tr
s if Selection
has to be a span
. That's why array is currently implemented by having the children be display:block
, which won't work well for more than one column, unless we hack it to set the width on redraw
or something. An inline table clearly makes the most sense for matrices, it seems like what we should do is addClass('selection')
to the tr
s.
I'm not sure how best to change the architecture to support that, perhaps some way of moving the selection methods Cursor::selectLeft
, selectRight
, selectFrom
and Selection::levelUp
to MathElement
or something so they can be overridden.
from mathquill.
is it possible to type squareroot as sqrt as it is in desmos calculator and not as "\sqrt" ?
from mathquill.
I experienced this issue today ("begin{matrix") and wonder after 2 years if any update or fix is available somehow?
from mathquill.
The current plan is to simply remove the current implementation of \vector
, which was never very well thought-through. We do have some ideas for making a table-based vector or matrix environment, but they'll need to be much more deeply integrated than that was, to avoid problems like this.
from mathquill.
See #187.
from mathquill.
Related Issues (20)
- mathquill buill
- Saludos @garlofrank,
- What about the mathquill shortcut key documentation?
- Can't build a mathquill project on windows? Building from Source
- mathquill bug? mathquill can't wrap lines?
- mathquill ocr picture recognition
- \middle implementation HOT 1
- Make CI fail when no tests are run
- Storing StaticMath objects in a const variable causes a silent fail.
- MathQuill and Slack HOT 4
- How to customise default border HOT 2
- The brackets in the numerator overlap the line in the fraction HOT 1
- Underline arrows
- When is the next release of MathQuill?
- Configuring Keywords For StaticMath Fields
- UTF-16 surrogate pairs rendered separately when cursor is placed between them
- Cloning element containing Mathquill fields
- Can't get MathField to work on a very basic example HOT 1
- arrow with text above & below are not supported!!!
- \large symbol not supported
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathquill.