next up previous contents
Next: Assignments to expressions Up: String manipulation Previous: Upper and lower case

Controlling line breaking

Some editors (such as vi in UNIX) limit the number of lines a single expression may occupy. It is therefore useful to be able to specify how to break long expressions explicitly. This option may also be useful when cutting and pasting expressions into different sized windows.

In[4]:= expr = Expand[(w-Sin[x]+y+Exp[z])^2];

In[5]:= FortranAssign[expr,expr,AssignBreak->{45,"\n     &  "}]

Out[5]//OutputForm=
        expr=w**2+2.*w*y+y**2+2.*w*exp(z)+2.*
     &  y*exp(z)+exp(2.*z)-2.*w*sin(x)-2.*y*s
     &  in(x)-2.*exp(z)*sin(x)+sin(x)**2
ANSI standard conforming FORTRAN code occupies columns 7 to 72 (the others are reserved for special tokens such as continuation characters and statement labels). As already mentioned, the default output of FortranAssign uses columns 8 to 72 since this aligns with the tab character, commonly used in programs to save on file space. Many modern compilers allow variants on line formatting which are not part of the FORTRAN standard. In such cases, the default setting can be modified using the AssignBreak option as above.



Jorge Romao
5/14/1998