Adicionar Equações Matemáticas a Apresentações PowerPoint em C++
Visão geral
O PowerPoint armazena equações como Office Math Markup Language (OMML). Com Aspose.Slides para C++, você pode criar o mesmo tipo de conteúdo matemático programaticamente: frações, radicais, funções, limites, operadores N‑ário, matrizes, arrays e blocos de matemática formatados.
No PowerPoint, os usuários normalmente adicionam equações a partir de Insert > Equation:

O resultado é texto matemático editável no slide:

Aspose.Slides constrói esse texto matemático através de três objetos principais:
- Uma forma matemática, criada com AddMathShape, é a forma que contém a equação.
- MathPortion armazena conteúdo matemático dentro da moldura de texto da forma.
- MathParagraph contém um ou mais objetos MathBlock.
A maioria dos exemplos abaixo usa MathematicalText e os métodos fluentes de IMathElement para manter o código curto e legível.
Para cenários de exportação MathML, veja Exportar Equações Matemáticas de Apresentações em C++.
Criar uma Equação
Este exemplo usa AddMathShape para criar uma forma matemática e adiciona o teorema de Pitágoras:

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathBlock.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/IMathSuperscriptElement.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto equation = System::MakeObject<MathematicalText>(u"c")
- >SetSuperscript(u"2")
- >Join(u"=")
- >Join(System::MakeObject<MathematicalText>(u"a")->SetSuperscript(u"2"))
- >Join(u"+")
- >Join(System::MakeObject<MathematicalText>(u"b")->SetSuperscript(u"2"));
mathParagraph->Add(equation);
presentation->Save(u"pythagorean-theorem.pptx", SaveFormat::Pptx);
presentation->Dispose();
Note
AddMathShape cria uma forma que já contém um parágrafo matemático. Acesse o primeiro MathPortion, chame get_MathParagraph, e adicione blocos matemáticos ou elementos matemáticos a ele.Adicionar Frações
Use Divide para criar uma fração. Você pode escolher um estilo de fração com MathFractionTypes.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathFractionTypes.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto fraction = System::MakeObject<MathematicalText>(u"1")
- >Divide(u"x", MathFractionTypes::Skewed);
mathParagraph->Add(System::MakeObject<MathBlock>(fraction));
presentation->Save(u"fraction.pptx", SaveFormat::Pptx);
presentation->Dispose();
Para uma fração empilhada, use MathFractionTypes::Bar:
#include <DOM/MathText/MathFractionTypes.h>
#include <DOM/MathText/MathematicalText.h>
using namespace Aspose::Slides::MathText;
auto stackedFraction = System::MakeObject<MathematicalText>(u"x + 1")->Divide(u"y - 1", MathFractionTypes::Bar);
Adicionar Radicais
Use Radical para criar uma raiz quadrada, raiz cúbica ou outra raiz. O elemento atual torna‑se a base, e o argumento torna‑se o grau.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto radical = System::MakeObject<MathematicalText>(u"x")
- >Radical(u"n");
mathParagraph->Add(System::MakeObject<MathBlock>(radical));
presentation->Save(u"radical.pptx", SaveFormat::Pptx);
presentation->Dispose();
Mostrar ou Ocultar o Grau de uma Raiz Quadrada
Uma raiz quadrada pode exibir um 2 explícito ou usar a notação convencional √x. Use IMathRadical::set_HideDegree para alternar entre as duas formas. Ambas mantêm o grau 2 e o radicando x na equação editável.

