Skip to content

Commit 439acc9

Browse files
authored
DOC: expand allowed vals for multicol_align (#43656)
1 parent 0524ef8 commit 439acc9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

pandas/core/config_init.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,11 @@ def register_converter_cb(key):
816816
The specifier for vertical alignment of sparsified LaTeX multirows.
817817
"""
818818

819-
styler_multicol_align = """
820-
: {"r", "c", "l"}
821-
The specifier for horizontal alignment of sparsified LaTeX multicolumns.
819+
styler_multicol_align = r"""
820+
: {"r", "c", "l", "naive-l", "naive-r"}
821+
The specifier for horizontal alignment of sparsified LaTeX multicolumns. Pipe
822+
decorators can also be added to non-naive values to draw vertical
823+
rules, e.g. "\|r" will draw a rule on the left side of right aligned merged cells.
822824
"""
823825

824826
styler_environment = """
@@ -918,11 +920,13 @@ def register_converter_cb(key):
918920
validator=is_one_of_factory(["c", "t", "b", "naive"]),
919921
)
920922

923+
val_mca = ["r", "|r|", "|r", "r|", "c", "|c|", "|c", "c|", "l", "|l|", "|l", "l|"]
924+
val_mca += ["naive-l", "naive-r"]
921925
cf.register_option(
922926
"latex.multicol_align",
923927
"r",
924928
styler_multicol_align,
925-
validator=is_one_of_factory(["r", "c", "l", "naive-l", "naive-r"]),
929+
validator=is_one_of_factory(val_mca),
926930
)
927931

928932
cf.register_option(

pandas/io/formats/style.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,11 @@ def to_latex(
530530
multicol_align : {"r", "c", "l", "naive-l", "naive-r"}, optional
531531
If sparsifying hierarchical MultiIndex columns whether to align text at
532532
the left, centrally, or at the right. If not given defaults to
533-
``pandas.options.styler.latex.multicol_align``. If a naive option is
534-
given renders without multicol.
533+
``pandas.options.styler.latex.multicol_align``, which is "r".
534+
If a naive option is given renders without multicol.
535+
Pipe decorators can also be added to non-naive values to draw vertical
536+
rules, e.g. "\|r" will draw a rule on the left side of right aligned merged
537+
cells.
535538
536539
.. versionchanged:: 1.4.0
537540
siunitx : bool, default False

0 commit comments

Comments
 (0)