{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/3645","labels_url":"https://api.github.com/repos/astropy/astropy/issues/3645/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3645/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/3645/events","html_url":"https://github.com/astropy/astropy/issues/3645","id":65103701,"number":3645,"title":"Adjusting the Left/Right/Center alignment of latex tables","user":{"login":"agroener","id":3950422,"avatar_url":"https://avatars.githubusercontent.com/u/3950422?v=3","gravatar_id":"","url":"https://api.github.com/users/agroener","html_url":"https://github.com/agroener","followers_url":"https://api.github.com/users/agroener/followers","following_url":"https://api.github.com/users/agroener/following{/other_user}","gists_url":"https://api.github.com/users/agroener/gists{/gist_id}","starred_url":"https://api.github.com/users/agroener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agroener/subscriptions","organizations_url":"https://api.github.com/users/agroener/orgs","repos_url":"https://api.github.com/users/agroener/repos","events_url":"https://api.github.com/users/agroener/events{/privacy}","received_events_url":"https://api.github.com/users/agroener/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/table","name":"table","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-03-29T22:39:14Z","updated_at":"2015-10-02T02:22:52Z","closed_at":null,"body":"I don't know if this is already a thing, but it would be cool to be able to adjust the left/right/center alignment of columns of a latex table written out to file from an astropy.table.Table object. \r\n\r\nWe've just recently added the 'align' kwarg for the pprint() function, and have also added the ability to align columns in a table via 'format', too (see #3037 and #3644 ). As an example, I could align the following table using one of two methods:\r\n\r\nFirstly, I could adjust an individual column's alignment by doing:\r\n\r\n    >>> from astropy.table import Table\r\n    >>> t = Table()\r\n    >>> t['col1'] = [1,2,3,4,5]\r\n    >>> t['col2'] = [1,2,3,4,5]\r\n    >>> t['col3'] = [1,2,3,4,5]\r\n    >>> t.pprint()\r\n    col1 col2 col3\r\n    ---- ---- ---- \r\n       1    1    1\r\n       2    2    2\r\n       3    3    3\r\n       4    4    4\r\n       5    5    5\r\n    >>> t['col3'].format = '<'\r\n    >>> t.pprint()\r\n    col1 col2 col3\r\n    ---- ---- ----\r\n       1    1 1   \r\n       2    2 2   \r\n       3    3 3   \r\n       4    4 4   \r\n       5    5 5   \r\n\r\nSecondly, I could pass in a kwarg, 'align', into pprint():\r\n\r\n    >>> t.pprint(align=['<','^','0='])\r\n    col1 col2 col3\r\n    ---- ---- ----\r\n    1     1   0001\r\n    2     2   0002\r\n    3     3   0003\r\n    4     4   0004\r\n    5     5   0005\r\n\r\n\r\nWhat I would like to see, is a latex table which I have the option of passing in alignment arguments. And to be consistent with the above example, it could look something like this:\r\n\r\n    >>> t.write('/Users/uname/Desktop/test.tex',format='latex', align=['<','^','>'])\r\n\r\n    \\begin{table}\r\n    \\begin{tabular}{lcr}\r\n    col1 & col2 & col3 \\\\\r\n    1 & 1 & 1 \\\\\r\n    2 & 2 & 2 \\\\\r\n    3 & 3 & 3 \\\\\r\n    4 & 4 & 4 \\\\\r\n    5 & 5 & 5 \\\\\r\n    \\end{tabular}\r\n    \\end{table}\r\n\r\nOne could even imagine the ability to add vertical lines in between the l/r/c specifiers."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/144900000","html_url":"https://github.com/astropy/astropy/issues/3645#issuecomment-144900000","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3645","id":144900000,"user":{"login":"taldcroft","id":348089,"avatar_url":"https://avatars.githubusercontent.com/u/348089?v=3","gravatar_id":"","url":"https://api.github.com/users/taldcroft","html_url":"https://github.com/taldcroft","followers_url":"https://api.github.com/users/taldcroft/followers","following_url":"https://api.github.com/users/taldcroft/following{/other_user}","gists_url":"https://api.github.com/users/taldcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/taldcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taldcroft/subscriptions","organizations_url":"https://api.github.com/users/taldcroft/orgs","repos_url":"https://api.github.com/users/taldcroft/repos","events_url":"https://api.github.com/users/taldcroft/events{/privacy}","received_events_url":"https://api.github.com/users/taldcroft/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T02:22:52Z","updated_at":"2015-10-02T02:22:52Z","body":"@agroener - there seems to be some leftovers in the docstrings, which refer to defaults of `right` that don't seem to apply in the code anywhere."}}