# Latex output of custom objets

I define a object and want to generate the latex output using Latexify.jl. The object is defined as following

struct vecSym <: Number
name::String
function vecSym(x::String)
new(x)
end
end
function Base.show(io::IO, ::MIME"text/latex", vec::vecSym)
print(io, latexify(vec.name))
end

Then the output of the object is in latex style.

Then I define a method for this object as following

veca
new(x)
end
end
print(io, “+”,"(", y.veca, “)”)
end

Then the output is not in latex style anymore.

Does anybody know what happens? Why this vecAdd method can not show the output in the latex form as +((P_1,P_2))?

You need to call `show` for each of your `vecSym` instances:

``````function Base.show(io::IO, mime::MIME"text/latex", y::vecAdd)
print(io, "+(")
show(io, mime, y.veca[1])
print(io, ",")
show(io, mime, y.veca[2])
print(io, ")")
end
``````

You can also define `show` for `Tuple{vecSym,vecSym}` and just call `show(io, mime, y.veca)` instead.

Thank a lot.