Thread Subject: publish m-file in word (with formulas in latex)

Subject: publish m-file in word (with formulas in latex)

From: gigio

Date: 24 Jul, 2005 09:44:23

Message: 1 of 3

Hi all,
I wish to publish my m-file in word,
using the 'save and publish' command in the editor.
I use several function form different m-file.
I wish to show a simple description of the functions.

Instead of to put a cell like
%%
%
% $$f(x)= \cases{x & if $x<1$ \cr 0 & if $\ge1$}$$

to describe the function , I wrote the string in the function itself
i.e., the command myFunction('giveMeYourDescription')
return the above string $f(x)= \cases{ ... etc
I write a simple function plotInLatex (see below) that display the
latex output in a graphic window.

So, my m.file for publish my work is:

%%
% this is my 1-st function
plotInLatex( myFunction_1('giveMeYourDescription'));
%%
% this is my 2-nd function
plotInLatex( myFunction_2('giveMeYourDescription'));

It works, that is my .doc contain the latex output

 but I have 4 questions.

1- the output in word is not of good quality. I have explored the
'publishing images preferences', but without improving the quality.

2- there is a way to estimate the size of the formula, in order to set
the 'height' value inside the function plotInLatex? There is a way to
'autofit' the formula?

3- yes I now, probabily the best result is obtained publishing in
latex (that I don't know)
I tried to publish in latex using the 'save and publish' command,
but my figures[[plot (x, f(x))] exits to the page... In word this
don't happen.
There is some stupid setting that I forgot?

4- maybe I'm using the most complicate way to do the things...
any suggestion?
Thanks!!






------------------------------------------------------------------------------------
function plotInLatex(mytexstr)
% mytexstr = '$f(x)= \cases{x & if $x<1$ \cr 0 & if $\ge1$}$';
h1=figure;
h = text('string',mytexstr,...
    'interpreter','latex',...
    'fontsize',14,...
    'units','norm',...
    'pos',[0 .5]);
axis off

height=100;
set(h1,'Position',[0,300,600,height]);
set(h1,'OuterPosition',[0,300,600,height]);
set(h1,'Color',[1,1,1])
set (h1,'MenuBar','none')
------------------------------------------------------------------------------------

Subject: publish m-file in word (with formulas in latex

From: Matthew Simoneau

Date: 25 Jul, 2005 11:25:33

Message: 2 of 3

1) We use a the trick publish.m's subfunction renderTeX of rending
these equations large, then resizing them down. This simulates
anti-aliasing.

2) You'd like to be able to get the text object's 'Extent', but this
doesn't work properly for LaTeX rendering. We make the figure as big
as possible (hoping the equation will fit), and then trim off the
blank areas.

3) I don't understand your question on this one.
4) Your goal, as I understand it, is to hide the LaTeX equation in
your M-file. There isn't a good way to do that. You may also
consider using apreprocessorrr to do the substitution in an
intermediate M-file, then publishing it normally.

Subject: publish m-file in word (with formulas in latex)

From: gigio

Date: 30 Jul, 2005 15:46:59

Message: 3 of 3

On Sun, 24 Jul 2005 09:44:23 GMT, gigio <gigio@tin.it> wrote:


On google groups I saw that somebody answer my question.

My thanks are late because this post don't appear in my news server !

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com