O exemplo salva a mesma raiz quadrada duas vezes. Em visible-degree.pptx o 2 está visível. Em hidden-degree.pptx ele está oculto.
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathRadical.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto radicand = System::MakeObject<MathematicalText>(u"x");
auto radical = radicand->Radical(u"2");
auto block = System::MakeObject<MathBlock>(radical);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 200.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
mathParagraph->Add(block);
radical->set_HideDegree(false);
presentation->Save(u"visible-degree.pptx", SaveFormat::Pptx);
radical->set_HideDegree(true);
presentation->Save(u"hidden-degree.pptx", SaveFormat::Pptx);
presentation->Dispose();
Adicionar Funções e Limites
Use AsArgumentOfFunction ou Function para funções como sin(x), log(x), ou nomes de funções personalizados. Para limites, coloque lim em um MathLimit ou use SetLowerLimit.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathLimit.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto limit = System::MakeObject<MathematicalText>(u"lim")
- >SetLowerLimit(u"x→∞")
- >Function(u"x");
mathParagraph->Add(System::MakeObject<MathBlock>(limit));
presentation->Save(u"functions-and-limits.pptx", SaveFormat::Pptx);
presentation->Dispose();
Para um nome de função personalizado, torne o nome da função o elemento atual e chame Function com seu argumento:
#include <DOM/MathText/MathematicalText.h>
using namespace Aspose::Slides::MathText;
auto customFunction = System::MakeObject<MathematicalText>(u"f")->Function(u"x + 1");
Adicionar Operadores N‑ários e Integrais
Use Nary para somatórios, uniões, interseções e outros operadores grandes. Use Integral para integrais. Ambos os métodos permitem definir limites inferior e superior.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/IMathSuperscriptElement.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathNaryOperatorTypes.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto summationBase = System::MakeObject<MathematicalText>(u"x")
- >SetSuperscript(u"k")
- >Join(System::MakeObject<MathematicalText>(u"a")->SetSuperscript(u"n-k"));
auto summation = summationBase->Nary(MathNaryOperatorTypes::Summation, u"k=0", u"n");
mathParagraph->Add(System::MakeObject<MathBlock>(summation));
presentation->Save(u"nary-operators.pptx", SaveFormat::Pptx);
presentation->Dispose();
Operadores N‑ários são para operadores grandes com limites opcionais. Operadores simples como +, - e = são normalmente adicionados como MathematicalText e juntados na expressão.
Para uma integral, use Integral:
#include <DOM/MathText/IMathBlock.h>
#include <DOM/MathText/IMathBox.h>
#include <DOM/MathText/IMathElement.h>
#include <DOM/MathText/MathIntegralTypes.h>
#include <DOM/MathText/MathematicalText.h>
using namespace Aspose::Slides::MathText;
auto integralBase = System::MakeObject<MathematicalText>(u"x")->Join(System::MakeObject<MathematicalText>(u"dx")->ToBox());
auto integral = integralBase->Integral(MathIntegralTypes::Simple, u"0", u"1");
Adicionar Matrizes
Use MathMatrix para linhas e colunas. Matrizes não incluem colchetes por padrão, então envolva a matriz quando precisar de parênteses, colchetes ou chaves.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathBlock.h>
#include <DOM/MathText/IMathElement.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathMatrix.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto matrix = System::MakeObject<MathMatrix>(2, 3);
matrix->idx_set(0, 0, System::MakeObject<MathematicalText>(u"1"));
matrix->idx_set(0, 1, System::MakeObject<MathematicalText>(u"x"));
matrix->idx_set(1, 0, System::MakeObject<MathematicalText>(u"x"));
matrix->idx_set(1, 1, System::MakeObject<MathematicalText>(u"2"));
matrix->idx_set(1, 2, System::MakeObject<MathematicalText>(u"y"));
mathParagraph->Add(System::MakeObject<MathBlock>(matrix));
presentation->Save(u"matrix.pptx", SaveFormat::Pptx);
presentation->Dispose();
Adicionar Arrays de Equações
Use ToMathArray quando precisar de equações alinhadas ou de uma pilha vertical de expressões.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 140.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto equationArray = System::MakeObject<MathematicalText>(u"x")
- >Join(u"y")
- >ToMathArray();
mathParagraph->Add(System::MakeObject<MathBlock>(equationArray));
presentation->Save(u"equation-array.pptx", SaveFormat::Pptx);
presentation->Dispose();
Alinhar um Array com Elementos Circundantes
IMathArray::set_BaseJustification controla o alinhamento vertical de um array em relação aos elementos matemáticos ao seu lado. O exemplo abaixo compara o alinhamento com a primeira linha, o centro do array e a última linha.
O exemplo a seguir cria três arrays idênticos, cada um com três linhas e os elementos vizinhos A= e =B. Todo o texto matemático usa Cambria Math em 24 pontos. Apenas o alinhamento do array muda.
#include <system/array.h>
#include <system/console.h>
#include <drawing/color.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Fonts/FontData.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathArray.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathJustification.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathVerticalAlignment.h>
#include <DOM/MathText/MathRowSpacingRule.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
#include <DOM/FillType.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/ILineFormat.h>
#include <DOM/ISlideSize.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/ShapeType.h>
#include <DOM/SlideSizeScaleType.h>
#include <DOM/TextAnchorType.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto createText = [](System::String value)
{
auto text = System::MakeObject<MathematicalText>(value);
text->get_Format()->set_FontHeight(24);
auto font = System::MakeObject<FontData>(u"Cambria Math");
text->get_Format()->set_LatinFont(font);
return text;
};
auto presentation = System::MakeObject<Presentation>();
presentation->get_SlideSize()->SetSize(780, 200, SlideSizeScaleType::DoNotScale);
auto slide = presentation->get_Slide(0);
MathVerticalAlignment alignments[] = {MathVerticalAlignment::Top, MathVerticalAlignment::Center, MathVerticalAlignment::Bottom};
System::String labels[] = {u"Top", u"Center", u"Bottom"};
for (auto i = 0; i < 3; i++)
{
auto label = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20 + i * 260, 10, 240, 30);
label->get_FillFormat()->set_FillType(FillType::NoFill);
label->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill);
label->get_TextFrame()->set_Text(labels[i]);
auto labelFormat = label->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat();
labelFormat->set_FontHeight(16);
labelFormat->get_FillFormat()->set_FillType(FillType::Solid);
labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black());
auto mathShape = slide->get_Shapes()->AddMathShape(20 + i * 260, 60, 240, 130);
mathShape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
mathParagraph->set_Justification(MathJustification::LeftJustified);
auto rows = System::MakeArray<System::SharedPtr<IMathElement>>({createText(u"x+y=3"), createText(u"x-y=1"), createText(u"x=2")});
auto equationArray = System::MakeObject<MathArray>(rows);
equationArray->set_BaseJustification(alignments[i]);
auto leftText = createText(u"A=");
auto rightText = createText(u"=B");
auto equation = System::MakeObject<MathBlock>(leftText)->Join(equationArray)->Join(rightText);
mathParagraph->Add(equation);
}
presentation->Save(u"equation-array-alignment.pptx", SaveFormat::Pptx);
presentation->Dispose();
A comparação a seguir mostra a apresentação salva no PowerPoint. Observe a posição de A= e =B ao lado de cada array.

