---
title: "Discussion on \"User-defined Show Method in Julia\" | Hashnode"
description: "Discussion on \"User-defined Show Method in Julia\". How do you best configure the display of custom type contents?"
url: "https://hashnode.com/posts/user-defined-show-method-in-julia/64b6927d72b48291dcb16270"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [User-defined Show Method in Julia](https://scientificcoder.com/user-defined-show-method-in-julia?utm_source=hashnode&utm_medium=feed)

How do you best configure the display of custom type contents?

Jul 18, 2023 · 4 min read · scientificcoder.com  
Updated Sep 18, 2024  
Read the article

-   [#julia](https://hashnode.com/tag/julia)
-   [#coding](https://hashnode.com/tag/coding)
-   [#tips](https://hashnode.com/tag/tips)

## Written by

[Matthijs Cox](https://hashnode.com/@matthijscox)

@matthijscox · The Netherlands

  
[View profile](https://hashnode.com/@matthijscox)

Scientific Software Engineer

A scientific software developer with over a decade of experience in academia, startups and industry. My mission is to turn you into an elite numerical computing professional.

## Responses 1

Markdown supported · ⌘↵ to post

[Matthijs Cox](https://hashnode.com/@matthijscox)

[Aug 8, 2024](https://hashnode.com/posts/user-defined-show-method-in-julia/64b6927d72b48291dcb16270/comment/66b480f3bca0913121b26784)

Found another summary of all show/print options, which will be added to the Julia docs: [discourse.julialang.org/t/how-to-display-a-sparse…](https://discourse.julialang.org/t/how-to-display-a-sparse-array-on-the-repl/113565/5)

And this discussion: [discourse.julialang.org/t/print-vs-two-argument-s…](https://discourse.julialang.org/t/print-vs-two-argument-show-repr-vs-three-argument-show-repr-with-mime-text-plain/117790)

[Matthijs Cox](https://hashnode.com/@matthijscox)

[Aug 12, 2024](https://hashnode.com/posts/user-defined-show-method-in-julia/64b6927d72b48291dcb16270/comment/66b480f3bca0913121b26784#reply-66b9da89031820634b573395)

After reading these discussions, I may have interpreted `:compact` in the wrong way, it's not intended for switching between single-line and multi-line displaying.

Also the philosophy of the 2-argument `show(io::IO, t::MyType)` is that it always returns an expression that can be evaluated, kinda like the constructor. You do not want compact mode to accidentally switch it to a multi-line printing.

[Matthijs Cox](https://hashnode.com/@matthijscox)

[Jun 19, 2024](https://hashnode.com/posts/user-defined-show-method-in-julia/64b6927d72b48291dcb16270/comment/6672881f106dff012f60e03c)

Just found out the manual has a section on this topic: [docs.julialang.org/en/v1/manual/types](https://docs.julialang.org/en/v1/manual/types/#man-custom-pretty-printing)
