Main Content

getTitleReporter

Class: mlreportgen.report.ListOfCaptions
Package: mlreportgen.report

Get list of captions title reporter

Syntax

titleReporter = getTitleReporter(loc)

Description

titleReporter = getTitleReporter(loc) returns the mlreportgen.report.Title reporter that the specified mlreportgen.report.ListOfCaptions reporter uses to format the list of captions section title. Use the Title reporter to customize the alignment, position, and appearance of the title.

Input Arguments

expand all

List of captions reporter, specified as an mlreportgen.report.ListOfCaptions object.

Output Arguments

expand all

List of captions title reporter, returned as an mlreportgen.report.Title object.

Examples

expand all

Suppose that you defined a custom template for a list of captions title in the template library of a template for your report output type. To use the custom template:

  1. Get the title reporter using getTitleReporter.

  2. Set the properties of the title reporter. Set the Content property to the title text, the TemplateSrc property to the path and file name of the template file, and the TemplateName property to the name of the custom template for the list of captions title.

  3. Set the Title property of the list of captions reporter to the title reporter.

For example, suppose that the template file myTemplate.pdftx defines two templates to use with a list of captions title. One template, ListOfCaptionsTitleRed, uses a style that makes the title red. The second template, ListOfCaptionsTitleBlue, uses a style that makes the title blue. This code applies the template that makes the title blue:

import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('myReport','pdf');
open(rpt);

loc = ListOfCaptions;
loc.AutoNumberStreamName = "equation";

titleReporter = getTitleReporter(loc);
titleReporter.Content = "List of Equations";
titleReporter.TemplateSrc = "myTemplate.pdftx";
titleReporter.TemplateName = "ListOfCaptionsTitleBlue";
loc.Title = titleReporter;
append(rpt,loc);

ch = Chapter("Physics Principles")
eq = Equation("e = m * c^2");
eq.DisplayInline = true;
append(ch,eq);
      
p = Paragraph("Equation ");
p.Style = {CounterInc('equation'),WhiteSpace("preserve")};
append(p,AutoNumber("equation"));
append(p," Mass–energy equivalence");
append(ch,p);
append(rpt,ch);

close(rpt);
rptview(rpt);
Introduced in R2020b