{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/11914","labels_url":"https://api.github.com/repos/pydata/pandas/issues/11914/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/11914/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/11914/events","html_url":"https://github.com/pydata/pandas/pull/11914","id":123989919,"number":11914,"title":"EHN encoding parameter for to_latex","user":{"login":"nbonnotte","id":9929982,"avatar_url":"https://avatars.githubusercontent.com/u/9929982?v=3","gravatar_id":"","url":"https://api.github.com/users/nbonnotte","html_url":"https://github.com/nbonnotte","followers_url":"https://api.github.com/users/nbonnotte/followers","following_url":"https://api.github.com/users/nbonnotte/following{/other_user}","gists_url":"https://api.github.com/users/nbonnotte/gists{/gist_id}","starred_url":"https://api.github.com/users/nbonnotte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbonnotte/subscriptions","organizations_url":"https://api.github.com/users/nbonnotte/orgs","repos_url":"https://api.github.com/users/nbonnotte/repos","events_url":"https://api.github.com/users/nbonnotte/events{/privacy}","received_events_url":"https://api.github.com/users/nbonnotte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-27T17:52:12Z","updated_at":"2015-12-28T12:46:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/11914","html_url":"https://github.com/pydata/pandas/pull/11914","diff_url":"https://github.com/pydata/pandas/pull/11914.diff","patch_url":"https://github.com/pydata/pandas/pull/11914.patch"},"body":"I'm working on solving issue #7061: currently, with Python 2 it is not possible to use `.to_latex()` when the dataframe contains utf-8 strings. This PR adds an `encoding` parameter to make it possible.\r\n\r\nThe work is not completely done though, and I'm making this PR to start a discussion here. In its current state, the PR quickly fixes the issue and provides tests, so it is kind of a minimal PR.\r\n\r\n@jreback in the discussion on issue #7061, you made the following suggestion:\r\n\r\n> you _may_ want to add a `LatexFormatter` (as a sub-class of `DataFrameFormatter`) as this will allow some re-factoring to be internally done later on. \r\n\r\nI would be glad to work in that direction, but I'm a bit confused by the current organization of the code. This `LatexFormatter` would seem to me to be similar to `HTMLFormatter`, which inherits from `TableFormatter` (exactly as `DataFrameFormatter`). In that case, `DataFrameFormatter` would use `LatexFormatter` for `.to_latex()` exactly as it uses `HTMLFormatter` for `.to_html()`.  Is that what you had in mind?"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/167563270","html_url":"https://github.com/pydata/pandas/pull/11914#issuecomment-167563270","issue_url":"https://api.github.com/repos/pydata/pandas/issues/11914","id":167563270,"user":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T12:46:26Z","updated_at":"2015-12-28T12:46:26Z","body":"@nbonnotte what I mean is that I think a ``LatexFormatter`` be created in ``format.py`` which is *like* ``HTMLFormatter`` (its a sub-class of ``TableFormatter``). So you don't have all of the latex formatting code living in ``to_latex`` itself (which instead just instantiates a class and calls ``.write_result``, similarly to ``to_html``).\r\n\r\nThis will allow easier refactoring later."}}