# \#show

**URL:** https://discourse.julialang.org/tag/show/513.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Make custom type behave like Float64](https://discourse.julialang.org/t/make-custom-type-behave-like-float64/132926)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 4\
**Last updated:** [October 7, 2025, 2:12pm UTC](https://discourse.julialang.org/t/make-custom-type-behave-like-float64/132926 "2025-10-07T14:12:31Z")

</div>

(Related to Packages for colored REPL output?.) If I make a function return a custom type so that I can create a formatted show method for it, what functions do I then need to extend to make my type behave like Float64 …

---

## [Defining \`show\` method for all \`MIME\` types at once threw an error for \`display\`](https://discourse.julialang.org/t/defining-show-method-for-all-mime-types-at-once-threw-an-error-for-display/129790)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 2\
**Last updated:** [June 10, 2025, 9:33pm UTC](https://discourse.julialang.org/t/defining-show-method-for-all-mime-types-at-once-threw-an-error-for-display/129790 "2025-06-10T21:33:44Z")

</div>

MWE (tested on Julia 1.11.5): julia\> struct MyT{T} a::T end julia\> import Base: show julia\> Base.show(io::IO, ::MIME, obj::MyT) = print(io, typeof(obj), "(...)") julia\> MyT(1) Error showing value of…

---

## [About the show method for LinearAlgebra.jl objects](https://discourse.julialang.org/t/about-the-show-method-for-linearalgebra-jl-objects/128589)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 4\
**Last updated:** [May 1, 2025, 9:32am UTC](https://discourse.julialang.org/t/about-the-show-method-for-linearalgebra-jl-objects/128589 "2025-05-01T09:32:04Z")

</div>

I find it convenient to type this command @show A; in Julia REPL, to get an executable code, e.g., julia\> using LinearAlgebra julia\> A = rand(-9:9, 3, 3); julia\> @show A; A = \[0 -8 -2; -7 -2 3; 1 9 8\] Note that the l…

---

## [Different Base.show for Pluto and REPL](https://discourse.julialang.org/t/different-base-show-for-pluto-and-repl/93083)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 2\
**Last updated:** [April 9, 2025, 2:49pm UTC](https://discourse.julialang.org/t/different-base-show-for-pluto-and-repl/93083 "2025-04-09T14:49:17Z")

</div>

I want to have different Base.show representations for a struct when I am on REPL and when I am on Pluto by invoking the same code. Is there a more specialized ::MIME I can use for this purpose, other than ::MIME"text/pl…

---

## [Call original method when redefining a method. (Compact float printing in IJulia)](https://discourse.julialang.org/t/call-original-method-when-redefining-a-method-compact-float-printing-in-ijulia/74111)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 6\
**Last updated:** [April 6, 2025, 5:24am UTC](https://discourse.julialang.org/t/call-original-method-when-redefining-a-method-compact-float-printing-in-ijulia/74111 "2025-04-06T05:24:25Z")

</div>

I want to print floats (and derived types such as Unitful.Quantity{Float64, …}) compactly in IJulia / the REPL. E.g. 0.1\*3 should be echoed as 0.3 and not 0.30000000000000004. Likewise, 0.1\*3mV should be 0.3 mV and not…

---

## [Show and showcompact on custom types](https://discourse.julialang.org/t/show-and-showcompact-on-custom-types/8493)

<div class="topic-metadata">

**Author:** [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Replies:** 18\
**Last updated:** [December 5, 2024, 8:45pm UTC](https://discourse.julialang.org/t/show-and-showcompact-on-custom-types/8493 "2024-12-05T20:45:28Z")

</div>

I am trying to define a custom type with convenient methods for readout, and having some very basic trouble. I have read the documentation for show with no luck in sorting this out. Defining a method for Base.show(::IO, …

---

## [Display of dictionary contents to file](https://discourse.julialang.org/t/display-of-dictionary-contents-to-file/122785)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 3\
**Last updated:** [November 19, 2024, 6:24pm UTC](https://discourse.julialang.org/t/display-of-dictionary-contents-to-file/122785 "2024-11-19T18:24:36Z")

</div>

Hi, I have a general question regarding dictionaries display. I have a dictionary that has several fields, some of which are instances of types I’ve created that conatin really large arrays of numbers. When I print its …

---

## [Is there a built in macro like @show that returns a string?](https://discourse.julialang.org/t/is-there-a-built-in-macro-like-show-that-returns-a-string/88234)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 9\
**Last updated:** [October 13, 2024, 11:41pm UTC](https://discourse.julialang.org/t/is-there-a-built-in-macro-like-show-that-returns-a-string/88234 "2024-10-13T23:41:40Z")

</div>

I want the macro @show but to return a string instead of printing. Does something like that already exist?

---

## [Custom show for a struct that contains matrix](https://discourse.julialang.org/t/custom-show-for-a-struct-that-contains-matrix/119816)

<div class="topic-metadata">

**Author:** [@azoviktor](https://discourse.julialang.org/u/azoviktor)\
**Replies:** 10\
**Last updated:** [September 25, 2024, 9:51am UTC](https://discourse.julialang.org/t/custom-show-for-a-struct-that-contains-matrix/119816 "2024-09-25T09:51:23Z")

</div>

Suppose I have a struct struct Box size::Int matrix::Matrix{ComplexF64} end and my aim is to implement a custom show method for a Box that will display its matrix in a nice rectangle form (not printing all the el…

---

## [Why does \`show\` for arrays and dictionaries ignore \`:compact\`?](https://discourse.julialang.org/t/why-does-show-for-arrays-and-dictionaries-ignore-compact/118159)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 6\
**Last updated:** [August 14, 2024, 5:43am UTC](https://discourse.julialang.org/t/why-does-show-for-arrays-and-dictionaries-ignore-compact/118159 "2024-08-14T05:43:30Z")

</div>

The documentation for IOContext says :compact output should not contain line breaks However, this is ignored by arrays and dictionaries: julia\> show(IOContext(stdout, :compact =\> true), MIME"text/plain"(), \[1, 2\]) 2…

---

## [Is there a direct way to get the string of the output of \`show\`?](https://discourse.julialang.org/t/is-there-a-direct-way-to-get-the-string-of-the-output-of-show/116188)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 8\
**Last updated:** [June 25, 2024, 9:23am UTC](https://discourse.julialang.org/t/is-there-a-direct-way-to-get-the-string-of-the-output-of-show/116188 "2024-06-25T09:23:55Z")

</div>

I need to write the following script: # typeof # 値の型を得る function print\_typeof(x) print("表現「") show(x) println("」の値の型は「", typeof(x), "」である。") end print\_typeof(true) print\_typeof(1) print\_typeof(1.0) print\_t…

---

## [Array printing of custom objects](https://discourse.julialang.org/t/array-printing-of-custom-objects/111606)

<div class="topic-metadata">

**Author:** [@mdsalerno](https://discourse.julialang.org/u/mdsalerno)\
**Replies:** 1\
**Last updated:** [March 14, 2024, 10:02am UTC](https://discourse.julialang.org/t/array-printing-of-custom-objects/111606 "2024-03-14T10:02:08Z")

</div>

I defined the following object and show() methods: # Custom Set struct CustomSet{T} dict::Dict{T, Nothing} end CustomSet(xs) = CustomSet(Dict(zip(xs, fill(nothing, length(xs))))) # default show used by print func…

---

## [Redefining print method changes variable scoping in loop](https://discourse.julialang.org/t/redefining-print-method-changes-variable-scoping-in-loop/108010)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 9\
**Last updated:** [January 5, 2024, 2:20pm UTC](https://discourse.julialang.org/t/redefining-print-method-changes-variable-scoping-in-loop/108010 "2024-01-05T14:20:18Z")

</div>

Why does the first loop work but the second does not? The MWE: Summaryusing Printf for n in 1:10 if n == 1 flag = true idx\_last = 1 else flag = false idx\_last = ifelse(flag, n, idx\_last) end # P…

---

## [Having human-readable and parseable display styles](https://discourse.julialang.org/t/having-human-readable-and-parseable-display-styles/92946)

<div class="topic-metadata">

**Author:** [@Jollywatt](https://discourse.julialang.org/u/Jollywatt)\
**Replies:** 5\
**Last updated:** [January 15, 2023, 5:03pm UTC](https://discourse.julialang.org/t/having-human-readable-and-parseable-display-styles/92946 "2023-01-15T17:03:43Z")

</div>

What’s the best way to have both human-readable and parseable display styles for your own type, when there are both multiline and inline versions of the human-readable style? For example, suppose I have a vector-like ty…

---

## [Weird Base.show behavior with custom Struct](https://discourse.julialang.org/t/weird-base-show-behavior-with-custom-struct/91321)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 3\
**Last updated:** [December 7, 2022, 12:16am UTC](https://discourse.julialang.org/t/weird-base-show-behavior-with-custom-struct/91321 "2022-12-07T00:16:58Z")

</div>

For some reason checking my custom Struct in the REPL differs from the Base.show() method I defined. Can anyone replicate and/or explain why this might be happening? Here is a MWE to (hopefully) replicate the behavior: …

---

## [Doctest, terminal size, and show's limit interact poorly](https://discourse.julialang.org/t/doctest-terminal-size-and-shows-limit-interact-poorly/85372)

<div class="topic-metadata">

**Author:** [@dsweber2](https://discourse.julialang.org/u/dsweber2)\
**Replies:** 2\
**Last updated:** [August 6, 2022, 9:13am UTC](https://discourse.julialang.org/t/doctest-terminal-size-and-shows-limit-interact-poorly/85372 "2022-08-06T09:13:50Z")

</div>

For jldoctests, is there a way to deal with the variation in size caused by show’s limit property? This is causing local doctests to execute fine, but when I push to github, they break. Simple working example: if I gene…

---

## [Combining @show with display](https://discourse.julialang.org/t/combining-show-with-display/84522)

<div class="topic-metadata">

**Author:** [@b-fg](https://discourse.julialang.org/u/b-fg)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 1:07pm UTC](https://discourse.julialang.org/t/combining-show-with-display/84522 "2022-07-20T13:07:27Z")

</div>

Hi, I have been looking for a way to output values with their variable name. @show does exactly this, except the output is not as pretty as when using display. Is there a way I can combine both of them and have somethin…

---

## [Write function "show" for own multi-level structure](https://discourse.julialang.org/t/write-function-show-for-own-multi-level-structure/81882)

<div class="topic-metadata">

**Author:** [@Yuri](https://discourse.julialang.org/u/Yuri)\
**Replies:** 2\
**Last updated:** [May 29, 2022, 7:35pm UTC](https://discourse.julialang.org/t/write-function-show-for-own-multi-level-structure/81882 "2022-05-29T19:35:47Z")

</div>

I want to write a function Base.show for my structure Node: mutable struct Node keys::Vector vals::Vector count::Int end and which will display: nod = Node( \["a", "b", "c", "d"\], \[Node( \["…

---

## [Overriding Base.show with multi-line string returns literal "\\n"](https://discourse.julialang.org/t/overriding-base-show-with-multi-line-string-returns-literal-n/80500)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 1\
**Last updated:** [May 4, 2022, 7:20pm UTC](https://discourse.julialang.org/t/overriding-base-show-with-multi-line-string-returns-literal-n/80500 "2022-05-04T19:20:58Z")

</div>

Hi, I have a composite struct ABC with various fields A,B,C, which I want to display in a clear way on the screen (and later in Jupyter, but starting with REPL/console). Here’s my code: struct ABC A::Vector{Int64}…

---

## [Modify string interpolation](https://discourse.julialang.org/t/modify-string-interpolation/72904)

<div class="topic-metadata">

**Author:** [@Asmund\_Hjulstad](https://discourse.julialang.org/u/Asmund_Hjulstad)\
**Replies:** 4\
**Last updated:** [December 12, 2021, 2:01pm UTC](https://discourse.julialang.org/t/modify-string-interpolation/72904 "2021-12-12T14:01:09Z")

</div>

Is it possible to modify string interpolation using type-specific rules restricted to a specific context? """SELECT \* WHERE { ?s \<$(ns.aa.\_\_str\_\_())\> ?o) } """ outputs "SELECT \* WHERE {\\n?s \<http://example.org/aa\> ?o)…

---

## [How to add keyword arguments to extended functions (Base.print)?](https://discourse.julialang.org/t/how-to-add-keyword-arguments-to-extended-functions-base-print/71250)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 5\
**Last updated:** [November 11, 2021, 7:29am UTC](https://discourse.julialang.org/t/how-to-add-keyword-arguments-to-extended-functions-base-print/71250 "2021-11-11T07:29:30Z")

</div>

I want to custom the print of my own object, but with an optional keyword argument. However when I then call my customised print using the keyword argument Julia tells me it couldn’t find it. I already know that keyword …

---

## [Can I disable overloaded Base.show() and print the raw form of an object?](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 4\
**Last updated:** [September 17, 2021, 12:37am UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286 "2021-09-17T00:37:37Z")

</div>

Sometimes I’d like to see the “raw” form of a custom struct. Can I print it using the default Base.show(), ignoring my own custom definitions which print prettier results but may hide details useful for debugging?

---

## [Customize show for repl](https://discourse.julialang.org/t/customize-show-for-repl/62870)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [June 14, 2021, 10:19am UTC](https://discourse.julialang.org/t/customize-show-for-repl/62870 "2021-06-14T10:19:34Z")

</div>

I want to customize how Ints are printed in my repl. I looked at Types · The Julia Language and The Julia REPL · The Julia Language I tried show(io::IO, ::MIME"text/plain", x::Int) = print(io, "Int--$(x)--") but that…

---

## [Why is big(0.5) printed as 0.50?](https://discourse.julialang.org/t/why-is-big-0-5-printed-as-0-50/59395)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [April 17, 2021, 5:06pm UTC](https://discourse.julialang.org/t/why-is-big-0-5-printed-as-0-50/59395 "2021-04-17T17:06:04Z")

</div>

I’m not sure if this is the intended behavior: julia\> 0.5 0.5 julia\> big(0.5) 0.50 julia\> big(0.5) == 0.5 true Why the extra 0 at the end for a BigFloat?

---

## [\`show\` methods for arrays](https://discourse.julialang.org/t/show-methods-for-arrays/55623)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 7\
**Last updated:** [February 19, 2021, 8:47pm UTC](https://discourse.julialang.org/t/show-methods-for-arrays/55623 "2021-02-19T20:47:33Z")

</div>

I’m working on something I’m currently calling a TupleVector for representing an MCMC chain where each sample is a NamedTuple. Internally the structure is something like julia\> unwrap(tv) (a = \[1, 3, 4, 5\], b = \[\[0.3693…

---

## [Show an object in extended form vs short form](https://discourse.julialang.org/t/show-an-object-in-extended-form-vs-short-form/48792)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 5\
**Last updated:** [October 23, 2020, 7:49pm UTC](https://discourse.julialang.org/t/show-an-object-in-extended-form-vs-short-form/48792 "2020-10-23T19:49:30Z")

</div>

my problem is the following: I have a type with fields, and i want those fields to be displayed with additional detail when shown alone in the REPL: julia\> a = MyType(;params....) MyType properties, with: a: .... b: ..…
