[Tex/LaTex] Setting math font size

fontsizeMATLAB

MATLAB has the ability to "publish" code as an html document. It can include math by taking equations keyed in LaTeX notation, processing it with latex and embedding a bitmap image into the html. An example MATLAB file would be

%%
% With this equation, $x(t) = y(t)$, MATLAB only processes the math with LaTeX
%

running the MATLAB publish function would essentially internally convert this to

\documentclass{article}
\begin{document}
$x(t) = y(t)$
\end{document}

although everything may be enclosed in an \hbox. I can't really follow all the details of the MATLAB code as some of it is closed source.

\begin{edit}
One potentially important piece of information I just found is that the MATLAB version of the article class has \input{size1\@ptsize.clo} commented out with the following comment

%% The following line causes the HG text to offset vertically and horizontally.

Apparently the good people at the Mathworks don't understand how to deal with LaTeX margins. Needless to say, this is why commands like \large don't work even when stuck in an \hbox.
\end{edit}

The problem appears to be that MATLAB only processes the math with LaTeX. In how to scale math font only, you appear to need to be outside the math environment to change the font size. Is it possible to change the math font size from within the math environment? I think the MATLAB parser decides when to start and stop processing with latex based on $'s. Maybe there is some other way to exit mathmode.

Best Answer

I can't quite see what matlab is doing less latex works than I would expect, however this sort of works to make the first expression larger:

So after a bit of trial and error and discussion in comments most of latex is enabled but you need to switch out of math mode, use a lower level font size change such as \fontsize{20}{25}\selectfont for 20pt font, and then switch back into math mode using \( not $ so as not to confuse matlab's scan for math fragments.

enter image description here

%%
% With this equation, 
% 
% MATLAB only processes the math with LaTeX

% $$e^{\pi i} + 1 = 0$$
% 
%
%%
% With this equation, $\hbox{\fontsize{20}{25}\selectfont\(z(t) = w(t)\)}$, MATLAB only processes the math with LaTeX
%