# Wrap title in PrettyTables v3?

**URL:** <https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121>\
**Category:** General Usage\
**Tags:** prettytables\
**Created:** [October 13, 2025, 9:19pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121 "2025-10-13T21:19:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [October 13, 2025, 9:19pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/1 "2025-10-13T21:19:10Z")

</div>

Is it possible to wrap a long title in version 3 of PrettyTables.jl? I was able to do this in version 2 with the text backend by inserting newlines in the title where I wanted the line break. This no longer works in version 3. Instead “\n” is printed inline with the text of the title. I’ve also tried creating a vector of Strings for the desired multiple title lines, but this results in a MethodError.

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [October 13, 2025, 10:30pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/2 "2025-10-13T22:30:34Z")

</div>

Have you tried using title and subtitle?

See (closed) issue here: [Newlines in title display differently in PrettyTables v2 vs v3 · Issue #268 · ronisbr/PrettyTables.jl · GitHub](https://github.com/ronisbr/PrettyTables.jl/issues/268)

Perhaps reopen?

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [October 13, 2025, 11:28pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/3 "2025-10-13T23:28:36Z")

</div>

Thanks. I can make it work by adding the second line as the subtitle. Right now it produces

```julia-auto
      CWG: m ∈ 1:3, a = 1 m, f = 200 MHz, σ = 58 MS m^-1,
           Rq = 1.0e-6 inch, ϵᵣ = 1.001, tanδ = 0.003
┌──────┬───┬───┬──────────────┬──────────────────┬─────────────┐
│ Type │ m │ n │ Cutoff Freq. │ Guide Wavelength │ Attenuation │
│ │ │ │ [MHz] │ [m] │ [dB/m] │
├──────┼───┼───┼──────────────┼──────────────────┼─────────────┤
│ TE │ 1 │ 1 │ 87.805342 │ 1.6675 │ 0.0609 │
│ TE │ 2 │ 1 │ 145.65538 │ 2.1862 │ 0.0799 │
│ TM │ 1 │ 1 │ 182.73257 │ 3.6857 │ 0.1346 │
│ TE │ 3 │ 1 │ 200.35307 │ 63.5878 │ 2.3265 │
│ TM │ 2 │ 1 │ 244.91584 │ 704.8769 │ 25.7471 │
│ TE │ 1 │ 2 │ 254.25444 │ 781.9918 │ 28.5928 │
│ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │
└──────┴───┴───┴──────────────┴──────────────────┴─────────────┘

```

where the title is displayed bold and the subtitle isn’t. I’ll have a look at the docs to see how to control the appearance of the subtitle to match that of the title.

Edit: I used the following to embolden the subtitle:

```julia-auto
using Crayons: @crayon_str
...
        p = pretty_table(
            modedata;
            style = TextTableStyle(; title = crayon"bold", subtitle = crayon"bold"),
            ...

```

It took me a while to understand that the many uses of the `crayon` string macro sprinkled throughout the `PrettyTables.jl` documentation required adding the `Crayons` package. I couldn’t find where that was mentioned.

---

<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:** [October 14, 2025, 12:33am UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/4 "2025-10-14T00:33:43Z")

</div>

> [@PeterSimon](#):
>
> It took me a while to understand that the many uses of the `crayon` string macro sprinkled throughout the `PrettyTables.jl` documentation required adding the `Crayons` package. I couldn’t find where that was mentioned.

Hi @PeterSimon !

This is a bug! PrettyTables.jl should re-export Crayons.jl. I will fix it.

Since this is the second time I was asked to allow for multiple lines in the title, I will check if it is ok to implement it.

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [October 14, 2025, 1:54am UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/5 "2025-10-14T01:54:58Z")

</div>

> [@Ronis\_BR](#):
>
> This is a bug! [PrettyTables.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/PrettyTables) should re-export [Crayons.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/Crayons). I will fix it.

Thanks! I suggest providing a link to the Crayons package documentation in the PrettyTables documentation, so that people can see what a Crayon is and how versatile they are.

> [@Ronis\_BR](#):
>
> Since this is the second time I was asked to allow for multiple lines in the title, I will check if it is ok to implement it.

That would be great! If possible, I suggest allowing the user to specify a vector of strings to represent multiple title lines, to be consistent with the way that multiple column headers can be specified.

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [October 14, 2025, 10:10am UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/6 "2025-10-14T10:10:54Z")

</div>

Couldn’t PrettyTables auto-wrap the title?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 14, 2025, 10:16am UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/7 "2025-10-14T10:16:56Z")

</div>

Regarding Crayons.jl versus StyledStrings.jl, what is the recommended method to add colors to strings? I thought PrettyTables.jl was moving to StyledStrings.jl as it is now part of the language features.

---

<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:** [October 14, 2025, 4:26pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/8 "2025-10-14T16:26:44Z")

</div>

You can use both! `Crayons` is a good way to color the cells using highlighters or with the default configuration options. If you use a StyledString, its color will be applied to the cell automatically.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 14, 2025, 5:18pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/9 "2025-10-14T17:18:59Z")

</div>

Oh so Crayons.jl can also be used to color visual elements (e.g., cell) besides the contents of the cell (i.e., text), and that is the main reason to keep it as an option, right?

---

<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:** [October 14, 2025, 6:13pm UTC](https://discourse.julialang.org/t/wrap-title-in-prettytables-v3/133121/10 "2025-10-14T18:13:16Z")

</div>

Actually Crayons is how we represent decorations in the text backends. Hence, all highlighters and table colors are represented using a Crayon. However, if a styled string is present inside a cell, the cell will be printed using its colors.
