F77 IO, multiple outputs per line
- From: "magesing" <magesing@xxxxxxxxx>
- Date: 29 Oct 2006 06:04:01 -0800
Hi,
I'm just learning to code in FORTRAN 77, and one of the subroutines I
have coded outputs a report which can then be copiled using pdfLaTeX.
This involves outputting several arrays with '&' between each element
and '\\' at the end of each row.
The problem is, I cannot figure out how to tell the compiler when not
to add a carridge return after an output.
How could I change my subroutine so that all elements from a single row
of the input appear on a single line of the output?
Thanks.
[code]
C***************LaTeX output report generator***********
subroutine TEXout(GS,D,F,DOF, M)
double precision GS(DOF*M,DOF*M), D(DOF*M), F(DOF*M)
integer i,j, M
C Output the global stiffness matrix as a LaTeX formatted matrix
open(99, FILE='GSout.tex',STATUS='NEW')
write(99,*)'\\documentclass{article}'
write(99,*)'\\usepackage{amsmath, amsthm}'
write(99,*)'\\usepackage
2[left=.5cm,top=1cm,right=.5cm,nohead,nofoot]{geometry}'
write(99,*)'\\begin{document}'
write(99,*)'\\subsection{Global Stiffness Matrix}'
write(99,*)'\\begin{align}'
write(99,*)'\\left[\\begin{matrix}'
do 70 i=1, DOF*M
do 71 j=1, DOF*M
write(99,*) GS(i,j), ' & '
71 continue
write(99,*) '\\\\'
70 continue
write(99,*)'\\end{matrix}\\right]'
write(99,*)'\\end{align}'
write(99,*)'\\subsection{Displacements}'
write(99,*)'\\begin{align}'
write(99,*)'\\{U\\} &= \\left\\{\\begin{matrix}'
do 80 i=1, DOF*M
write(99,*) D(i), '\\\\'
80 continue
write(99,*)'\\end{matrix}\\right\\}'
write(99,*)'\\end{align}'
write(99,*)'\\subsection{Forces}'
write(99,*)'\\begin{align}'
write(99,*)'\\{F\\} &= \\left\\{\\begin{matrix}'
do 81 i=1, DOF*M
write(99,*) F(i), '\\\\'
81 continue
write(99,*)'\\end{matrix}\\right\\}'
write(99,*)'\\end{align}'
write(99,*)'\\end{document}'
close(99)
write(*,*) 'a AMS LaTeX formatted version of the global stifness
2 matrix has been written to GSout.tex'
return
end
[\code]
.
- Follow-Ups:
- Re: F77 IO, multiple outputs per line
- From: Gordon Sande
- Re: F77 IO, multiple outputs per line
- From: David Rowell
- Re: F77 IO, multiple outputs per line
- Prev by Date: Re: Why these original FORTRAN quirks?
- Next by Date: Re: F77 IO, multiple outputs per line
- Previous by thread: io-unit has been opened
- Next by thread: Re: F77 IO, multiple outputs per line
- Index(es):