Configurar Espaçamento entre Linhas
set_RowSpacingRule seleciona a regra de espaçamento para linhas dentro do array. set_RowSpacing fornece um valor numérico para uma regra de espaçamento explícita e é ignorado pelas regras predefinidas.
Para espaçamento exato, o valor é medido em pontos. Para espaçamento proporcional, é medido em meia‑linha: o valor 3 no exemplo especifica 1,5 linhas. Chame ambos os setters ao especificar um valor explícito; alterar apenas o valor numérico não seleciona uma regra de espaçamento.
O exemplo abaixo salva cinco apresentações com as mesmas equações, alinhamento e configurações de fonte. As três primeiras usam predefinições; as duas últimas mostram valores explícitos.
#include <system/array.h>
#include <system/console.h>
#include <drawing/color.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Fonts/FontData.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathArray.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathJustification.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathVerticalAlignment.h>
#include <DOM/MathText/MathRowSpacingRule.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto createText = [](System::String value)
{
auto text = System::MakeObject<MathematicalText>(value);
text->get_Format()->set_FontHeight(24);
auto font = System::MakeObject<FontData>(u"Cambria Math");
text->get_Format()->set_LatinFont(font);
return text;
};
struct ArraySettings
{
MathRowSpacingRule rule;
uint32_t spacing;
System::String name;
};
ArraySettings settings[] =
{
{MathRowSpacingRule::SingleLineGap, 0, u"SingleLineGap"},
{MathRowSpacingRule::OneAndAHalfLineGap, 0, u"OneAndAHalfLineGap"},
{MathRowSpacingRule::TwoLineGap, 0, u"TwoLineGap"},
{MathRowSpacingRule::Exactly, 20, u"Exactly"},
{MathRowSpacingRule::Multiple, 3, u"Multiple"}
};
for (const auto& setting : settings)
{
auto fileName = u"equation-array-" + setting.name + u".pptx";
auto presentation = System::MakeObject<Presentation>();
auto mathShape = presentation->get_Slide(0)->get_Shapes()->AddMathShape(20, 20, 600, 300);
auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0);
paragraph->get_ParagraphFormat()->set_SpaceBefore(0);
paragraph->get_ParagraphFormat()->set_SpaceAfter(0);
auto mathPortion = System::ExplicitCast<MathPortion>(paragraph->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
mathParagraph->set_Justification(MathJustification::LeftJustified);
auto rows = System::MakeArray<System::SharedPtr<IMathElement>>({createText(u"x+y=3"), createText(u"x-y=1"), createText(u"x=2")});
auto equationArray = System::MakeObject<MathArray>(rows);
equationArray->set_BaseJustification(MathVerticalAlignment::Center);
equationArray->set_RowSpacingRule(setting.rule);
equationArray->set_RowSpacing(setting.spacing);
auto leftText = createText(u"A=");
auto rightText = createText(u"=B");
auto equation = System::MakeObject<MathBlock>(leftText)->Join(equationArray)->Join(rightText);
mathParagraph->Add(equation);
presentation->Save(fileName, SaveFormat::Pptx);
presentation->Dispose();
}
Array row spacing is separate from paragraph spacing. set_SpaceBefore e set_SpaceAfter adicionam espaço ao redor do parágrafo que contém, não entre linhas do array. Da mesma forma, IMathParagraph::set_Justification posiciona todo o parágrafo matemático horizontalmente; não substitui a configuração de alinhamento vertical do array.
Adicionar Funções Trigonométricas
Use AsArgumentOfFunction quando o argumento é o elemento atual e o nome da função é conhecido.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathFunctionsOfOneArgument.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto cosine = System::MakeObject<MathematicalText>(u"2x")
- >AsArgumentOfFunction(MathFunctionsOfOneArgument::Cos);
mathParagraph->Add(System::MakeObject<MathBlock>(cosine));
presentation->Save(u"trigonometric-function.pptx", SaveFormat::Pptx);
presentation->Dispose();
Adicionar Subscritos e Sobrescritos
Use os auxiliares de subscrito e sobrescrito para índices e potências. Quando os índices devem aparecer no lado esquerdo da base, use SetSubSuperscriptOnTheLeft.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto scripts = System::MakeObject<MathematicalText>(u"Y")
- >SetSubSuperscriptOnTheLeft(u"1", u"n");
mathParagraph->Add(System::MakeObject<MathBlock>(scripts));
presentation->Save(u"subscript-superscript.pptx", SaveFormat::Pptx);
presentation->Dispose();
Adicionar Delimitadores
Use Enclose para colocar uma expressão dentro de delimitadores. Você também pode definir um caractere separador para expressões delimitadoras que contêm vários elementos.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto delimiter = System::MakeObject<MathematicalText>(u"x")
- >Join(u"y")
- >Join(u"z")
- >Enclose(u'<', u'>', u'|');
mathParagraph->Add(System::MakeObject<MathBlock>(delimiter));
presentation->Save(u"delimiters.pptx", SaveFormat::Pptx);
presentation->Dispose();
Tamanho e Alinhamento dos Delimitadores
Passe true para set_GrowToMatchOperandHeight para que os parênteses cresçam ao redor de um operando alto, ou false para mantê‑los no tamanho normal. set_DelimiterShape aceita um dos dois valores MathDelimiterShape. Centered centraliza os parênteses no eixo matemático, que passa pelo meio do sinal de igualdade. Match alinha‑os com o conteúdo incluído. Ambas as configurações afetam apenas os delimitadores. A expressão interna permanece a mesma.
O exemplo coloca uma fração no expoente de x para que a expressão se estenda mais acima da linha de base do que abaixo dela. Todas as quatro equações usam os mesmos parênteses e configurações de fonte.
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/IPortionFormat.h>
#include <DOM/MathText/IMathBlock.h>
#include <DOM/MathText/IMathDelimiter.h>
#include <DOM/MathText/IMathFraction.h>
#include <DOM/MathText/IMathSuperscriptElement.h>
#include <DOM/MathText/MathDelimiterShape.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto addExpression = [slide](float left, float top, bool grow, MathDelimiterShape shape)
{
auto fraction = System::MakeObject<MathematicalText>(u"a + b")->Divide(u"c + d");
auto power = System::MakeObject<MathematicalText>(u"x")->SetSuperscript(fraction);
auto delimiter = power->Enclose(u'(', u')');
delimiter->set_GrowToMatchOperandHeight(grow);
delimiter->set_DelimiterShape(shape);
auto mathShape = slide->get_Shapes()->AddMathShape(left, top, 300, 100);
auto portion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
portion->get_PortionFormat()->set_FontHeight(32);
auto equation = System::MakeObject<MathematicalText>(u"y = ")->Join(delimiter);
portion->get_MathParagraph()->Add(equation);
};
addExpression(20, 20, true, MathDelimiterShape::Centered);
addExpression(350, 20, true, MathDelimiterShape::Match);
addExpression(20, 140, false, MathDelimiterShape::Centered);
addExpression(350, 140, false, MathDelimiterShape::Match);
presentation->Save(u"delimiter-sizing.pptx", SaveFormat::Pptx);
presentation->Dispose();
No PowerPoint, compare as linhas para ver o efeito do crescimento. Na linha superior, os parênteses crescem para envolver o expoente e ficam semelhantes para ambas as formas. Na linha inferior, o crescimento está desativado. Os parênteses menores à esquerda (Centered) alinham‑se com o sinal de igualdade, enquanto os da direita (Match) ficam mais altos ao redor da expressão.

