Inspired by #2869
LaTeX and AASTex already have a mechanism to print units, but only if explicetly passed in. If no units are given, those writers could use the units already defined in the table column - we have a latex representation for that.
This works:
from astropy.table import Table, Column
import astropy
from copy import deepcopy
COSobs = Table([Column(name='date', data=['a','b']),
Column(name='NUV exp.time', data=[1,2]),
])
latexdict = deepcopy(astropy.io.ascii.latexdicts['AA'])
latexdict['units'] = {'NUV exp.time':'s', 'FUV ext.time':'s'}
COSobs.write(sys.stdout, format='ascii.aastex', latexdict=latexdict,
caption=r"\label{tab:obsCOS}Observations log of \emph{HST}/COS observations")
out:
\begin{table}{cc}
\tablecaption{\label{tab:obsCOS}Observations log of \emph{HST}/COS observations}
\tablehead{\colhead{date} & \colhead{NUV exp.time}\\ \colhead{ } & \colhead{s}}
\startdata
a & 1 \\
b & 2 \\
\enddata
\end{table}
But this should probably also work:
COSobs = Table([Column(name='date', data=['a','b']),
Column(name='NUV exp.time', data=[1,2], unit=astropy.units.s),
])
COSobs.write(sys.stdout, format='ascii.aastex')
No units in output:
\begin{deluxetable}{cc}
\tablehead{\colhead{date} & \colhead{NUV exp.time}}
\startdata
a & 1 \\
b & 2 \\
\enddata
\end{deluxetable}
Inspired by #2869
LaTeX and AASTex already have a mechanism to print units, but only if explicetly passed in. If no units are given, those writers could use the units already defined in the table column - we have a latex representation for that.
This works:
out:
But this should probably also work:
No units in output: