Skip to content

Table fails to round-trip ascii.aastex due to incorrect requirement for a '\\' on the last line of a table #5160

@wmwv

Description

@wmwv

The following test code fails under astropy 1.2.1:

from astropy.table import Table
test_file = 'test.tex'
foo = Table([['A', 'B']], names=['Letters'])

foo.write(test_file, format='ascii.aastex')
bar = Table.read(test_file, format='ascii.aastex')

fails with

astropy.io.ascii.core.InconsistentTableError: Lines in LaTeX table have to end with \\

https://github.com/astropy/astropy/blob/master/astropy/io/ascii/latex.py#L77

The parser is wrong. It is OK (and, in fact, generally desired) for the last line of a table to not end in an \\. But wrong or right, round-tripping should at least work.

As far as I can tell, the change introduced in #3888 and #4561 to not write out this last \\ broke this reading.

This relates to #4295 #3888 #4576 #4561

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions