The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Project proposal: a scilab (or matlab) code to LaTeX converter
Replies: 9   Last Post: Oct 29, 2001 8:49 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Joe Sababa

Posts: 963
Registered: 12/7/04
Re: Project proposal: a scilab (or matlab) code to LaTeX converter
Posted: Oct 12, 2001 9:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Jan Meyer <> wrote in message news:<>...
> Hi,
> IMHO one of the greatest short comings of scilab and matlab is that
> they don't automatically generate documentation of the code as well as
> the results (e.g. compared to MathCad where building the model and
> showing which calculations were done in a presentable manner is one
> and the same step). Another problem with a pure text presentation (may
> it be fontified/colorized) is that one can easily overlook mistakes -
> which really reduces productivity.
> Since it is especially tedious to copy results that come in matrices
> or vectors into LaTeX, I have written a small scilab script that
> allows the user to automatically generate a LaTeX table from a couple
> of vectors for example with each run of the user's script.
> Now I am wondering if there are any packages / any software out there
> that converts scilab code into LaTeX code. Sure it would not look
> perfect but would be enough for proof reading or form a foundation for
> a polished LaTeX document. For example the scilab code:
> Cp = F*cos(alpha)/((1+r)^(n-1)-1);
> could be translated into:
> Cp = F \cdot\cos(alpha) / ((1+r)^{n-1}-1)
> ... just picture in your head what LaTeX would make of this (e.g. use
> different sized parethesies and make the power n-1 much more readable)
> if the translation code was a little fancier (i.e. the code could
> parse parenthesies and one would use substitution tables for variable
> names):
> C_p = \frac{F \cdot\cos(\alpha)}{(1+r)^{n-1}-1}
> One could even include the result right away if one starts with a
> comment that indicates the number format:
> Cp = F*cos(alpha)/((1+r)^(n-1)-1) \\F:US\$ %4.2f
> resulting in:
> C_p = \frac{F \cdot\cos(\alpha)}{(1+r)^{n-1}-1} = US\$ 12.34
> [This would probably require the documentation package run as a
> preprocessor to the scilab interpreter]
> Other statements that contain less math, one could treat with a really
> pretty print scheme.
> Finally one could display data in automatically generated tables from
> the following code:
> ------------------------
> data = yourFunction(parameters); // spits out a 10x4 matrix
> //TBegin <--- marks the beginning of a documentation block and is not interpreted
> like the rest of the code but simply executed
> headings = ["coefficient" "dimensional value" "non-dim. value" "non-dim. factor"];
> data = list(data(1), data(2), data(3), data(4));
> // The list() keyword creates something like a matrix that can contain
> // different data types (one of the nice function of scilab)
> formatStr = ["$%s$" "%6.4e" "%6.4e" "%6.4e" "%6.4e"];
> // generate a LaTeX table in a separate file called coeffTable.tex
> getf('latexTable.sci');
> latexTbl("coeffTable.tex", headings, data, formatStr);
> //TEnd
> ----------------
> ... this would translate to the following LaTeX code:
> ---------------
> data = yourFunction({\bf parameters}); {\small // spits out a 10x4 matrix}
> \input{coeffTable.tex}
> --------------
> A nice fringe affect is that one can convert from LaTeX to HTML or
> PDF.
> What do you think of this idea? Does such a software exist already for
> scilab (or matlab)?
> If not: This shouldn't be too much work to code (unless you want
> perfect output). Anybody interested in collaborating on this?
> - Jan
> P.S. please also reply by email to (I am having trouble
> with my newsgroup server recently)

Hi Jan,
Matlab users are split to Latex users and non-Latex users.
For Latex users there is the Symbolic Math Toolbox that includes 'latex' command.
For non-Latex users and for immediate use, e.g. view equation or output
during work in a styled fashion as well as annotation and labeling
figures, there is a project running now for several months called BSTEX.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.