Giter Site home page Giter Site logo

matheditor's People

Contributors

kostub avatar maitbayev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matheditor's Issues

Fractions Inside Fraction Bug

When you hit the "/" key while in the numerator or denominator it adds a one to the number and leaves the original number behind.
math

How can I get result of calculations?

For display formulas can use "MTEditableMathLabel" but how can I get it's result ?
for example if I enter label.mathList.stringValue 5^{2}, how can I get it's output.. Please help me out with suitable sample if possible.
@kostub

Textalignment and Autoshrinking

So there are two things that I want to achieve with the MTEditableMathLabel.

  1. Change the Textalignment to left

  2. Make the Label expand / shrink with the latex inside. I have this code from the example and converted it to Swift 3

`func textModified(_ label: MTEditableMathLabel!) {
let minHeight: CGFloat = 64
// Increase the height of the label as the height increases.
let mathSize: CGSize = label.mathDisplaySize()

    if (mathSize.height > self.editLabel.frame.height - 10) {
        label.layoutIfNeeded()
        // animate

        self.editLabel.frame = CGRect(x: self.editLabel.frame.origin.x, y: self.editLabel.frame.origin.y, width: self.editLabel.frame.width, height: mathSize.height + 10)
        label.layoutIfNeeded()
    }
    else if (mathSize.height < self.editLabel.frame.height - 20) {
        
        let newHeight: CGFloat = max(mathSize.height + 10, minHeight);
        if (newHeight < self.editLabel.frame.height) {
            label.layoutIfNeeded()
            self.editLabel.frame = CGRect(x: self.editLabel.frame.origin.x, y: self.editLabel.frame.origin.y, width: self.editLabel.frame.width, height: newHeight)
            label.layoutIfNeeded()
        }
    }
    
    // Shrink the font as the label gets longer.
    if (mathSize.width > label.frame.size.width - 10) {
        label.fontSize = label.fontSize * 0.9;
        
    } else if (mathSize.width < label.frame.size.width - 40) {
        let fontSize: CGFloat = min(label.fontSize * 1.1, 30);
        if (fontSize > label.fontSize) {
            label.fontSize = fontSize;
        }
    }
}`

Do you have code do what this code is doing with the height with the width ?

Error when trying to edit Matrix

So I was working on making it possible, so that you could insert an editable Matrix in your editable math label. What I did was inserting this code into MTEditableMathLabel:

`- (void) insertMatrix: (int)rows :(int)columns :(NSString )type
{
MTMathAtom
atom = [MTMathAtomFactory placeholderMatrix:columns :rows :type];

if (_insertionIndex.subIndexType == kMTSubIndexTypeDenominator) {
    if (atom.type == kMTMathAtomRelation) {
        // pull the insertion index out
        _insertionIndex = [[_insertionIndex levelDown] next];
    }
}

if (atom) {
    if (![self updatePlaceholderIfPresent:atom]) {
        // If a placeholder wasn't updated then insert the new element.
        [self.mathList insertAtom:atom atListIndex:_insertionIndex];
    }
    if (atom.type == kMTMathAtomFraction) {
        // go to the numerator
        _insertionIndex = [_insertionIndex levelUpWithSubIndex:[MTMathListIndex level0Index:0] type:kMTSubIndexTypeNumerator];
    } else {
        _insertionIndex = _insertionIndex.next;
    }
}

self.label.mathList = self.mathList;
[self insertionPointChanged];

if ([self.delegate respondsToSelector:@selector(textModified:)]) {
    [self.delegate textModified:self];
}

}`

and this code into MTMathAtomFactory

`+ (MTMathAtom *)placeholderMatrix: (int)width :(int)height :(NSString )envname
{
NSError
error;

NSMutableArray<NSMutableArray<MTMathList*>*>* rows = [[NSMutableArray alloc] initWithCapacity:(NSInteger)height];
for (int y = 0; y < height; y++)
{
    NSMutableArray<MTMathList*>* row = [[NSMutableArray alloc] initWithCapacity:(NSInteger)width];
    
    for (int x = 0; x < width; x++)
    {
        MTMathList* list = [MTMathList new];
        
        [list addAtom:[self placeholder]];
        
        row[x] = list;
    }
    
    rows[y] = row;
}
MTMathAtom* table = [MTMathAtomFactory tableWithEnvironment:envname rows:rows error:&error];

return table;

}`