Adicionar uma Caixa de Borda
Chame ToBorderBox em uma fração para enquadrar toda a expressão. O IMathBorderBox retornado mostra as quatro lados por padrão. Use set_HideTop, set_HideBottom, set_HideLeft e set_HideRight para remover lados individuais.
O exemplo coloca seis cópias da mesma fração em um slide. Para mostrar cancelamento, oculte todos os quatro lados e defina set_StrikethroughBottomLeftToTopRight para uma diagonal ascendente (↗) ou set_StrikethroughTopLeftToBottomRight para uma diagonal descendente (↘). Você também pode usar set_StrikethroughHorizontal ou set_StrikethroughVertical com qualquer combinação de lados visíveis.
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ISlideSize.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathBorderBox.h>
#include <DOM/MathText/IMathFraction.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <DOM/SlideSizeScaleType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
presentation->get_SlideSize()->SetSize(540, 220, SlideSizeScaleType::DoNotScale);
auto slide = presentation->get_Slide(0);
auto addFraction = [slide](float x, float y, bool hideBorder = false)
{
auto fraction = System::MakeObject<MathematicalText>(u"x+1")->Divide(u"y+2");
auto box = fraction->ToBorderBox();
box->set_HideTop(hideBorder);
box->set_HideBottom(hideBorder);
box->set_HideLeft(hideBorder);
box->set_HideRight(hideBorder);
auto shape = slide->get_Shapes()->AddMathShape(x, y, 160, 90);
auto portion = System::ExplicitCast<MathPortion>(shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
portion->get_PortionFormat()->set_FontHeight(28);
auto mathBlock = System::MakeObject<MathBlock>(box);
portion->get_MathParagraph()->Add(mathBlock);
return box;
};
addFraction(10, 10);
auto partial = addFraction(190, 10);
partial->set_HideTop(true);
partial->set_HideRight(true);
addFraction(370, 10, true)->set_StrikethroughBottomLeftToTopRight(true);
addFraction(10, 120, true)->set_StrikethroughTopLeftToBottomRight(true);
addFraction(190, 120, true)->set_StrikethroughHorizontal(true);
addFraction(370, 120)->set_StrikethroughVertical(true);
presentation->Save(u"border-box.pptx", SaveFormat::Pptx);
presentation->Dispose();

Nesta fração, o risco horizontal sobrepõe a barra da fração. O risco vertical cruza tanto o numerador quanto o denominador enquanto a borda ao redor permanece visível. Essas linhas decoram toda a expressão. O risco de texto comum aplica‑se a caracteres em uma sequência de texto. Após reabrir a apresentação no PowerPoint, você ainda pode editar o numerador e o denominador independentemente.
Controlar Visibilidade e Layout com Elementos Fantasma
Envolva uma expressão em MathPhantom para controlar sua visibilidade e o espaço que ela contribui para uma equação independentemente. Os métodos setters de IMathPhantom controlam o seguinte:
| Método | Efeito |
|---|---|
| set_Show | Passe false para ocultar a expressão. Suas dimensões ainda contribuem para o layout a menos que as configurações correspondentes abaixo estejam true. |
| set_ZeroWidth | Trate a largura horizontal da expressão como zero, permitindo que os elementos vizinhos se aproximem. |
| set_ZeroAsc | Trate sua ascensão, a altura acima da linha de base, como zero. Isso pode reduzir o espaço reservado acima dos elementos vizinhos. |
| set_ZeroDesc | Trate sua descida, a profundidade abaixo da linha de base, como zero. Isso pode mover a barra da fração ou outro conteúdo abaixo da expressão mais próximo dos vizinhos. |
A linha de base é a linha de referência sobre a qual os caracteres matemáticos comuns se assentam. Ocultar conteúdo não remove suas dimensões, e tratar uma dimensão como zero não exclui a expressão. A expressão subjacente permanece disponível através de get_Base. Passe true para set_Show para exibi‑la novamente; as configurações de dimensão permanecem inalteradas.
O exemplo abaixo cria cinco variantes lado a lado: uma fração visível, uma fração oculta que reserva espaço, e três frações ocultas com uma dimensão tratada como zero. Cada variante usa a mesma expressão circundante e Cambria Math em 24 pontos. Todas as formas de equação têm a mesma posição superior, marcada pela guia cinza. Colocar o fantasma no numerador de uma fração externa torna as alterações de layout vertical mais fáceis de ver.
#include <array>
#include <drawing/color.h>
#include <DOM/FillType.h>
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/ILineFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ISlideSize.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathFraction.h>
#include <DOM/MathText/MathPhantom.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <DOM/ShapeType.h>
#include <DOM/SlideSizeScaleType.h>
#include <DOM/TextAnchorType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto createText = [](System::String value)
{
auto text = System::MakeObject<MathematicalText>(value);
text->get_Format()->set_FontHeight(24);
auto font = System::MakeObject<FontData>(u"Cambria Math");
text->get_Format()->set_LatinFont(font);
return text;
};
auto presentation = System::MakeObject<Presentation>();
presentation->get_SlideSize()->SetSize(1000, 180, SlideSizeScaleType::DoNotScale);
auto slide = presentation->get_Slide(0);
std::array<System::String, 5> labels = {u"Visible", u"Hidden: reserves space", u"Hidden: ZeroWidth", u"Hidden: ZeroAsc", u"Hidden: ZeroDesc"};
auto guide = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 10, 60, 980, 0);
guide->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid);
guide->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_LightGray());
for (auto i = 0; i < labels.size(); i++)
{
auto left = 10 + i * 200;
auto label = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, left, 10, 190, 30);
label->get_FillFormat()->set_FillType(FillType::NoFill);
label->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill);
label->get_TextFrame()->set_Text(labels[i]);
auto labelFormat = label->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat();
labelFormat->set_FontHeight(14);
labelFormat->get_FillFormat()->set_FillType(FillType::Solid);
labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black());
auto fractionNumerator = createText(u"a+b");
auto fractionDenominator = createText(u"c+d");
auto fraction = System::MakeObject<MathFraction>(fractionNumerator, fractionDenominator);
auto phantom = System::MakeObject<MathPhantom>(fraction);
phantom->set_Show(i == 0);
phantom->set_ZeroWidth(i == 2);
phantom->set_ZeroAsc(i == 3);
phantom->set_ZeroDesc(i == 4);
auto leadingText = createText(u"x+");
auto trailingText = createText(u"+y");
auto numeratorBlock = System::MakeObject<MathBlock>(leadingText);
auto numerator = numeratorBlock->Join(phantom)->Join(trailingText);
auto denominator = createText(u"z");
auto equation = System::MakeObject<MathFraction>(numerator, denominator);
auto shape = slide->get_Shapes()->AddMathShape(left, 60, 190, 100);
shape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top);
auto mathPortion = System::ExplicitCast<MathPortion>(shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto mathBlock = System::MakeObject<MathBlock>(equation);
mathParagraph->Add(mathBlock);
}
presentation->Save(u"math-phantom.pptx", SaveFormat::Pptx);
presentation->Dispose();

