# PrettyTables.jl: @ptconf tf argument not able to find custom tf

**URL:** <https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824>\
**Category:** New to Julia\
**Tags:** tables, prettytables\
**Created:** [January 4, 2021, 1:42pm UTC](https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824 "2021-01-04T13:42:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alasaadstat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alasaadstat/32/975_2.png) [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Post date:** [January 4, 2021, 1:42pm UTC](https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824/1 "2021-01-04T13:42:33Z")

</div>

Hi, I’m currently using PrettyTables, and I’m not sure what’s going on with my codes below. I defined a custom tf as follows:

```julia
using JuliaDB
using PrettyTables

tf_compact2 = TextFormat(up_right_corner = '─',
                   up_left_corner = '─',
                   bottom_left_corner = '─',
                   bottom_right_corner = '─',
                   up_intersection = '─',
                   left_intersection = '─',
                   right_intersection = '─',
                   middle_intersection = '─',
                   bottom_intersection = '─',
                   column = ' ',
                   row = '─',
                   hlines = [:begin,:header,:end],
                   vlines = :all);

```

pretty\_table works fine:

```julia
a = table((x=collect(1:10), y=collect(11:20)));
pretty_table(a, tf=tf_compact2)
─────────────────
      x y 
  Int64 Int64 
─────────────────
      1 11
      2 12
      3 13
      4 14
      5 15
      6 16
      7 17
      8 18
      9 19
     10 20
─────────────────

```

But I wanted to declare this custom tf globally, so this is can be done using @ptconf:

```julia
@ptconf tf=tf_compact2
@pt a

```

which gives me the following error,

```julia
UndefVarError: tf_compact2 not defined

Stacktrace:
 [1] top-level scope at In[150]:1
 [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

```

Built-in tf\_compact works though,

```julia
@ptconf tf=tf_compact
@pt a
------- -------
      x y 
  Int64 Int64 
 ------- -------
      1 11
      2 12
      3 13
      4 14
      5 15
      6 16
      7 17
      8 18
      9 19
     10 20
 ------- -------

```

However, redefining this to new variable, won’t work

```julia
tf2 = tf_compact
@ptconf tf=tf2
@pt a
UndefVarError: tf2 not defined

Stacktrace:
 [1] top-level scope at In[153]:1
 [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

```

I’m beginner on macros.

---

<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:** [January 5, 2021, 1:42am UTC](https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824/2 "2021-01-05T01:42:42Z")

</div>

Hi @alasaadstat,

This is a bug in `@ptconf`. The macro is being expanded to:

```julia
julia> @macroexpand @ptconf tf = tf_compact2
:(PrettyTables.set_pt_conf!(PrettyTables._pt_conf, tf = PrettyTables.tf_compact2))

```

That’s why you can’t use custom formats. In fact, even custom highlighters will not work. I will try to fix it.

---

<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:** [January 6, 2021, 10:53am UTC](https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824/3 "2021-01-06T10:53:29Z")

</div>

It should be working in `master` now. Can you please test?

---

<div class="post-metadata">

**Author:** ![alasaadstat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alasaadstat/32/975_2.png) [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Post date:** [January 8, 2021, 2:27pm UTC](https://discourse.julialang.org/t/prettytables-jl-ptconf-tf-argument-not-able-to-find-custom-tf/52824/4 "2021-01-08T14:27:04Z")

</div>

All working now! Thanks!
