# \[ANN\] PrettyTables.jl v0.6.0

**URL:** <https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045>\
**Category:** Community\
**Created:** [September 22, 2019, 4:30pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045 "2019-09-22T16:30:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [September 22, 2019, 4:30pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/1 "2019-09-22T16:30:10Z")

</div>

Hi!

I have just requested a new version of [PrettyTables.jl](https://github.com/ronisbr/PrettyTables.jl) to be tagged. The changes are:

- The format of the horizontal line in the table, which are drawn using the option `hlines`, can now be selected using the keyword `hlines_format`.
- The alignment of a single cell can now be changed regardless of the column alignment. This can be achieve by the keyword `cell_alignment`.
- The line between the header and the data can now be hide using the variable `header_line` of the structure `PrettyTableFormat`.
- New predefined highlighters: `hl_cell`, `hl_col`, `hl_row`, which can be used to apply highlights to single cells or to entire columns or rows, respectively.
- The formatter `ft_printf` is now only applied to cells that are of type `Number`. (Issue [#19][gh-issue-19])
- The formatter `ft_printf` can now receive one integer if the user wants to format only a single column.
- End of support of Julia 1.1. The supported versions are 1.0 and 1.2.

I needed the additional options and configuration possibilities to be able to print text reports for a project I am working on related to SatelliteToolbox.jl. Thus, we now can do the following:

```julia
julia> data = ["Torques" "" "" "";
               "Atmospheric drag" "."^10 10 "10⁻⁵ Nm";
               "Gravity gradient" "."^10 3 "10⁻⁵ Nm";
               "Solar radiation pressure" "."^10 0.1 "10⁻⁵ Nm";
               "Total" "."^10 13.1 "10⁻⁵ Nm";
               "" "" "" ""
               "Angular momentum" "" "" "";
               "Atmospheric drag" "."^10 6.5 "Nms";
               "Gravity gradient" "."^10 3.0 "Nms";
               "Solar radiation pressure" "."^10 1.0 "Nms";
               "Total" "."^10 10.5 "Nms"]

julia> pretty_table(data, borderless;
                    noheader = true,
                    cell_alignment = Dict( (1,1) => :l, (7,1) => :l ),
                    formatter = ft_printf("%10.1f", 2),
                    highlighters = (hl_cell( [(1,1);(7,1)], crayon"bold"),
                                    hl_col(2, crayon"dark_gray"),
                                    hl_row([5,11], crayon"bold yellow")),
                    hlines = [1,7],
                    hlines_format = Tuple('─' for _ = 1:4) )

```

to create this text report:

 ![ex_00013](https://global.discourse-cdn.com/julialang/original/3X/d/d/dd3412a24ba2755c3d1a9c3607d1a9eebb964a07.png)

---

<div class="post-metadata">

**Author:** ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)\
**Post date:** [September 23, 2019, 5:22am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/2 "2019-09-23T05:22:44Z")

</div>

For anyone confused by why this example doesn’t work yet (as I was), it’s not yet merged into the General Registry. Presumably that will change in a few hours (see [https://github.com/JuliaRegistries/General/pull/3748](https://github.com/JuliaRegistries/General/pull/3748)).

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [September 23, 2019, 7:11am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/3 "2019-09-23T07:11:29Z")

</div>

this does look nice, can it be made to work with `JuliaDB` and `DataFrames` things?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [September 23, 2019, 12:43pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/4 "2019-09-23T12:43:01Z")

</div>

Sorry! I completely forgot that the automatic mechanism to merge those updates is not working anymore. Thus, I thought it would take 30 min. to be accepted, but it took more than that. It should be working now 🙂

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [September 23, 2019, 12:43pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/5 "2019-09-23T12:43:42Z")

</div>

It should be working without problems with `DataFrames`. With `JuliaDB` I am not so sure, I will take a look.

---

<div class="post-metadata">

**Author:** ![PeteS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petes/32/8111_2.png) [@PeteS](https://discourse.julialang.org/u/PeteS)\
**Post date:** [November 4, 2019, 1:26pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/6 "2019-11-04T13:26:48Z")

</div>

Thanks for this package, much appreciated.

Another request - can you decouple column alignment and header alignment? It is quite common in technical reports to leave the headers and sub-headers centered, while the columns are aligned as required. You allow us to override the alignment of cells with _cell\_alignment_, but this doesn’t include the headers. Maybe add _header\_alignment_, leaving _alignment_ for the columns?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [November 4, 2019, 1:35pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/7 "2019-11-04T13:35:54Z")

</div>

> [@PeteS](#):
>
> Thanks for this package, much appreciated.
> 
> Another request - can you decouple column alignment and header alignment? It is quite common in technical reports to leave the headers and sub-headers centered, while the columns are aligned as required. You allow us to override the alignment of cells with _cell\_alignment_ , but this doesn’t include the headers. Maybe add _header\_alignment_ , leaving _alignment_ for the columns?

Thanks! Good to know it is helping somehow 🙂

Wow, nice catch! I did not realized that I missed this one 😃 I think the best way is what you proposed. Let’s have a `header_alignment` and, if it is nothing, then it will follow the column alignment. Sounds good?

---

<div class="post-metadata">

**Author:** ![PeteS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petes/32/8111_2.png) [@PeteS](https://discourse.julialang.org/u/PeteS)\
**Post date:** [November 4, 2019, 1:51pm UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-6-0/29045/8 "2019-11-04T13:51:07Z")

</div>

Yes, that makes sense, especially as you can hide the headers and sub-headers; _alignment_ should be the dominant attribute.
