11

I want to use the \frac command in an annotation to a line

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[dashed]coordinates {(0,0) (1,1)} node[pos=0.5,sloped,yshift=7pt]{$\frac{1}{wuv}$};
\end{axis}
\end{tikzpicture}
\end{document}

However, the line of the fraction has the same style as the line. How can I get a fraction with a normal line?

enter image description here

0

1 Answer 1

9

Add the option solid to the node. I would also increase a bit the yshift dimension.

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[dashed]coordinates {(0,0) (1,1)} node[pos=0.5,sloped,yshift=9pt,solid]{$\frac{1}{wuv}$};
\end{axis}
\end{tikzpicture}
\end{document}

The result:

enter image description here

EDIT. Jake is right in his comment: by specifying any version (tested with 1.3), the error disappears. Hence:

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[dashed]coordinates {(0,0) (1,1)} node[pos=0.5,sloped,yshift=9pt]{$\frac{1}{wuv}$};
\end{axis}
\end{tikzpicture}
\end{document}

will lead to the same result.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .