When the HTML document is created with the PUBLISH function; it uses the 'mxdom2simplehtml.xsl' stylesheet.
Since the code here has only one line of code, the PUBLISH function considers this line to be the introduction and hence has bigger font styles/sizes.
You can modify the contents of the stylesheet and accordingly use it to generate HTML documents of your specification. To make changes to the stylesheet, you can follow these steps:
1) At the MATLAB command prompt, type:
fullfile(matlabroot, '\toolbox\matlab\codetools\private\')
2) Navigate to this folder from within MATLAB or outside MATLAB.
3) Now, open up the XSL stylesheet named: mxdom2simplehtml.xsl either using MATLAB editor or using any other editor like Wordpad.
4) Now, search the document (using Ctrl+F) for the words "max-width"
5) You will come to a location where the document reads:
/* Make the text shrink to fit narrow windows, but not stretch too far in
wide windows. */
p,h1,h2,div.content div {
max-width: 600px;
/* Hack for IE6 */
width: auto !important; width: 600px;
}
Here, you can change the width from "600" to say "900" (in both the locations).
We can also change the color of the text in the HTML file, for example to "black". Search (using ctrl+f) for the following code in the XSL file:
pre.codeoutput {
color: #666666;
padding: 10px;
}
To change the color from "grey" to black, replace the above code with the following code:
pre.codeoutput {
color: black;
padding: 10px;
}
6) 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\nidhij\Desktop\xslFiles".
7) Now, whenever you would like to use this width setting, you can use the following command in MATLAB:
publish('testHTML.m', 'stylesheet', 'C:\Users\nidhij\Desktop\xslFiles\mxdom2simplehtml2.xsl')
This will make sure that the PUBLISH function uses this setting for the width while generating the HTML document.
Best Answer