How can I get Mathematica to export/save/write out a text file with proper Fortan77 formatting, i.e., 72 columns and a continuation marker on the sixth column.
I am using Mathematica to generate large and complex analytic expressions, which I then need to insert into pre-existing Fortran77 code. I can get everything working correctly in the front end of Mathematica with FortranForm[] and SetOptions[$Output, PageWidth -> 72]. However, I just can't figure out how to get Mathematica to output correctly into a text file. I want to get something like this:
MM11 = mH1**2 + (g2**2*v1**2)/2. -
- (g2**2*(v1**2/2. -
- ((v2*Cos(phi2) - (0,1)*v2*Sin(phi2))*
- (v2*Cos(phi2) + (0,1)*v2*Sin(phi2)))/2.))/2.
...
but end up getting either this:
MM11 = FortranForm[mH1^2 + (g2^2*v1^2)/2 - ...
or this:
MM11 = mH1**2 + (g2**2*v1**2)/2. - (g2**2*
(v1**2/2. - ((v2*Cos(phi2) - (0,1)*v2*Sin(phi2))*
...