1

I have some math-expression I want to have as a unit in a PGF plot. However, the greek letter is replaced by a horizontal line, if I activate the classicthesis package.

Here a MWE (it works if I comment out the \usepackage{classicthesis}:

\documentclass{scrreprt}

\usepackage{classicthesis}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{siunitx}
\usetikzlibrary{pgfplots.groupplots}
\usepgfplotslibrary{units}



\begin{document}

$\mu_\text{B}$

\begin{tikzpicture}
\begin{axis}[y unit =\mu_\text{B}]
    \addplot [very thick, blue,domain={-pi:pi}] {x^2};
\end{axis}


\end{tikzpicture} %

\end{document}
2

pgfplots seems to typeset the unit with \mathrm. This is imho not a good idea and should be reported as a bug. It breaks if mathpazo is loaded by classicthesis. You can get around the problem by inserting a \mbox or use \si{\micro}:

\documentclass{scrreprt}

\usepackage{mathpazo}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{siunitx}
%\usetikzlibrary{pgfplots.groupplots}
\usepgfplotslibrary{units}

\begin{document}


$\alpha\mu_\text{B}$

$\mathrm{\alpha\mu_\text{B}}$ %wrong

$\mathrm{\mbox{$\alpha\mu$}}$

\begin{tikzpicture}

\begin{axis}[y unit =\mbox{$\mu_\text{B}$}]
    \addplot [very thick, blue,domain={-pi:pi}] {x^2};
\end{axis}

\end{tikzpicture} %

\begin{tikzpicture}

\begin{axis}[y unit =\si{\micro}_\text{B}]
    \addplot [very thick, blue,domain={-pi:pi}] {x^2};
\end{axis}


\end{tikzpicture} %

\end{document}
  • I used the \mbox because I think for custom fonts the \micro is not necessarily identical to the \mu. – NOhs Sep 21 '15 at 14:10

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.