Skip to content

Failure on rendering \sqrt{} command #188

@nuixdt

Description

@nuixdt

If the latex is \sqrt only, it will crash on getNextCharacter function call. We modify the sqrt command to check the array index and length by hasCharacters function in MTMathListBuilder.m

  • (MTMathAtom*) atomForCommand:(NSString*) command
    {
    ......
    } else if ([command isEqualToString:@"sqrt"]) {
    // A sqrt command with one argument
    MTRadical* rad = [MTRadical new];
    if ([self hasCharacters]) {
    unichar ch = [self getNextCharacter];
    if (ch == '[') {
    // special handling for sqrt[degree]{radicand}
    rad.degree = [self buildInternal:false stopChar:']'];
    rad.radicand = [self buildInternal:true];
    } else {
    [self unlookCharacter];
    rad.radicand = [self buildInternal:true];
    }
    }
    return rad;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions