Skip to content

ENH: Styler.to_latex conversion from CSS #40731

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

Merged
merged 150 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
bb501d3
MVP for Styler.to_latex
attack68 Mar 10, 2021
6066449
MVP for Styler.to_latex
attack68 Mar 10, 2021
6e2b788
rules
attack68 Mar 11, 2021
2f74690
hidden columns and index
attack68 Mar 11, 2021
9c9405e
basic cell colors and background colors parsing.
attack68 Mar 11, 2021
a6772e7
basic cell colors and background colors parsing.
attack68 Mar 11, 2021
6505564
basic cell colors and background colors parsing.
attack68 Mar 11, 2021
b25644f
column_format arg input
attack68 Mar 11, 2021
2ba7e02
add file buffer
attack68 Mar 11, 2021
79b978b
optional table wrapping
attack68 Mar 11, 2021
ed8b405
refactor
attack68 Mar 11, 2021
f7d52f4
more flexible table_styles
attack68 Mar 11, 2021
f35c7e1
docs to parse_latex
attack68 Mar 12, 2021
521aee2
auto column_format for numerics
attack68 Mar 13, 2021
849656f
to_latex unit tests
attack68 Mar 13, 2021
cce7285
more unit tests and code bugs removed
attack68 Mar 13, 2021
26edba4
deal with multi col headers
attack68 Mar 13, 2021
3d7c614
deal with sparsification with multirow and multicol
attack68 Mar 13, 2021
e2f0f0c
tests for multirow and multicol
attack68 Mar 13, 2021
3243ed7
comprehensive test
attack68 Mar 13, 2021
0decf2d
refactor
attack68 Mar 13, 2021
c8dc5e5
change -wrap- to --wrap
attack68 Mar 13, 2021
8c58538
remove redundant comments
attack68 Mar 13, 2021
5c9d50a
docs
attack68 Mar 13, 2021
563aef6
docs
attack68 Mar 13, 2021
99abe1c
doc edits
attack68 Mar 14, 2021
5185f27
mypy fix
attack68 Mar 14, 2021
a824f13
docs
attack68 Mar 14, 2021
f6211e8
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Mar 14, 2021
b46a9af
docs
attack68 Mar 14, 2021
7e3c5e1
docs
attack68 Mar 14, 2021
80d3cac
docs
attack68 Mar 14, 2021
9388dec
docs
attack68 Mar 14, 2021
ccac263
check fix
attack68 Mar 14, 2021
de69c21
col format for basic render
attack68 Mar 14, 2021
05f5b34
dependency fix
attack68 Mar 14, 2021
4d98615
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Mar 15, 2021
f036d25
test for multicols and hidden cols combined
attack68 Mar 15, 2021
a9e0ce4
test for hidden columns in a multiindex
attack68 Mar 17, 2021
989278f
better test
attack68 Mar 17, 2021
3a79966
better test
attack68 Mar 17, 2021
9051bfe
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Mar 21, 2021
938a0e8
fix latex for " "
attack68 Mar 21, 2021
0aed431
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Mar 24, 2021
0c0e2bc
latex CSS conversion
attack68 Mar 19, 2021
e82b566
colors as HTML and proper RGB parsing
attack68 Mar 20, 2021
095af35
add extended wrapping flags, for potential future dev
attack68 Mar 28, 2021
8af3c81
enhance the wrapping arguments
attack68 Mar 29, 2021
2e0aee6
remove render(latex=True) option
attack68 Mar 29, 2021
5067ffc
remove render(latex=True) option tests
attack68 Mar 29, 2021
ff4954e
remove render latex
attack68 Mar 29, 2021
d9836aa
remove render latex
attack68 Mar 29, 2021
5bdcb4e
put column headers in braces if not multicol
attack68 Mar 30, 2021
6f4a44b
add siunitx option, and expand docs
attack68 Mar 30, 2021
c211480
add sparsify as input argument and tests
attack68 Mar 30, 2021
2d32556
multirow and multicol alignment options
attack68 Mar 30, 2021
816e62f
test hidden index
attack68 Mar 30, 2021
9c577ce
change 'float' to 'position_float' to avoid shadow name
attack68 Mar 30, 2021
74721a8
doc internals
attack68 Mar 30, 2021
a6bc485
merge with latex mvp
attack68 Mar 30, 2021
7c7f0de
change default wrap
attack68 Mar 30, 2021
527724d
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Mar 30, 2021
4cdefb8
change default wrap
attack68 Mar 30, 2021
ee7397f
change test
attack68 Mar 30, 2021
f381011
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Mar 30, 2021
eb21587
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Mar 30, 2021
b9ff43d
documentation
attack68 Mar 30, 2021
2f5cdec
documentation
attack68 Mar 31, 2021
a6e4e47
compress code
attack68 Mar 31, 2021
e385fb0
clarify code
attack68 Mar 31, 2021
4eacb12
clarify code
attack68 Mar 31, 2021
b71d9eb
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Mar 31, 2021
fd95e34
simplify code
attack68 Apr 1, 2021
7126bda
simplify code
attack68 Apr 1, 2021
25bcba9
simplify code
attack68 Apr 1, 2021
34f0b91
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Apr 1, 2021
e35eea7
user guide docs
attack68 Apr 1, 2021
5ec08d8
basic subclassing
attack68 Apr 2, 2021
b74057b
basic subclassing
attack68 Apr 2, 2021
a49deeb
non_reducing_slice deprivatized
attack68 Apr 2, 2021
228f146
move io methods
attack68 Apr 2, 2021
44ead2d
import typing aliases
attack68 Apr 2, 2021
0ae8c39
rename renderer
attack68 Apr 2, 2021
70067c7
move to_excel and _repr_html_ back
attack68 Apr 2, 2021
3772cc8
move to_excel and _repr_html_ back
attack68 Apr 2, 2021
19828c3
Merge remote-tracking branch 'upstream/master' into basic_subclassing…
attack68 Apr 2, 2021
79ad3a6
Merge remote-tracking branch 'upstream/master' into basic_subclassing…
attack68 Apr 6, 2021
03415e5
fix typing to new standard
attack68 Apr 7, 2021
5697ff9
Merge remote-tracking branch 'upstream/master' into basic_subclassing…
attack68 Apr 9, 2021
41760e0
merge upstream master
attack68 Apr 10, 2021
92c11d1
Merge remote-tracking branch 'upstream/master' into basic_subclassing…
attack68 Apr 10, 2021
6547c6d
Merge branch 'basic_subclassing_styler' into latex_styler_mvp
attack68 Apr 10, 2021
3910fcf
Merge branch 'basic_subclassing_styler' into latex_styler_mvp
attack68 Apr 10, 2021
0164d90
documentation
attack68 Apr 11, 2021
463a54b
isort fix
attack68 Apr 11, 2021
4b7298f
doc improvements
attack68 Apr 11, 2021
47a31a9
doc improvements
attack68 Apr 11, 2021
c373bb6
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 12, 2021
8b00376
doc improvements
attack68 Apr 12, 2021
b1e230d
remove column_format branch
attack68 Apr 12, 2021
fd19d97
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 12, 2021
e31dba0
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 13, 2021
bdab13d
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 13, 2021
1074b62
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 13, 2021
9e5ca75
merge
attack68 Apr 13, 2021
133c1a0
merge
attack68 Apr 13, 2021
394bc3a
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 14, 2021
034960f
doc fix
attack68 Apr 14, 2021
8b62f8d
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 14, 2021
a0f1e79
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 15, 2021
2e714e9
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 18, 2021
38c62eb
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 20, 2021
f95c21e
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 21, 2021
c925958
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 23, 2021
2cc8ad2
mutate d, so return None instead
attack68 Apr 24, 2021
7d962df
review the main to_latex docs (rhshadrach requests)
attack68 Apr 24, 2021
a6f6af2
validate position_float (rhshadrach request)
attack68 Apr 24, 2021
dce66d6
grammar fix
attack68 Apr 24, 2021
8fc9f0b
_parse_latex_table_wrapping doc and bool return (rhshadrach request)
attack68 Apr 24, 2021
bb4479b
_parse_latex_table_styles doc
attack68 Apr 24, 2021
e2ea5ae
_parse_latex_cell_styles doc chg and break (rhshadrach request)
attack68 Apr 24, 2021
518485d
fix boolean
attack68 Apr 24, 2021
d99245c
_parse_latex_header_span docs (rhshadrach request)
attack68 Apr 24, 2021
766ad49
_translate_latex docs and return (rhshadrach request)
attack68 Apr 24, 2021
10c4682
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Apr 24, 2021
ee92f37
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 26, 2021
c7844d5
Merge remote-tracking branch 'origin/latex_styler_mvp' into latex_css…
attack68 Apr 26, 2021
b8e3418
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 26, 2021
2aca649
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 27, 2021
cf2f1e1
Merge remote-tracking branch 'upstream/master' into latex_styler_mvp
attack68 Apr 29, 2021
8f8da7d
Merge branch 'latex_styler_mvp' into latex_css_conversion
attack68 Apr 29, 2021
0ea3127
merge upstream master
attack68 May 24, 2021
a224cdd
add conversion docs
attack68 May 24, 2021
d91f7c3
update docs
attack68 May 24, 2021
f9f6622
remove updates to user_guide
attack68 May 24, 2021
002eb90
remove updates to user_guide
attack68 May 24, 2021
372a71a
mypy fix
attack68 May 25, 2021
11985a5
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 May 26, 2021
aa8e051
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 May 27, 2021
1c2280d
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 May 27, 2021
17f649c
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 May 28, 2021
1bb35c1
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 1, 2021
a55cc5b
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 3, 2021
dbb76ee
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 4, 2021
c569245
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 5, 2021
0ac614b
whats new addition.
attack68 Jun 5, 2021
3dd649a
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 9, 2021
18728c1
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 11, 2021
23281b1
Merge remote-tracking branch 'upstream/master' into latex_css_conversion
attack68 Jun 12, 2021
689afc6
Merge branch 'rls1.3.0' into latex_css_conversion
attack68 Jun 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/source/_static/style/latex_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/latex_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions doc/source/user_guide/style.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,135 @@
"See the template in the [GitHub repo](https://github.com/pandas-dev/pandas) for more details."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## LaTeX\n",
"\n",
"Since version XXX Styler has an alternative jinja2 template and additional parsing functions to allow it to produce conditionally styled LaTeX tables.\n",
"\n",
"The above HTML-CSS representation in terms of `(<attribute>, <value>)` pairs is effectively replaced by a LaTeX `(<command>, <options>)` format, and renders styles directly to each cell in a nested format. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df5 = pd.DataFrame([[1, 2.2, \"dogs\"], [3, 4.4, \"cats\"], [2, 6.6, \"cows\"]], \n",
" index=[\"ix1\", \"ix2\", \"ix3\"], \n",
" columns=[\"Integers\", \"Floats\", \"Strings\"])\n",
"df5"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For example we can style the above DataFrame using the normal functions but modifying our ``props`` argument to the LaTeX format. In this example the coloring commands have options but the text modifying commands do not need any. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s5 = df5.style.highlight_max(props='cellcolor:[HTML]{FFFF00}; color:{red}; itshape:; bfseries:;')\n",
"print(s5.to_latex())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![LaTeX Styler example 1](../_static/style/latex_1.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When specifying the ``options`` there are 5 hidden flags that can be amended to structure the braces used in LaTeX output:\n",
"\n",
" - ``--nowrap`` which is the default produces: ``\\<command><options> <display_value>``\n",
" - ``--wrap`` encloses the whole block in braces: ``{\\<command><options> <display_value>}``\n",
" - ``--lwrap`` encloses the left block in braces: ``{\\<command><options>} <display_value>``\n",
" - ``--rwrap`` encloses the right block in braces: ``\\<command><options>{<display_value>}``\n",
" - ``--dwrap`` encloses both blocks in braces: ``{\\<command><options>}{<display_value>}``\n",
" \n",
"For example the \\textbf and \\bfseries and the \\textit and \\itshape alternatives should be structured in different formats. We can replicate the above LaTeX render in these alternatives as follows:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s5 = df5.style.highlight_max(props='cellcolor:[HTML]{FFFF00}; color:{red}; textit:--rwrap; textbf:--rwrap;')\n",
"\n",
"print(s5.to_latex())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``to_latex`` method provides a number of options for the LaTeX output such as:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df5.columns = pd.MultiIndex.from_tuples([(\"Numeric\", \"Integers\"), (\"Numeric\", \"Floats\"), (\"Non-Numeric\", \"Strings\")])\n",
"df5.index = pd.MultiIndex.from_tuples([(\"L0\", \"ix1\"), (\"L0\", \"ix2\"), (\"L1\", \"ix3\")])\n",
"s5 = df5.style.highlight_max(props='cellcolor:[HTML]{FFFF00}; color:{red}; itshape:; bfseries:;')\n",
"\n",
"print(s5.to_latex(column_format=\"rrrrr\", position=\"h\", position_float=\"centering\", hrules=True, \n",
" label=\"table:5\", caption=\"Styled LaTeX Table\", multirow_align=\"t\", multicol_align=\"r\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![LaTeX Styler example 2](../_static/style/latex_2.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A difference to the ``DataFrame.to_latex()`` method is that LaTeX Styler version does not contain any options for formatting. Instead, the usual ``.format()`` method should be used to create the display values before rendering. There are three good reasons for making this change:\n",
"\n",
" - Firstly using ``.format()`` in a Jupyter Notebook allows you to visualise the results of the formatting application before rendering.\n",
" - Secondly the ``.format()`` is very flexible and by chaining the method multiple times gives an even broader array of formatting possibilities which it is not possible to replicate by including the arguments in the ``to_latex()`` method which will call ``.format()`` a single time.\n",
" - Thirdly the ``.format()`` method has multiple options and updating the ``to_latex()`` method whenever ``.format()`` is updated or improved creates a development dependency which is best avoided."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s5.clear()\n",
"s5.table_styles = []\n",
"s5.caption = None\n",
"s5.format({\n",
" (\"Numeric\", \"Integers\"): '\\${}',\n",
" (\"Numeric\", \"Floats\"): '{:.3f}',\n",
" (\"Non-Numeric\", \"Strings\"): str.upper\n",
"})\n",
"print(s5.to_latex())"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
75 changes: 47 additions & 28 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,33 +341,41 @@ def to_latex(
Buffer to write to. If ``None``, the output is returned as a string.
column_format : str, optional
The LaTeX column specification placed in location:
`\\begin{tabular}{<column_format>}`. Defaults to 'l' for index and
non-numeric data columns, otherwise 'r' (or 'S' if using {siunitx} package).

\\begin{tabular}{<column_format>}

Defaults to 'l' for index and
non-numeric data columns, otherwise 'r' (or 'S' if using the
{siunitx} package).
position : str, optional
The LaTeX positional argument (e.g. 'h!') for tables, placed in location:
`\\begin{table}[<position>]`.

\\begin{table}[<position>]
position_float : {"centering", "raggedleft", "raggedright"}, optional
The LaTeX float command (e.g. `\\centering`) placed immediately after
`\\begin{table}[<position>]`.
The LaTeX float command placed in location:

\\begin{table}[<position>]

\\<position_float>
hrules : bool, default False
Set to `True` to add `\\toprule`, `\\midrule` and `\\bottomrule` from the
Set to `True` to add \\toprule, \\midrule and \\bottomrule from the
{booktabs} LaTeX package.
label : str, optional
The LaTeX label placed in location: `\\label{<label>}`.
This is used with `\\ref{<label>}` in the main .tex file.
The LaTeX label included as: \\label{<label>}.
This is used with \\ref{<label>} in the main .tex file.
caption : str, optional
The LaTeX table caption placed in location: `\\caption{<caption>}`.
The LaTeX table caption included as: \\caption{<caption>}.
sparsify : bool, optional
Set to `False` to print every item of a hierarchical MultiIndex. Defaults
to the pandas 'multi_sparse' display option.
Set to ``False`` to print every item of a hierarchical MultiIndex. Defaults
to the pandas ``multi_sparse`` display option.
multirow_align : {"c", "t", "b"}
If sparsifying hierarchical MultiIndexes whether to align text centrally,
at the top or bottom.
multicol_align : {"r", "c", "l"}
If sparsifying hierarchical MultiIndex columns whether to align text at
the left, centrally, or at the right.
siunitx : bool, default False
Set to `True` to structure LaTeX compatible with the {siunitx} package.
Set to ``True`` to structure LaTeX compatible with the {siunitx} package.
encoding : str, default "utf-8"
Character encoding setting.
convert_css : bool, default False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need an option for this? why wouldn't we always do this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't want to convert if different settings for html and latex are wanted or if more control over the latex formatting is needed. But in that case, a new styler instance could easily be used, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right this is by-definition on .to_latex so i think its clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styler now allows styling to be coded in LaTeX or HTML-CSS format. In each separate case, which are completely flexible in each format, you don't want to convert.
But, if you have created an HTML-CSS Styler and it contains the limited attr-values that can now be converted to LaTeX then you should use the convert option. Shouldn't be set to default though.

Expand Down Expand Up @@ -395,12 +403,20 @@ def to_latex(

If using the ``siunitx`` argument then the necessary {siunitx} package should
be included, and numeric columns will be set to format "S" instead of "r".
Additionally, if combining with \\itshape and \\bfseries we recommend the
{etoolbox} package in combination with the preamble commands:

- \\robustify\\itshape
- \\robustify\\bfseries

Also within the document, but before the {table} environment adding:

- \\sisetup{detect-all = true}

**Cell Styles**

LaTeX styling can only be rendered if the accompanying styling functions have
been constructed with appropriate LaTeX commands. Styler was designed and
is typically used to generate HTML with a CSS Styling language. All styling
been constructed with appropriate LaTeX commands. All styling
functionality is built around the concept of a CSS ``(<attribute>, <value>)``
pair, and this should be replaced by a LaTeX ``(<command>, <options>)``
approach and each cell will be styled individually
Expand All @@ -422,48 +438,51 @@ def to_latex(
Internally these structured LaTeX ``(<command>, <options>)`` pairs
are translated to the
``display_value`` with the default structure:
``\\<command><options> <display_value>``.
``\<command><options> <display_value>``.
Where there are multiple commands the latter is nested recursively, so that
the above example highlighed cell is rendered as:
`\\color{red} \\itshape 4`.

\\color{red} \\itshape 4

Occasionally this format does not suit the applied command, or
combination of LaTeX packages that is in use, so additional flags can be
added to the ``<options>`` to result in different positions of required
braces (the default being the same as `--npwrap`):
braces (the default being the same as `--nowrap`):

- (<command>,<options>--nowrap): \\<command><options> <display_value>
- (<command>,<options>--rwrap): \\<command><options>{<display_value>}
- (<command>,<options>--wrap): {\\<command><options> <display_value>}
- (<command>,<options>--lwrap): {\\<command><options>} <display_value>
- (<command>,<options>--dwrap): {\\<command><options>}{<display_value>}

For example the `Large` or `Huge` commands for font-sizing
should always be used with `--wrap` so `'Huge: --wrap;'` will render a
working cell, wrapped with braces, as `'{\\Huge <display_value>}'`.
For example the `textbf` command for font-weight
should always be used with `--rwrap` so ``('textbf', '--rwrap')`` will render a
working cell, wrapped with braces, as '\\textbf{<display_value>}'.

**Table Styles**

Internally Styler uses its ``table_styles`` to parse some of the options here.
All options except for ``caption`` are added in the following way:
Internally Styler uses the ``table_styles`` object to parse some of the
input arguments.
All commands arguments except for ``caption`` are added in the following way:

>>> s.set_table_styles([{'selector': 'command', 'props': ':options;'}],
>>> s.set_table_styles([{'selector': '<command>', 'props': ':<options>;'}],
... overwrite=False)

For example, if setting a ``column_format``, this is internally recorded as:

>>> s.set_table_styles([{'selector': 'column_format', 'props': ':rcll;'}],
... overwrite=False])

Since ``labels`` often include ':' but this is used as a CSS separator, there
is a character replacement, substituting ':' for '§', so a label of 'fig:item1'
is recorded as:
Note that since ``labels`` often include ':' but this is used as a
CSS separator, there is a character replacement,
substituting ':' for '§', so a label of 'fig:item1' is recorded as:

>>> s.set_table_styles([{'selector': 'label', 'props': ':{fig§item1};'}],
... overwrite=False])

Any custom commands you add here are added above the '`\\begin{tabular}`' entry,
such as odd and even row coloring can be included with:
Any custom commands you add here are included and positioned immediately
above the '\\begin{tabular}' command. For example to add odd and
even row coloring, from the {colortbl} package, use:

>>> s.set_table_styles([{'selector': 'rowcolors', 'props': ':{1}{pink}{red};'}],
... overwrite=False])
Expand Down