Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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