# Overloading show(io, expr::Expr)

**URL:** https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082
**Category:** General Usage
**Tags:** question
**Created:** [December 21, 2016, 2:39am UTC](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082 "2016-12-21T02:39:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nsmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsmith/32/979_2.png) [@nsmith](https://discourse.julialang.org/u/nsmith)
#### Post date: [December 21, 2016, 2:39am UTC](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082/1 "2016-12-21T02:39:53Z")

</div>

Bit of a strange question here but would anyone know which show method controls how `:(2*x)` for example gets displayed as `:(2x)` in the repl. eg:

```julia
julia> :(2 * x)
:(2x)

```

There is a handful of `show` methods in [show.jl](https://github.com/JuliaLang/julia/blob/master/base/show.jl) that look suspect but I can’t seem to figure out who is responsible for this. I want to overload this to display as `:(2 * x)` instead to interface with Maxima in a package I’m developing.

Any help would be greatly appreciated!

Best,  
Nathan

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [December 21, 2016, 2:41am UTC](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082/2 "2016-12-21T02:41:53Z")

</div>

Just ask Julia, i.e. use introspection:

```julia
julia> ex = :(2x)
:(2x)

julia> show(STDOUT, ex)
:(2x)
julia> @which show(STDOUT, ex)
show(io::IO, ex::Union{Expr,GlobalRef,GotoNode,LabelNode,LineNumberNode,QuoteNode,Slot}) at show.jl:411

```

You will most likely then have to follow down the rabbit hole. You could try using Gallium (the debugger) for this, maybe inside Juno.

---

<div class="post-metadata">

### Author: ![nsmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsmith/32/979_2.png) [@nsmith](https://discourse.julialang.org/u/nsmith)
#### Post date: [December 21, 2016, 3:15am UTC](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082/3 "2016-12-21T03:15:45Z")

</div>

Thanks, found it in `show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int)` finally.
