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

DOC: add a matrix style #502

merged 1 commit into from
Sep 7, 2023

Conversation

alugowski
Copy link
Contributor

Add a matrix style to the stylesheet that formats a table to look like a matrix.

Heavily based on the style used by matrepr, but with some tweaks to make it work within the Sphinx/Bootstrap styles.

Usage

Add a

    :class: matrix

directive to any table. This is stackable with other classes, for example :class: inline matrix includes both inline and matrix styles.

If the matrix has row indices, then also add :stub-columns: 1 to mark the leftmost column as a header. This way the leftmost column is styled as indices, but more importantly the matrix border will be in the correct place (i.e. the indices are outside the matrix).

Example:

.. csv-table:: A
    :class: inline matrix
    :header: ,0,1,2,3
    :stub-columns: 1

Effect

Screenshot 2023-09-06 at 22-45-10 Operations — python-graphblas 2023 7 0 0 gf14cbace dirty documentation

Becomes

Screenshot 2023-09-06 at 22-44-18 Operations — python-graphblas 2023 7 0 documentation

Closes #496

@Transurgeon
Copy link
Contributor

Wow, it does look much nicer!
Also it would be nice to have a smaller dependency for the repr instead of pandas

@eriknw
Copy link
Member

eriknw commented Sep 7, 2023

Love it! This looks so good. Thanks @alugowski! ❤️

Also it would be nice to have a smaller dependency for the repr instead of pandas

Yup, I want to swtich to MatRepr as suggested in #494

@eriknw eriknw merged commit ad6c2da into python-graphblas:main Sep 7, 2023
@alugowski alugowski deleted the matrix branch September 7, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[doc] A matrix CSS style for matrices in docs
3 participants