Skip to content

DOC: add a matrix style #502

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 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
104 changes: 104 additions & 0 deletions docs/_static/matrix.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* Based on the stylesheet used by matrepr (https://github.com/alugowski/matrepr) and modified for sphinx */

table.matrix {
border-collapse: collapse;
border: 0px;
}

/* Disable a horizintal line from the default stylesheet */
.table.matrix > :not(caption) > * > * {
border-bottom-width: 0px;
}

/* row indices */
table.matrix > tbody tr th {
font-size: smaller;
font-weight: bolder;
vertical-align: middle;
text-align: right;
}
/* row indices are often made bold in the source data; here make them match the boldness of the th column label style*/
table.matrix strong {
font-weight: bold;
}

/* column indices */
table.matrix > thead tr th {
font-size: smaller;
font-weight: bolder;
vertical-align: middle;
text-align: center;
}

/* cells */
table.matrix > tbody tr td {
vertical-align: middle;
text-align: center;
position: relative;
}

/* left border */
table.matrix > tbody tr td:first-of-type {
border-left: solid 2px var(--pst-color-text-base);
}
/* right border */
table.matrix > tbody tr td:last-of-type {
border-right: solid 2px var(--pst-color-text-base);
}

/* prevents empty cells from collapsing, especially empty rows */
table.matrix > tbody tr td:empty::before {
/* basicaly fills empty cells with   */
content: "\00a0\00a0\00a0";
visibility: hidden;
}
table.matrix > tbody tr td:empty::after {
content: "\00a0\00a0\00a0";
visibility: hidden;
}

/* matrix bracket ticks */
table.matrix > tbody > tr:first-child > td:first-of-type::before {
content: "";
width: 4px;
position: absolute;
top: 0;
bottom: 0;
visibility: visible;
left: 0;
right: auto;
border-top: solid 2px var(--pst-color-text-base);
}
table.matrix > tbody > tr:last-child > td:first-of-type::before {
content: "";
width: 4px;
position: absolute;
top: 0;
bottom: 0;
visibility: visible;
left: 0;
right: auto;
border-bottom: solid 2px var(--pst-color-text-base);
}
table.matrix > tbody > tr:first-child > td:last-of-type::after {
content: "";
width: 4px;
position: absolute;
top: 0;
bottom: 0;
visibility: visible;
left: auto;
right: 0;
border-top: solid 2px var(--pst-color-text-base);
}
table.matrix > tbody > tr:last-child > td:last-of-type::after {
content: "";
width: 4px;
position: absolute;
top: 0;
bottom: 0;
visibility: visible;
left: auto;
right: 0;
border-bottom: solid 2px var(--pst-color-text-base);
}
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autodoc", "numpydoc", "sphinx_panels", "nbsphinx"]
html_css_files = ["custom.css"]
html_css_files = ["custom.css", "matrix.css"]
html_js_files = ["custom.js"]

# Add any paths that contain templates here, relative to this directory.
Expand Down
1 change: 1 addition & 0 deletions docs/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ array will match the collection dtype.
v = gb.Vector.from_coo([1, 3, 6], [2, 3, 4], float, size=10)

.. csv-table::
:class: matrix
:header: 0,1,2,3,4,5,6,7,8,9,10

,2.0,,3.0,,,4.0,,,
Expand Down
Loading