Autocontrol of table width - r

I am using dynamically generated table with knitr. Sometimes the tables are small and fit within the text width while other times it is large and one can use the following solution: Automatically adjust LaTeX table width to fit pdf using knitr and Rstudio
Just wondering if there is a way to use \textwidth only when when the table width is larger than the \textwidth? In automatic reporting sometime tables are large and sometime tiny. Using full text width generated awkward huge font table.

Related

Start wrapping text in HTML table only after reaching max-width of TD

In HTML tables that are wider than the viewport, text is wrapped, so the table may fit after all. To force all fields on a single line (and possibly extend outside the viewing area) I use 'white-space: nowrap' for all TDs in the table.
This is just fine for most of my tables, but in one scenario this does not work very well. I have a table with 20 columns or so with terse column headings and content, except one, which is a description field of 256 characters maximum. Using 'nowrap' is quite right for all columns, but the description column is now a very wide column indeed.
Is there a (CSS) way to specify that fields should be as small as possible (no min-width), keep on one line (nowrap), except when longer than some maximum field width (max-with: 250px). It would be nice if it could be applied to all TDs, where a reduction of the maximum width would start other fields wrapping as well.

Reduce Font Size of datatable in a Flexdashboard

I'm working on a shiny flexdashboard, and one of the elements is a datatable with a lot of columns. Currently the columns are so many that they exceed the width of the app.
Instead of adding a scroll bar I would prefer to simply reduce the font used in datatable so that each column will be smaller.
Is this possible?
Found the answer.
Needed to wrap renderDataTable in a div.
div(renderDataTable(table()),style = "font-size:80%)

Dynamic table-width doesn't adjust properly

I'm trying to build a genealogy tree with HTML tables (and nested tables). It should, ultimately be editable by the user using contenteditable, and the nested cells should resize accordingly.
However, to my mystery, when I edit the cells, they resize far too fast and too much. Why so?
The outer table keeps everything under control, so sizes are fixed using
table-layout:fixed;
The nested table cells, on the other hand are only specified via
margin:auto;
Every cell's width is set individually via percentage, and it looks perfect before editing. Not so after.
DEMO here http://jsfiddle.net/KtB6C/
Try editing the Father or Mother cell.
I know this is a "fix-my-code" problem, but any help is appreciated.

mPDF: long text in table td shrinks to small size

I am posting an entire html to mpdfp. It works fine. But when the content in table is more or there is an email address or website name in the column (td) the font size of the text shrinks to unreadable font. What must be the issue? Please help on this. Check the attached image for the issue.
Thanks
As noted in this question: mPDF: Text becomes small when string in table is too long
mPDF automatically reduces font size in tables. There is a maximum shrink factor set in $this->shrink_tables_to_fit variable in config.php. It can be turned off / set differently with
$mpdf->shrink_tables_to_fit=0;
in config.php or with providing an extra parameter to the opening table tag:
<table autosize="1">
Default value for the variable is 1.4.
Also see Tables section of mPDF manual https://mpdf.github.io/tables/tables.html#autosize, especially the infobox Note: mPDF will always resize tables if it is the only way to fit a row or whole table onto a full page.

bootstrap grid not adjusting before text flows outside of container

I am not that advanced on CSS so I wanted to ask someone before reporting this as a problem.
I am using the latest (v2.0.3) bootstrap Hero example to show this issue. When I create a single_long_word of text greater than about 1/2 the column size (due to a large font or simply a large number of characters in a single word), the text is allowed to go outside of its column before the layout adjusts when I re-size the browser window to make it smaller.
All I had to do was change the text in the column to make a large or long word and then reduce the window size of the browser. It does eventually re-layout the columns to allow for more width, but not before the long word exceeds the boundary of the column it is in.
This happens for both normal and fluid containers in with a responsive grid.
It is easy to duplicate in Chrome by just going to this page and editing the text after inspecting a column element.
http://twitter.github.com/bootstrap/examples/hero.html
I could not post an image since I am too new to stackoverflow

Resources