Is there a way to create subsections using 'publish'?

21 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 24 Fév 2014
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?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 30 Mar 2021
Modifié(e) : MathWorks Support Team le 1 Avr 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:

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Produits


Version

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by