# Latex Matrix in PlotLegends

I would like to have the expression $$\rho\!\begin{pmatrix}a&b\\ c & d\end{pmatrix}=1$$ as a legend of a plot. When I try (code is adapted from this answer)
Plot[x^2, {x, 0, 1}, PlotLegends -> Placed[{Text[Style[ToExpression["\\rho\\left({{1/(p-1),1/(p-1)},{2/(q-1),0}}\\right)=1",TeXForm, HoldForm], Bold]]}, {.4, .8}]]

I obtain the following: which is not what I want...

I tried using MaTex but had trouble installing it (in the configuration step)...

Is there a simple way to fix my issue?

eqn = HoldForm[ ρ MatrixForm[{{a, b}, {c, d}}] == 1];

Plot[x^2, {x, 0, 1},
PlotLegends -> Placed[{Style[eqn, Bold]}, {.4, .8}]] Using MaTeX

Needs["MaTeX"]
pl=HoldForm[p {{a,b},{c,d}}==1];
plt=MaTeX[TeXForm@pl,Magnification->1.5];
Plot[x^2,{x,0,1},PlotLegends->Placed[plt,{.4,.8}]] To use rho in place of p, you can try replacing the p (since only one of them happen to be there in this example)

pl=HoldForm[p {{a,b},{c,d}}==1];
plt=ToString@TeXForm@pl;
plt=MaTeX[StringReplace[plt,"p"->"\\rho"],Magnification->1.7];
Plot[x^2,{x,0,1},PlotLegends->Placed[plt,{.4,.8}]] • Actually the ToString@TeXForm[...] is not necessary. This is done automatically by MaTeX. Just writing pl instead is sufficient. – Szabolcs Jul 6 '17 at 4:12
• @Szabolcs thanks. I did not know this. Changed the first example. But for the second example, I still need ToString I think, since I needed to do StringReplace later on. – Nasser Jul 6 '17 at 4:17

Maybe

pl = p {{a, b}, {c, d}} == 1 // HoldForm // TraditionalForm //
Rasterize[#, RasterSize -> 500] & // Magnify[#, 1] &;

Plot[x^2, {x, 0, 1}, PlotLegends -> Placed[pl, {.4, .8}]]
` • Looks good :), thank you very much. The only little details is that the "p" is not a $p$ but a rho $\rho$. Is it possible to also include that or it would make the solution much more complicated? – Surb Jul 5 '17 at 22:02
• Instead of the "normal" p just input esc rho esc – eldo Jul 5 '17 at 23:02