The module contains several subroutines to produce simple table in Latex format.
The first argument uunit is the unit number for writing.
Set uunit=0 or 6 for screen output.
If one need to output to a text file, open it as form='formatted' first.
# call latextabhead(uunit,fformat,command) # call latextabend(uunit,command)
This two subroutines produce the head and end part of the table, i.e. \begin{table} and \end{table} and etc..
fformat defines the alignment. For example, fformat='{c|c|c}' indicating 3 column data with centering and vertical lines.
Set optional argument command=1 to produce {table*}.
# call latextabintblock(uunit,array,fformat) # call latextabrealblock(uunit,array,fformat) # call latextabcmplxblock(uunit,array,fformat) # call latextabcharblock(uunit,array,fformat)
The above four subroutines write data in the given format.
The data array should have shape of array(:,:).
fformat specifies the formatted data output. For example, one can set fformat='i8' for integer data array, 'f6.3' for real data array or '2f6.3' for complex data array.
If array(:,1)=(2.31, 3.52, 6.78) and fformat='f6.2', the output is something like ' 2.31 & 3.52 & 6.78 \\'
# call latextabdintblock(uunit,array,fformat) # call latextabdrealblock(uunit,array,fformat) # call latextabdcmplxblock(uunit,array,fformat)
For integer, real and complex data array, the double precision version is provided. Note the 'd' character before 'int', 'real' and 'cmplx'.
The above subroutines only could deal with one kind of data in one row.
If one need to output various kinds of data in one row, define the components for type(latextabdata) in 'definetype.f90' first.
'definetype.f90' is included between the type(latextabdata) and endtype(latextabdata) in 'latextable.f90'.
The name for each component is arbitrary since it is used as a whole.
# call latextabtypeblock(uunit,array,fformat)
The above subroutine writes a type array.
Caution that the fformat should be a character vector specifying the format for each element in type.
For example, if one defines the component as character(10); integer(4); real(4) in 'definetype.f90', the fformat could be fformat(1)='a10'; fformat(2)='i8'; fformat(3)='f6.3'.
The size of fformat should be the same as the number of components defined in type(latextypedata).
All the above data writing subroutines have corresponding subroutines for only writing one row.
In the following subrotuines, array should have shape of array(:)
Replacing 'block' to 'row' in the subroutine name to call them.
For example,
# call latextabcharrow(uunit,array,fformat)
All the above subroutines dealing with data could be called as the generic interface
# call latextabwrite(uunit,array,fformat)
In this case, please be careful with the data type, kind and output format.
# call latextabhline(uunit,nline)
The above subroutine will produce nline horizontal lines, i.e. writing \hline for nline=1 and \hline\hline for nline=2.
Subroutine latextabhhline(uunit) is the alias for nline=2.
One can set tabdebug=.true. to output the format for each row when calling the above subroutines.