Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.report.Equation class

Package: mlreportgen.report
Superclasses:

Equation reporter

Description

Create an equation reporter that adds an equation to a report. This class inherits from mlreportgen.report.Reporter.

Construction

equation = Equation() creates an empty equation reporter. Use its properties to specify the equation and its formatting. When you add the equation to a report, it is added as an image of the formatted equation. The image is centered on the page and is scalable in all reports except Microsoft® Word reports generated on non-Windows® platforms. If the equation image is wider than the page width, it is scaled to fit. Otherwise, it is not scaled.

The snapshot image of the equation is stored in the temporary folder of the report. When the report is closed, the equation image is copied into the report and, then, the image is deleted from the temporary folder. To prevent the equation image files from being deleted, use the Debug property of the report. See mlreportgen.report.Report.

equation = Equation(markup) formats the equation specified by the LaTeX markup for the equation.

equation = Equation(Name,Value) sets properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single quotes.

Input Arguments

expand all

LaTeX markup for the equation, specified as a string or character array. See Content property.

Properties

expand all

LaTeX markup for the equation, specified as a string or character array. You can use any LaTeX markup supported by the Interpreter property of a MATLAB® text object. See Text Properties.

Font size for the formatted equation, specified as empty or a positive integer. If FontSize is empty, the font size defaults to 10.

Font color for the formatted equation, specified as empty or as a string or character array that specifies the color name. If Color is empty, the font color defaults to black. You can use long or short color names. For a list of valid color names, see the Color property of a MATLAB text object. See Text Properties.

Background color, specified as empty or as a string or character array that specifies the background color of the equation. If Color is empty, the background color defaults to white. You can use long or short color names. For a list of valid color names, see the Color property of a MATLAB text object. See Text Properties.

Methods

createTemplate Create equation template
customizeReporter Create custom equation reporter class
getClassFolder Equation class definition file location
getContentReporterGet equation content hole reporter
getSnapshotImageCreate equation image path

Inherited Methods

getImpl Get implementation of reporter

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Examples

Add an Equation to a Chapter

Create a report that includes an equation in a chapter.

import mlreportgen.report.*
rpt = Report('equation','docx');
ch = Chapter('Title','Equation');
add(ch,Equation('\int_{0}^{2} x^2\sin(x) dx'));
add(rpt,ch);
close(rpt);
rptview(rpt);

Set Equation Font Size and Color

Create a report that includes an equation on a yellow background in 14 pt font.

import mlreportgen.report.*
rpt = Report('equation','docx');
ch = Chapter('Title','Equation');
eq = Equation;
eq.Content = '\int_{0}^{2} x^2\sin(x) dx';
eq.FontSize = 14; 
eq.Color = 'b';
eq.BackgroundColor = 'y';
add(ch,eq);
add(rpt,ch);
close(rpt);
rptview(rpt);

Introduced in R2017b

Was this topic helpful?