# pgfplots: Changing font of binary operator

What is the command to modify the font of the binary operators of a pgfplot?

MWE:

\documentclass[12pt,a4paper]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[scaled ticks=true]
\end{axis}
\end{tikzpicture}
\end{document}


Example (binary operator are marked in yellow)

• And what should the centered dot be changed into? – egreg Apr 15 '18 at 10:18
• Good question. I would prefer the 'times' symbol of my sans-serif in use. – D5E Apr 15 '18 at 13:30

I agree with @caverac that the ytick scale label code/.code= key is the thing you want to change, and think it would have been appropriate to mention this answer in this context. What I do, however, not like is that (s)he nests tikzpictures.

\documentclass[12pt,a4paper]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=true,
xtick scale label code/.code={$\mathsf{\cdot 10^{#1}}$},
ytick scale label code/.code={$\mathsf{\cdot 10^{#1}}$},
]
\end{axis}
\end{tikzpicture}
\end{document}


I'll be happy to remove my answer if caverac removes the nested tikzpictures, refers to the earlier answer (and answers the question).

• You're right, I changed the highlighted text – caverac Apr 15 '18 at 16:29
• That's the thing, I was searching! Thx – D5E Apr 15 '18 at 16:35

You can use the xtick scale label code option

\documentclass[12pt,a4paper]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=true,
ytick scale label code/.code={$\mathrm{\cdot 10^{#1}}$},
xtick scale label code/.code={$\mathit{\cdot 10^{#1}}$},
]
\end{axis}
\end{tikzpicture}
\end{document}


EDIT I highlighted the label just to emphasize that it can be changed through xtick scale label code, changed it to a couple of different fonts now. Thanks to @marmot and @remco for their feedback

• OP was asking about changing the font of the labels, not about adding the highlighting... – remco Apr 15 '18 at 9:44
• @remco Thanks! I understand that, my point is that the style of the label can be changed with xtick scale label code – caverac Apr 15 '18 at 9:48
• I can no longer delete my answer. So I upvoted some of your other excellent answers (those which I did not upvote before), hoping that's OK with you. – user121799 Apr 15 '18 at 18:37
• It’s alright, no worries :) – caverac Apr 15 '18 at 21:19

PgfPlot writes the automatic scaling labels in the current math fonts (through "\ensuremath"). So to use a different font for your axis labels, you can either force PgfPlots to use a text font, or change the math fonts you use.

With LuaLatex, using the package unicode-math and \setmathfont{xxx}, you can set the math fonts to 'xxx'.