This displays the matrix fine, but when I try to select one of the Values in the matrix I get this error, which I have no idea where it is coming from.

'MTLine type regular inside an MTLine - shouldn't happen'

But the display is exactly the way I want it to be. What is wrong here ? I really need help on this please. Thanks a lot for any help in advance.

becomeFirstResponder takes a long time

There is a significant delay between a user initiating the edit on the label and the math keyboard appearing, resulting in a poor user experience.

I am wondering if you have any plans to address this. If not, any pointers for how it could be fixed would be appreciated.

Latex to unicode normal form

Is there a way in the iosMath Library to transform the Latex into unicode form or do I have to write a parser for this?

I used the [MTMathListBuilder mathListToString:[_mathLabel mathList]]; to get the Latex from the EditableLabel, now I want to parse the Latex into the unicode form, for example

\frac{5x^{2}}{2}+(58+95x)\div \cos (x^{2})

(5x^2)/(2) + (58+95x) / cos (x^2)

Fill label from LaTeX

Hi,
first of all thanks for your amazing work, I hope you still follow this project. How can I pre-fill the label starting from a LaTeX string?

Thanks

Change cursor location with navigating buttons

Hello,

I created two buttons which allow to navigate Left and navigate Right one position. I thought by just calling previous and next on the _mathIndex it would go over the whole equation. However, if there are fractions or square roots, or an any atom of any other type it skips over them and does not enter them.

I thought maybe I should level up or level down depending if the next _mathIndex is of type fraction or root or whatever, but I had no luck. It just keeps skipping over them.

I'm guessing I have the logic of the class understood wrong. How am I supposed to be able to traverse 1 position at a time throughout the equation?

Implement UILabel-like autoshrinking

The ideal interface looks like:

@interface MTMathUILabel : UIView
<...>
@property (nonatomic) BOOL adjustsFontSizeToFit;
<...>
@end

Do you have any ideas about the clear way to implement it?

Currently I see the following solutions:

  1. Use binary search or similar approach to find an optimal size over a few iterations.
  2. Calculate ratio of a desired size to an actual size and use it to calculate the font size. This is fast, but in terms of math rendering the font size does not have a constant correlation with an output size.
  3. (not the clearest one, but robust) Just resize the rendered image to fit label.

Degree Radical Bug

The Degree in the radical has a major bug which crashes on [self insertionPointChanged] when there are more than one digit in the degree.

Fraction inside root

Hi,

If you look at the screenshot below, when typing fraction while inside the root, you cannot continue writing anything under that root, it continues to write formula outside of the root.
The problem is, I assume, that you cannot somehow select that fraction as you can other elements so it doesn't really know where to continue. Because of this you also cannot delete just the fraction but it deletes the whole root.

Is this a bug or I am missing something?

image

Created New Keyboard

Hello,

I created a new keyboard the same way you have made the keyboard. However, the keyboard I created has integrals, ointegrals, summations, limits, and many other special characters which are included in Latex. However, the MTEditableMathLabel is not drawing these special characters. I noticed since you have technically mapped in the code how each fractions, superscripts, subscripts it will draw them correctly accordingly given the cases, doing it this way will not be maintainable in the long run. Is there a way we can pass any latex and have it drawn and made editable correctly without having to go through the hassle of writing code for each new button or functionality added? I am trying to achieve a keyboard similar to PhotoMath with more functionalities and keys.

(Also I admit I might be wrong in the way I have analyzed your code, maybe I did something wrong)

Matrices, Custom keyboards and horizontal Scrolling

So first of, thank you so much for developing such an awesome Pod. It really solved a lot of my problems but I have a few things to still take care of and this seemed like the right place to ask.

Is it possible, and if yes how, to enter and edit matrices ?

How do I implement a custom keyboard in Swift ? I am writing my App in swift and I would like to make a custom keyboard. So I implemented the MTMathKeybard protocol but I can’t get info about what methods to implement.

When the Input gets wider then the width of the label theres currently (to my knowledge) to way to get back and forth. How would you go about this ?

I also have a little Question about your uneditable label but it is in the Issues threat of the Repository. But again, thank you so much for sharing this awesome work. I really am amazed by your work.

All my best,
Jony

Support for multiple lines

Currently the text font is reduced when we type beyond view bounds. We want to allow typing in next line when frame exceeds the bounding rect. Can we use CTFrame instead of CTLine to make it multiline?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.