Using MathDelimiter without the Close Character

In Slides.Java, I would like to have a Math equation without the close character. The current API does not seem to support that option. If no open/close characters are provided then the default values are used. Any suggestion?

Here is class I am referring to

new MathDelimiter(new MathematicalText("a"));

Here is the desired output.

image.png (305 Bytes)

@fzeng2012,
Thank you for describing the issue. Unfortunately, I was unable to do this in PowerPoint. Could you please share a PowerPoint document with the expected result?

public void mathDelimiterClose() throws IOException {
    // temp file directory
    String tmpdir = System.getProperty("java.io.tmpdir");
    Files.createDirectories(Paths.get(tmpdir + "/test"));

    // new presentation
    Presentation presentation = new Presentation();
    ISlideCollection slides = presentation.getSlides();

    // get the default slide
    ISlide slide = slides.get_Item(0);

    // add a rectangle
    IAutoShape autoShape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 100, 600, 400);

    // add a new paragraph and some text
    Paragraph paragraph = new Paragraph();
    autoShape.getTextFrame().getParagraphs().add(paragraph);

    Portion portion = new Portion();
    paragraph.getPortions().add(portion);
    portion.setText("A math delimiter with the default open and close characters: ");

    // add a math portion with a math delimiter in it
    MathPortion mathPortion = new MathPortion();
    paragraph.getPortions().add(mathPortion);

    MathBlock mathBlock = new MathBlock();
    mathPortion.getMathParagraph().add(mathBlock);

    MathDelimiter mathDelimiter = new MathDelimiter(new MathematicalText("a"));
    mathBlock.add(mathDelimiter);

    Paragraph paragraph2 = new Paragraph();
    autoShape.getTextFrame().getParagraphs().add(paragraph2);

    // add another paragraph and some text
    Portion portion2 = new Portion();
    paragraph2.getPortions().add(portion2);
    portion2.setText("I would like a math delimiter without a close character: ");

    // add a math portion with a math delimiter in it
    MathPortion mathPortion2 = new MathPortion();
    paragraph2.getPortions().add(mathPortion2);

    MathBlock mathBlock2 = new MathBlock();
    mathPortion2.getMathParagraph().add(mathBlock2);

    MathDelimiter mathDelimiter2 = new MathDelimiter(new MathematicalText("a"));
    mathDelimiter2.setBeginningCharacter('{');

    // wanted to have no close character, but the API cannot accept a null. A space produces some
    // undesirable result.
    mathDelimiter2.setEndingCharacter(' ');
    mathBlock2.add(mathDelimiter2);

    // save it for visual inspection
    presentation.save(tmpdir + "/test/test.pptx", SaveFormat.Pptx);
}

The generated PPTX from the code above

test.zip (24.7 KB)

@fzeng2012,
Thank you for the additional information. We will reply to you a bit later.

@fzeng2012,
I’ve added a ticket with ID SLIDESJAVA-39001 to our issue-tracking system. Our development team will consider your requirements. We will inform you of any progress.