Current state and the future of PrettyTables.jl

For example, in a 4K screen using a terminal only on half of it, I can fit perfectly 10 columns with Col. X:

Using Column X, only 8 can be fit:

IMHO that’s a lot information to loose in text for a small gain.

3 Likes

UPDATE: I am in the middle of the text back end (oh boy… I really forgot how difficult those things can get :sweat_smile:). There is a lot of rough edges to fix and features to implement, but here is a little teaser:

36 Likes

Ooo the footnotes look really nice – I mean, the whole thing looks utterly fantastic. The combined row cells and columns cells look great!

5 Likes

Very cool :sunglasses:

1 Like

Not sure if is exactly the right place to ask, but i need guiding. Exclusively exporting to latex, I’m looking for a julia equivalent to R’s knitr::kable() and particularly kableExtra package, which you can find the docs and examples of capacities there : https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_pdf.pdf

Would you say that this package covers most of kable’s features (in which case i’ll dive into the documentation and learn the interface RN), or this is not the right bet for me yet ? What about LatexTabulars.jl if you heard about it ? Maybe another interface ?

I particlarly need to make multicolumns, headers, conditional bolding of cells, etc…

Hi @Ronis_BR : PT is an ultra useful package !

Note sure it is the right place for this but I would have prefer that the default values for crops to be :none
Rationale : I launch a time consuming computation and the REPL windows happen to be to small → I can’t see the result because I forgot to set the crop options to :none

2 Likes

Thank you very much!

The problem with this being default is that any table larger than the display will be printed very messy. Furthermore, if the table is very large and you do not enable the option to crop, it will freeze during the processing.

1 Like

True but I can resize the windows and recover the clean output.

Maybe a separate concern that could be handled with a (relatively high) upper limit to the table size (before a crop is applied by default).

I must confess that I am not a very good documentation reader and It takes me some time to discover the crop :none option :wink:

Anyway, it is just my personal feeling that may well be not relevant for most PT users. The current crop default is definitively not a major issue !

1 Like

Hey everyone!

I think I need some understanding from the community because I need to drop a feature we have now in PrettyTables :frowning:

In text backend, we are able to break lines inside the cell. This feature leads to a major algorithm problem in the terminal because each row needs multiple lines, and the number of lines can only be known after processing all the printed rows.

Now, we have a single state machine that tells the back end what to print. Text is the only back end that requires this kind of different processing.

Doing this is not difficult if we are cropping the table at the end. However, for middle vertical cropping, it is very difficult. First, I need to check where the continuation line will be. After, I need to process the rows backward to see how many rows I can fit into the available lines.

Things get worse when we consider that we can have horizontal lines that take space, and now the row label groups. The latter is not part of the table but take space in the terminal.

Conclusion: I really want to drop support for line breaks in the text back end if the vertical crop mode is :middle. Is there any one here that needs this feature? This approach will greatly simplify the algorithm and the code base. The only way I could possible imagine is a dirty hack or a separate iterator just for the text back end, leading to the scenario we have now.

1 Like

Oh sorry! I missed your post.

Currently, PrettyTables.jl can print to latex with headers and with conditional decorations at the cells. The multicolumns will be supported (at header only) in the release I am coding right now.

1 Like

Nevermind, thanks for the good work. When would you say the multicolumn headers would be possible ? I’ll try learning the interface and come back with remarks and/or questions then

1 Like

I will finish the text back end and then code the latex back end. I have no idea what will be the ETA because the text back end is always very tricky. At the end, you will be able to do things like this one in LaTeX also:

Notice the merged cells (Group #1 and Group #2), the footnotes, the conditional styling based on the cell value, the row groups (First set, Second set, …), the summary rows at the end (sum and mean), and the source notes.

6 Likes

fwiw Drop that feature; its better to increase maintainability.

12 Likes

I agree with @JeffreySarnoff, the only time I ever use text-backends is to prototype the layout of my table for the LaTeX backend generally. It won’t break my heart to lose that feature (although I appreciate you maintaining it for as long as you did!).

1 Like

@Ronis_BR Okay, the interface and the documentation is actually pretty sweet and well-thought ! In a small afternoon, I almost managed to do everything I wanted.

Just an issue, I could not find a response in the docs: how could i change the first and last line of the latex from

\begin{tabular}{rrrrrr}
...
\end{tabular}

to something like :

\begin{tabularx}{\linewidth}{cllllXXXX}
...
\end{tabularx}

or obtain a \linewidth width in some other means ?

Nice!

I am afraid that is not possible currently :frowning:

I will add this feature in v3 that I am working on currently.

However, I might need to apologize because the v3 will be entirely breaking :sweat_smile: Probably 90% of the options will change (but for very good reasons!).

FWIW I’ve never used tabularx and don’t have any idea what \linewidth inside a table means.

It simply means that the table should expand to full width. There are other possibilities to make it with other packages, but not with the standard \begin{tabular} (afaik)

Yeah that makes intuitive sense, I’m just saying that PrettyTables doesn’t need to support every feature of latex tables across all packages. I think I make excellent latex tables, and don’t use \linewidth (I actually use adjustbox in the latex document directly to control this).

1 Like

Can you show me how?