Skip to content

ENH: expand multicol_align and multirow_align Styler.to_latex #43471

Closed
@attack68

Description

@attack68

Currently styler only allows multicol_align in {"r", "l", "c", "naive-l", "naive-r"}

Simple pipe characters around multicol_alignment allow dividers to be drawn, e.g. |r or |r| or r| etc..

\begin{tabular}{lllrrrrrr}
\toprule
{} & {} & {} & \multicolumn{3}{|r|}{1} & \multicolumn{3}{|r|}{2} \\ 
{} & {} & {} & \multicolumn{2}{r|}{a} & {b} & \multicolumn{2}{|l}{a} & {b} \\
{} & {} & {} & {0} & {0} & {0} & {0} & {0} & {0} \\
\midrule
\multirow[t]{3}{*}{1} & \multirow[t]{2}{*}{a} & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 &  & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 & b & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ \cline{1-3}
\multirow[t]{3}{*}{2} & \multirow[t]{2}{*}{a} & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ 
 &  & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ 
 & b & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 \bottomrule
\end{tabular}

Screen Shot 2021-09-09 at 08 44 16

Also note the cline (this one might be harder to implement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO LaTeXto_latexStylerconditional formatting using DataFrame.style

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions