PRO ArrayIntPrint,AP,Lines=lines,SWP_Table=swp,Equation=equation ;+ ;PROCEDURE ArrayIntPrint,A produces a Latex array ;that is printed on the screen and can be cut and pasted ;into a Latex document as a TeX field. Can be used wherever ;a tabular field is desired. Use a text editor to add elements ;such as \hline and so on if you need dividing lines. The ;entries are printed as integers. ; ;USAGE ;ArrayPrint,A ;Prints results on the screen. ; ;KEYWORDS: ;LINES Set /Lines to have the array printed with row and column lines. ;SWP_Table Set this keyword to print out the table header and footer ; so the result can be a floating table in a SWP document ;EQUATION Set Equation to construct an equation to be pasted into ; a SWP document. Equation and SWP_TAble are mutually ; exclusive. ; ;Version 1.0 Harvey Rhody June 5, 2000 ;- SIZA=SIZE(AP) IF SIZA[0] GT 2 THEN MESSAGE,'Array must be dimension 1 or 2' ;Set things for a Scientific Workplace Table IF Keyword_Set(swp) AND NOT Keyword_Set(equation) THEN BEGIN Print,'%TCIMACRO{\TeXButton{B}{\begin{table}[tbp] \centering}}%' Print,'%BeginExpansion' Print,'\begin{table}[tbp] \centering%' Print,'%EndExpansion' ENDIF ; Form without lines IF NOT Keyword_Set(lines) THEN BEGIN st=STRARR(SIZA[1]) FOR i=0,SIZA[1]-1 DO st[i]='r' ; Form with lines ENDIF ELSE BEGIN st=STRARR(sizA[1]) st[0]='|r|' For i=1,sizA[1]-1 DO st[i]='r|' ENDELSE IF NOT Keyword_Set(swp) AND Keyword_Set(equation) THEN BEGIN header=['\begin{equation} ','\begin{array}{',st,'}'] footer='\end{array}' + '\label{} '+'\end{equation}' END ELSE BEGIN header=['\begin{tabular}{',st,'}'] footer='\end{tabular} END IF Keyword_Set(lines) THEN line='\hline' ELSE line='' PRINT,header Print,line A=FIX(AP) IF SIZA[0] EQ 1 THEN BEGIN PRINT,STRING(FORMAT='($,I8,:," & ")',A) Print,footer IF Keyword_Set(swp) THEN BEGIN Print,'\caption{Table Caption\label{key}}%' Print,'%TCIMACRO{\TeXButton{E}{\end{table}}}%' Print,'%BeginExpansion' Print,'\end{table}%' Print,'%EndExpansion' ENDIF RETURN ENDIF $ ELSE FOR i=0,SIZA[2]-2 DO BEGIN PRINT,String(FORMAT='($,I8,:," & ")',A[*,i]) PRINT,' \\ ' + line ENDFOR PRINT,String(FORMAT='($,I8,:," & ")',A[*,SIZA[2]-1]) IF Keyword_Set(lines) THEN Print,'\\ \hline' PRINT,footer ;Add the Scientific Workplace Table ending IF Keyword_Set(swp) AND NOT Keyword_Set(equation) THEN BEGIN Print,'\caption{Table Caption\label{key}}%' Print,'%TCIMACRO{\TeXButton{E}{\end{table}}}%' Print,'%BeginExpansion' Print,'\end{table}%' Print,'%EndExpansion' ENDIF END