Agrupar Termos
Use Group para colocar um caractere de agrupamento acima ou abaixo de uma expressão. Adicione um limite para rotular os termos agrupados.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathGroupingCharacter.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathTopBotPositions.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto grouped = System::MakeObject<MathematicalText>(u"x + y")
- >Group(u'\u23DF', MathTopBotPositions::Bottom, MathTopBotPositions::Top)
- >SetLowerLimit(u"any text");
mathParagraph->Add(System::MakeObject<MathBlock>(grouped));
presentation->Save(u"grouped-terms.pptx", SaveFormat::Pptx);
presentation->Dispose();
Formatar Elementos Matemáticos
Use auxiliares de formatação apenas onde eles esclarecem a fórmula. Por exemplo, Overbar coloca uma barra acima de um elemento matemático.

#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/MathBlock.h>
#include <DOM/MathText/MathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f);
auto mathPortion = System::ExplicitCast<MathPortion>(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0));
auto mathParagraph = mathPortion->get_MathParagraph();
auto overbar = System::MakeObject<MathematicalText>(u"ABC")->Overbar();
mathParagraph->Add(System::MakeObject<MathBlock>(overbar));
presentation->Save(u"overbar.pptx", SaveFormat::Pptx);
presentation->Dispose();
Formatar Texto em uma Equação Existente
Para formatar texto em toda uma equação existente, percorra a árvore de elementos de cada bloco matemático. IMathElement::GetChildren retorna apenas os filhos imediatos, portanto chame‑a recursivamente para alcançar texto dentro de frações, scripts, radicais e outras estruturas aninhadas. Verifique o elemento atual assim como seus filhos para incluir o elemento inicial quando ele for MathematicalText.
Este exemplo assume que uma apresentação contém uma equação como z = xᵢ / ∛y, com uma fração contendo um subscrito em seu numerador e um radical em seu denominador. Processar apenas os elementos de nível superior do bloco perderia o texto dentro da fração. O exemplo encontra porções matemáticas nas molduras de texto dos slides, acessa seus blocos através de IMathPortion::get_MathParagraph, e define a altura da fonte para 28 pontos com set_FontHeight, acessando a formatação por meio do método get_Format de cada elemento de texto.
#include <functional>
#include <system/array.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphCollection.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ISlideCollection.h>
#include <DOM/ITextFrame.h>
#include <DOM/MathText/IMathBlock.h>
#include <DOM/MathText/IMathElement.h>
#include <DOM/MathText/IMathParagraph.h>
#include <DOM/MathText/IMathPortion.h>
#include <DOM/MathText/MathematicalText.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace Aspose::Slides::MathText;
std::function<void(System::SharedPtr<IMathElement>)> formatMathText;
formatMathText = [&formatMathText](System::SharedPtr<IMathElement> element)
{
auto text = System::DynamicCast<MathematicalText>(element);
if (text != nullptr)
text->get_Format()->set_FontHeight(28.0f);
for (auto child : element->GetChildren())
formatMathText(child);
};
auto presentation = System::MakeObject<Presentation>(u"input.pptx");
for (auto slide : presentation->get_Slides())
{
for (auto shape : slide->get_Shapes())
{
auto autoShape = System::DynamicCast<IAutoShape>(shape);
if (autoShape == nullptr || autoShape->get_TextFrame() == nullptr)
continue;
for (auto paragraph : autoShape->get_TextFrame()->get_Paragraphs())
{
for (auto portion : paragraph->get_Portions())
{
auto mathPortion = System::DynamicCast<IMathPortion>(portion);
if (mathPortion != nullptr)
{
for (auto block : mathPortion->get_MathParagraph())
formatMathText(block);
}
}
}
}
}
presentation->Save(u"formatted-equations.pptx", SaveFormat::Pptx);
presentation->Dispose();
A apresentação salva contém a formatação de texto atualizada em todos os níveis de cada equação processada, preservando seu conteúdo de texto e estrutura matemática.
Referência Rápida
| Tarefa | API Principal |
|---|---|
| Criar texto matemático | MathematicalText |
| Combinar elementos | IMathElement.Join |
| Criar frações | IMathElement.Divide |
| Adicionar sobrescrito ou subscrito | SetSuperscript, SetSubscript |
| Adicionar funções | Function, AsArgumentOfFunction |
| Adicionar radicais | IMathElement.Radical |
| Adicionar limites | SetLowerLimit, SetUpperLimit |
| Adicionar scripts do lado esquerdo | SetSubSuperscriptOnTheLeft |
| Adicionar somatórios e integrais | Nary, Integral |
| Adicionar matrizes | MathMatrix |
| Adicionar arrays de equações | ToMathArray |
| Adicionar delimitadores | Enclose |
| Adicionar barras e bordas | Overbar, ToBorderBox |
| Agrupar termos | Group |
Perguntas Frequentes
Posso editar uma equação PowerPoint existente?
Sim. Abra a apresentação, encontre a forma que contém um MathPortion, chame get_MathParagraph, e atualize os blocos matemáticos naquele parágrafo.
As equações são salvas como matemática editável do PowerPoint?
Sim. Ao salvar em PPTX, Aspose.Slides grava a equação como conteúdo Office Math editável.
Posso exportar equações para LaTeX?
Sim. Obtenha o IMathParagraph da equação a partir do seu IMathPortion, e chame IMathParagraph::ToLatex para exportá‑la diretamente. Para um exemplo completo, veja Exportar Equações Matemáticas de Apresentações em C++.