Clear Filters
Clear Filters

Combination bad Latex equation printing and PropertyMaker error during MATLAB publish to PDF

5 views (last 30 days)
I'm using OSX and MATLAB R2012b.
I'm trying to use the MATLAB GUI publish to publish my MATLAB code, some Latex equations, and some plots. When I publish to HTML, I have no issues with the Latex display, but when I publish to PDF, the Latex equations are blurry to the point of unreadable. Additionally, an error occurs during the pdf publish that does not occur during the HTML publish:
[ERROR] PropertyMaker - forcing max to min in LengthRange
Messing with the properties of my PDF viewer does not help the blurriness. I also tried changing the graphical parameters in the publish GUI to no avail (same error, and no improvement in the published document). Everything else in the published document displays fine.
%%Problem 2
% Determination of the Energy between Colloidal Particles attached
% with Polymers
%%(a) Particles only
% Interaction energy is given by the following equation:
% $$\Phi = \frac{-A}{6}\left[\frac{2R^2}{s^2+4Rs}+\frac{2R^2}{s^2+4Rs+4R^2}+\ln\left(\frac{s^2+4Rs}{s^2+4Rs+4R^2}\right)\right]$$
% where $R$ is the radius of the sphere, $s$ is the separation of the
% spheres at the surface, and $A$ is the Hamaker constant, which is assumed
% to be $10kT$ in the following exercises.
%%(b) i. Particles with ideal polymer chains
% An additional force parameter based on ideal chain statistics
% is included in this simulation:
% $$ f = 3kT\frac{R}{\langle R_0^2 \rangle}$$
% where $R$ is the stretched length of the polymer and $R_0$ is the
% unpeturbed end-to-end distance of the chain.
% The following code assumes a displacement of $x = r$. Energy is force x
% displacement, so the above force must be multiplied by some displacement
% in order to be added to the interparticle attractive energy.

Answers (1)

JWTay on 15 Mar 2013
I've been having the same problem with the math fonts so I had a look into it today. Unfortunately there is no good answer. The problem here is caused by MATLAB's odd way of rendering the equations. From what I can see in the publish.m file, MATLAB first uses a figure to render the TeX equation, then somehow generates a .bmp of this figure. The code it uses to do this is an encrypted m-file so I have no idea what it is actually doing.
Long story short, I came up with a dirty workaround. Basically increase the font size by using the trick described here as well as editing the swapTexForImg() function in publish.m to use a reduced image size. This still produces blurry images but it is at least readable.
Hope this helps and feel free to let me know if you need more explicit examples.
p/s: I'm using Windows 8 and MATLAB R2011a so it's a persistent problem.


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!