Skip to content

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

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

Activity

  1. taldcroft commented on Jul 6, 2016

    @taldcroft
    Member

    I agree the reader should be fixed to not require the last \\.

    More generally we should include regression testing that writes and reads back a simple table for every format that has a writer.

  2. wmwv commented on Aug 11, 2016

    @wmwv
    ContributorAuthor

    @taldcroft I've submitted a pull request for a fix for this no \ on last line issue as #5236
    I've submitted a pull request for a round-trip tester as #5235.

  3. bsipocz commented on Sep 26, 2019

    @bsipocz
    Member

    The example above works with current master, please reopen if you still experience the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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