3
$\begingroup$

My system: Windows 10, Mathematica 11.2

Problem: I have been using the fine MaTeX paclet to get nice symbols on my plots. As I scale the images in a TeX-document after exporting them in EPS, I need to adjust the FontSize. So far things have worked out the way I wanted them to. But this week Mathematica has been acting up.

A command like

ec = ContourPlot[y^2 == x^3 - 5 x + 6, {x, -3.5, 3.5}, {y, -3.5, 3.5},
   Frame -> False, Axes -> True, 
  AxesLabel -> {MaTeX["x"], MaTeX["y"]}]

works just fine, produces the expected image with nicely rendererd AxesLabels. But when I try

ec = ContourPlot[y^2 == x^3 - 5 x + 6, {x, -3.5, 3.5}, {y, -3.5, 3.5},
   Frame -> False, Axes -> True, 
  AxesLabel -> {MaTeX["x", FontSize -> 18], 
    MaTeX["y", FontSize -> 18]}]

instead, I get a strange message with a tiny garbage image followed by a text like "MapThread[...". Having isolated the problem, the next thing to do was to try the input

MaTeX["x", FontSize -> 18]

This gave the following message that is all Greek to me, but hopefully somebody here can make sense out of it. I omitted most of the contents of the GraphicsBox for it's rather long. If judged essential, I will copy/paste all of it.

MapThread[ Show[#1, ImageSize -> {#2, #3}, BaselinePosition -> Scaled[(#4 + MaTeXPrivate$psfactor)/#3]] &, {{\!\(\* GraphicsBox[ AspectRatio->Automatic, ImageSize->{12., 24.}, PlotRange->{{0., 11.97}, {0., 23.51}}]\)}, 0.996264 (2 + Interpreter`DependentTypes`PackagePrivate`coerced$5234), \ {23.5118}, {6.45585}}]

Search: It is not impossible that my problem is related to that of this question. However, Szabolcs' diagnosis does not seem to fit here given that MaTeX in the exact same notebook worked a week ago. Therefore it is unlikely that for example Scandic letters in the path name would play a role. Furthermore, the path to this notebook is all ASCII-characters anyway.


Update:

More testing:

It seems to me that the choice of FontSize plays a role.

In a virgin session, the first call to MaTeX, asking for FontSize->16 greeted me with the following:

Fold::normal: Nonatomic expression expected at position 3 in Fold[Insert[#1,{},#2]&,MapThread[Replace[#1,Failure[InterpreterInternalPackagePrivateargs___,InterpreterInternalPackagePrivatea:Blank[<<1>>]]:>Failure[InterpreterInternalPackagePrivateargs,Join[InterpreterInternalPackagePrivatea,Association[<<2>>]]]]&,{<<1>>,{8.90271}}],InterpreterDependentTypesPackagePrivate`pos$3165].

Together with a lot of messages:

Symbol::argx: Symbol called with 0 arguments; 1 argument is expected.

Next, when I asked for an 18-point font, I got the plot together with typeset strings all right. But at the bottom of that cell there was something extra starting with Show[#1, ImageSize->{#2,#3},...


Next, when I asked for a 20-point font. THERE WERE NO PROBLEMS.

So has something destroyed my collection of fonts this last week?


A clue to the above test was that copy/pasting the snippet from Szabolcs' page worked as prescribed. So Magnification -> 2 works fine.

$\endgroup$
  • $\begingroup$ FWIW I have been using MaTeX within the same installation of Mathematica since August. Mostly in the same selected folders. $\endgroup$ – Jyrki Lahtonen Nov 3 '19 at 11:49
  • $\begingroup$ Superficially, it looks like an issue with Mathematica itself (all that internal Interpreter stuff), not MaTeX, and not actually related to the font size. Do try a ClearMaTeXCache[]. I am going offline in a couple of hours and won't be around for about a week, so unfortunately I can't dig into this now. $\endgroup$ – Szabolcs Nov 3 '19 at 15:25
  • $\begingroup$ P.S. 1. I can't reproduce the problem. 2. The Mathematica version may be relevant. 3. The "Symbol called with 0 arguments" reinforces my suspicion that this is a bug in Mathematica. It will likely temporarily go away with a kernel restart ... $\endgroup$ – Szabolcs Nov 3 '19 at 15:27
  • $\begingroup$ Thanks @Szabolcs. Yes my experiences from last Friday (when I temporarily had the same problem), and further testing now both indicate that this is an on/off thing. Just a few minutes ago I got a few of the offending font sizes to work. I will report, if I find something reproducible. $\endgroup$ – Jyrki Lahtonen Nov 3 '19 at 15:48
3
$\begingroup$

This also started happening to me sometime last week. I have no clue what triggered the change, since I have not updated anything manually.

Unfortunately, I don't have a proper fix, but a simple workaround I've found is to run the following snippet once at the beginning of the notebook,

Quiet[MaTeX["x"]];
ClearMaTeXCache[];

MaTeX can be used normally afterwards.

$\endgroup$
  • $\begingroup$ ClearMaTeXCache[] definitely helps. For a reason I cannot understand I need to give that command twice. Or, doing it at the beginning only will still produce that error message. But, giving it again, and then reinputting the Plot-command makes the problem disappear. I am accepting this for now as a fix, but I don't think the problem is completely understood yet. Of course, I don't know the inner workings of MaTeX. $\endgroup$ – Jyrki Lahtonen Nov 25 '19 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.