public String toStringLatex ( ) { List < List < String >> table = prepareToString ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < table . size ( ) ; i ++ ) { List < String > row = table . get ( i ) ; for ( int j = 0 ; j < row . size ( ) ; j ++ ) { String value = row . get ( j ) ; if ( ( i == 0 || j == 0 ) && ! value . isEmpty ( ) ) { sb . append ( "\\textbf{" ) . append ( value ) . append ( "} " ) ; } else { sb . append ( value ) ; sb . append ( " " ) ; } if ( j < row . size ( ) - 1 ) { sb . append ( "& " ) ; } } sb . append ( "\\\\\n" ) ; } return sb . toString ( ) ; }
Prints in LaTeX format