I have started using MaTeX (excellent package to integrate Latex in your wonderful Mathematica generated plots).
I am getting a warning in generating the following plot
<< MaTeX`
texStyle = {FontFamily -> "Latin Modern Roman", FontSize -> 18};
SetOptions[MaTeX,
"Preamble" -> {"\\usepackage{wasysym}\\usepackage[dvipsnames]{xcolor}"}];
f[x_] := ScientificForm[
N[x /. {NumberForm[y_, {w_, z_}] :> ScientificForm[y, 2]}], 2]
DensityPlot[Sin[x y], {x, -2, 2}, {y, -2, 2},
ColorFunction -> ColorData[{"RedBlueTones", "Reverse"}],
ImageSize -> {500, Automatic}, PlotRange -> All,
PlotLegends ->
Placed[BarLegend[Automatic, LegendFunction -> f,
LegendMarkerSize -> 350,
LegendLabel ->
MaTeX["\\mathrm{Re}(\\mathrm{i}\,I_{\\overline{\\mathrm{D}3}}/L^\
3 T)", Magnification -> 2], LabelStyle -> texStyle], {After, Top}],
BaseStyle -> texStyle]
Clear[f]
I know that the problem is in using the LegendFunction and the "\\overline" (when I remove one of the two, no warning is issued).
f(the LegendFunction) corrupting the Graphics expression returned by MaTeX. Since this function does not seem to do anything here anyway, remove it. – Szabolcs Mar 15 '21 at 13:00fis indeed doing something there. It is ensuring that the legend comes out in Scientific form, and I would like to keep that. – user12588 Mar 16 '21 at 15:00