Is there a way to create subsections using 'publish'?
27 views (last 30 days)
Show older comments
MathWorks Support Team
on 24 Feb 2014
Edited: MathWorks Support Team
on 1 Apr 2021
Section headings in HTML created using the 'publish' function use the {h2} tags. Is there a way to create subsections that use the {h3} tag and have them included in the table of contents?
Accepted Answer
MathWorks Support Team
on 30 Mar 2021
Edited: MathWorks Support Team
on 1 Apr 2021
There is no special syntax for creating subsections/subheadings using the 'publish' feature, like there is for creating main section headings. However, you can create subsections by specifically including the {h3} tag in your document surrounded by {html} tags. For example:
%% Main Section
% H2 tags are used to denote main sections.
% But you can specifically write H3 tags using HTML, for example:
%
% <html><h3>Sub Section</h3></html>
%
% This text will be in a sub-section.
If you want to change the formatting of the subheading, you can do that by modifying the CSS information included in the XSL stylesheet that does the transformation into HTML. Then you can instruction 'publish' to use the custom stylesheet using the 'stylesheet' input parameter.
publish('fcn.m','stylesheet','mystylesheet.xsl')
The default stylesheet can be found by executing the following command in MATLAB:
which -all mxdom2simplehtml.xsl
The subsection will not be automatically included in the table of contents, but you may be able to add the subsections to the table of contents by modifying the XSL stylesheet.
As an alternative to the 'publish' feature, the MATLAB Report Generator can be used to generate much more complicated and elaborate reports based on your data. You may find that it is better suited for your needs than the 'publish' function. For more information on the MATLAB Report Generator, please visit the following link:
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!