[Mac OS X TeX] my mathematica workaround

Michel Durinx durinx at rulsfb.leidenuniv.nl
Wed Jan 30 11:31:18 EST 2002




An Essay By Michel     : )
===============

In my simple experience TeXtypesetting mathematica is a nightmare.  And 
the TeXcode you get at the end is only usefull for someone who has the 
Wolfram package installed, so your code cannot be read by another 
TeXuser... so I gave up the Wolfram stuff.
My workaround is:

1--- do I want mathematica-look & feel?   then make a .pdf of the 
notebook, and include pieces of it as a graphic.
The pieces with \usepackage{graphicx}  (\includegraphics & say where to 
trim it);

the making of one .pdf page with:
1a Acrobat
or

1b(Mathematica for Classic): print-to-file so you have .ps, use Tom 
McKiffe's MacGStoPDF
to have a .pdf, then one page of it  as a preview
or

1c  isn't there an .eps saving possibility in Mathematica?   then  from 
the terminal,
me %  epstopdf name.nb
and preview the needed page

2---do I want the results?  they cut & paste mathematica with command 
c & v, and do systematic changes to make it LaTeX code.
[If I find out what all possible needs are, I could have a general PERL 
script translating all in one go... upto now I have needed only matrices 
or just lines with terms...]

e.g.
A  3by3 matrix in Mathematica,
In its default form do apple + c, then in TeXshop do apple + v, and it 
looks in TeXshop as:
(this was basic recipe for writing a PERL script to do the converting 
into LaTeX of matrices.
It's overkill for small matrices so I didn't do it)

example of pasted matrix:

{{-a23 a32 + a22 a33,
     a13 a32 - a12 a33, -a13 a22 + a12 a23}, {a23 a31 - a21 a33, -a13 
a31 +
       a11 a33, a13 a21 - a11 a23}, {-a22 a31 + a21 a32,
     a12 a31 - a11 a32, -a12 a21 + a11 a22}}

To convert it to a LaTeX tabular thing:
a. count # comma's in row-vector: 2 --> columns = 2 + 1 so its a 
3-column matrix...
b. first			{{  			becomes   	\begin{tabular}{ccc}
% as many c's as  columns.
% off course r if you want the entries right aligned
c. any  			}, {  	or },{		becomes 		\\
d. any remaining 	, 			becomes 		&
e. last 			}} 			becomes 		\end{tabular}

f.. here specificly	a11			becomes		\aoo
				a12						\aot
				a13						\aod
				a21						\ato
				a22						\att
				a23						\atd
				a31						\ado
				a32						\adt
				a33						\add
     or alternatively 	aij			becomes		\a(\X_{\!i},\X_{\!j})
							for all i,j = {1,2,3}

\begin{tabular}{ccc}
	-a23 a32 + a22 a33& a13 a32 - a12 a33& -a13 a22 + a12 a23 \\
	 a23 a31 - a21 a33& -a13 a31 + a11 a33& a13 a21 - a11 a23\\
	-a22 a31 + a21 a32&  a12 a31 - a11 a32& -a12 a21 + a11 a22
\end{tabular}

% ********************
Note: pasting  MatrixForm[MyMatrix]  becomes hopelessly illegible...
\!\(\*
   TagBox[
     RowBox[{"(", "\[NoBreak]", GridBox[{
           {\(\(-a23\)\ a32 + a22\ a33\), \(a13\ a32 -
               a12\ a33\), \(\(-a13\)\ a22 + a12\ a23\)},
           {\(a23\ a31 - a21\ a33\), \(\(-a13\)\ a31 +
               a11\ a33\), \(a13\ a21 - a11\ a23\)},
           {\(\(-a22\)\ a31 + a21\ a32\), \(a12\ a31 -
               a11\ a32\), \(\(-a12\)\ a21 + a11\ a22\)}
           }], "\[NoBreak]", ")"}],
     Function[ BoxForm`e$,
       MatrixForm[ BoxForm`e$]]]\)


-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
This list is not moderated, and I am not responsible for
messages posted by third parties.
-----------------------------------------------------------------




More information about the MacOSX-TeX mailing list