align jupyter notebook tables to the left - latex

When I create a simple table in Jupyter Notebooks, the table appears in the center of the cell. What do I have to do to align that table to the left instead of center?
Sample Latex Table for Jupyter:
| This | is |
|------|------|
| a | table|
Thank you

When creating a table and assigning it the float: left attribute you end up having to add more CSS to resolve the text that surrounds the table. Place this in a code cell before your markdown cell
%%html
<style>
table {
display: inline-block
}
</style>
However, if you have a lot of CSS, might be best to put it in another file for the overall beauty of the document.

Here are the steps:
Create a Code cell just above your markdown cell where you want to show your table.
Write the following in your Code cell.
%%html
<style>
table {float:left}
</style>
Run your Code cell.
Write Table markdown code in your Markdown cell. Your table should now align to the left.

Align tables only for markdown output:
Jupyter & Jupyter Lab:
%%html
<style>
/* Jupyter */
.rendered_html table,
/* Jupyter Lab*/
div[data-mime-type="text-markdown"] table {
margin-left: 0
}
</style>
Put this code once on the top of notebook in Code cell

Related

How to style headers in vaadin-grid

I'm using a vaadin-grid with two header rows: one for the title of grouped columns and the other one for the real title of the column.
I want a vertical separator between the grouped columns.
For now, I use a classname generator on the first column of each group to add a left border :
grid.addComponentColumn(...)
.setHeader("My column")
.setClassNameGenerator(line -> "first-group-col")
with a dom-module included via JsImport:
import '#polymer/polymer/lib/elements/custom-style.js';
const documentContainer = document.createElement('template');
documentContainer.innerHTML = `
<dom-module id="my-grid-theme" theme-for="vaadin-grid">
<template>
<style>
.first-group-col {
border-left: 1px solid red;
}
</style>
</template>
</dom-module>`;
document.head.appendChild(documentContainer.content);
But the class '.first-group-col' doesn't appear on the header rows and I don't see how can I add a class on a header cell.
So how can I add a border on some column in the header rows ?
The number of columns in my grid is dynamic so I can't just use CSS to add the border on nth column.
I'm using Vaadin 14.
Regards,
Arnaud
I use a classname generator on the first column
Class name generator is applied for body cells, but not for the header cells.
You can style header by using something like follows, say you have Grid, with grid.addClassName("my-grid");
:host(.my-grid) [part="row"] [part~="header-cell"]{
padding-left: 3px;
color:brown;
background:var(--lumo-primary-color);
align-items:flex-start;
}
You can add the above css snipet to e.g. gridheader.css file in your frontend/styles folder and then import it
#CssImport(value = "./styles/gridheader.css", themeFor="vaadin-grid")

md-ink-ripple effect for specific row in a table

I have a table and i want to have ink and ripple effect for specific row in the table. when i add the attribute md-ink-ripple to tr element of table, it shows the ripple for entire table. please let me know how to fix this issue.
You can add display: block; position: relative; to the row styling - but that can result in odd behavior.

In Polymer Dart, how to build a CSS table using 1 polymer-element for the table and another for the rows and cells

My goal is to build a table using CSS (display:table, table-row, table-cell) with 1 custom polymer-element defining the div for the table, and another polymer-element defining the divs for the rows and cells, like this
<my-table>
<my-row col1="contents of column 1" col2="column 2">
--html for content of column 3--
</my-row>
</my-table>
The problem I'm having is that the div created by with the "display:table;" isn't being recognized by the divs created by with the "display:table-row" and "display:table-cell". The divs created by seem to think they are in their own individual tables.
Is there a way to get this to work? If the answer is to use ::content ::shadow, then I need to be shown how because I can't get it to work and behave as a single large table.
You should style the host of the polymer element, not the divs inside it.
Here is an example: https://gist.github.com/jakemac53/0d073615d723502a61ca

Multiple rows in header in kendo mvc grid

How I can display the second word of header in column?
Now kendo grid doesnt show symbols which dont place in header
I want
Second
First
But now
Second Fi
Just add this CSS to allow the column header text to wrap when column width too small to display all words:
th.k-header{
white-space: normal !important;
}
DEMO

UI-GRID - Dynamic Row Height - Alternatives

I tried to get a cell to expand it's height dynamically.
Is there a way to adjust the height of a row(GridRow) after it is rendered?
If not, then I will try to use an expandable grid or tree in a grid.
Is it possible to display an expandable grid off a specific cell/column?
Currently I see all expandable grids/tree grids that take up the entire row below the parent.
Thanks
Add this css to your styles:
.ui-grid-viewport .ui-grid-cell-contents {
word-wrap: break-word;
white-space: normal !important;
}
.ui-grid-row, .ui-grid-cell {
height: auto !important;
}
.ui-grid-row div[role=row] {
display: flex ;
align-content: stretch;
}
You can see an answer to the same question here: https://github.com/angular-ui/ng-grid/issues/3239#issuecomment-91045267
UI-Grid virtualizes the rows, meaning that it only renders a small subset of the data, and leaves everything that wouldn't be in view unrendered. This means the grid needs to know how tall every row is, so that it can calculate positioning.
If it had to measure every row when rendered this would cause the browser to repaint over and over and performance would be miserable.
You'll find that other virtualized tools (like Ionic's collection-repeat) have the same limitation.
Update:
To answer your second question: you can set a height property on the GridRow object (not your entity, you can use getRow from the grid API to get the GridRow object) and the grid will use this height when rendering the row.
And your third question: no, expandable is only built to work off entire rows. It might be possible to alter what sort of data is displayed in a sub-grid based on clicks in certain cells, but that would require some changes to the expandable code.

Resources