How to set default font size in Matlab-published HTML?
9 views (last 30 days)
Show older comments
I'm using the publish command to produce HTML reports, and I'd like to change the default font size used by publish.m. Is there a way to do this?
0 Comments
Accepted Answer
Sai Sri Pathuri
on 13 Jan 2020
When the HTML document is created with the PUBLISH function; it uses the 'mxdom2simplehtml.xsl' stylesheet.
You can modify the contents of the stylesheet and accordingly use it to generate HTML documents of your specification.
1) At the MATLAB command prompt, type:
fullfile(matlabroot,'\toolbox\matlab\codetools\private\')
2) Navigate to this folder and open up the XSL stylesheet named: mxdom2simplehtml.xsl
3) Now, search the document (using Ctrl+F) for the words " pre, code ". You will come to a location where the file reads:
pre, code { font-size:12px; }
Here, you can modify the font size of HTML report.
4) Save the changed file as 'mxdom2simplehtml2.xsl' in a location outside the matlabroot folder so that you do not overwrite the existing stylesheet.
For example, at a location like "C:\Users\username\Desktop\xslFiles".
5) Now, whenever you would like to use this size setting, you can use the following command in MATLAB:
publish('MATLABfile.m', 'stylesheet', 'C:\Users\username\Desktop\xslFiles\mxdom2simplehtml2.xsl')
This will make sure that the PUBLISH function uses this setting for the width while generating the HTML document.
0 Comments
More Answers (1)
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!