Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: short caption for LaTeX tables #36267

Closed
ivanovmg opened this issue Sep 10, 2020 · 0 comments · Fixed by #35668
Closed

ENH: short caption for LaTeX tables #36267

ivanovmg opened this issue Sep 10, 2020 · 0 comments · Fixed by #35668
Assignees
Milestone

Comments

@ivanovmg
Copy link
Member

Is your feature request related to a problem?

DataFrame.to_latex() does not allow one to specify short caption.
Short caption is useful for the creation of neat-looking list of tables, where the caption is short, fitting into one line.

Describe the solution you'd like

Either add kwarg short_caption to to_latex method.
Alternatively expand the meaning of kwarg caption, so that it can optionally be unpacked into full_caption, short_caption.

API breaking implications

No.

Describe alternatives you've considered

No.

Additional context

Example of LaTeX table with short caption.

\begin{table}
  \centering
  \caption[Short caption]{Long-long full caption}
  \label{tab:label}
  \begin{tabular}{lr}
    \toprule
    Col1 & Col2 \\
    \midrule
    1 & 3 \\
    2 & 4 \\
    \bottomrule
  \end{tabular}
\end{table}

Possible code snippet:

df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
df.to_latex(caption=('long caption', 'short caption'))
@ivanovmg ivanovmg added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 10, 2020
@ivanovmg ivanovmg self-assigned this Sep 10, 2020
@ivanovmg ivanovmg added this to the 1.2 milestone Sep 10, 2020
@ivanovmg ivanovmg added IO LaTeX to_latex and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant