Is there anything (command/script/function) that can convert a Octave expression to LaTeX.

What I am asking for is something like this:

I type

```
a = eye(3,3); %Identity Matrix
```

and then do something like `textify_me(a)`

which produces

```
\begin{array}{ccc}
1 & 0 & 0 \\ blah blah blah
\end{array}
```

AND/OR

```
syms x
int(sym('x^2'))
```

produces

```
\frac{x^3}{3}
```

I am not asking for "sweaving" of codes, exporting figures or anything similar. I am simply asking for conversion of variables and symbolic expressions directly to LaTeX format.

MATLAB has a function `latex`

which does this. But it is closed source. Is there something Open Source or should I attempt to try and accumulate people to write it?

## Best Answer

If all you need is a matrix, you can do this:

where A is your matrix. That will give you the body of your matrix, without the

`\begin{matrix}`

and`\end{matrix}`

will generate the whole thing.

I don't think there is a more comprehensive solution in Octave.

Another option seems to be using scilab. It is also more or less MATLAB compatible (some say even more than Octave), and it has a prettyprint function that seems to do what you want. I have no experience with scilab, though.