# Pgfplots: Linewidth when using \ref in custom legend

I'm creating a custom legend for some pgfplots graph by drawing a node containing a shortstack. Inside the node I'm using \ref{} to insert correct line-styles in front of my text labels.

The problem is that while the lines in the graph are printed with line width=1pt, the lines from \ref are the standard thin size of pgfplots.

This does not happen when using the normal pgfplots legend setup (\addlegendentry), but this is not possible in this graph since the legend either needs to contain extra information or is a common legend for 2 different axis.

So how can I control the line width when using \ref?

-

## migrated from stackoverflow.comAug 18 '11 at 13:48

This question came from our site for professional and enthusiast programmers.

Please register your account at Stack Overflow and at TeX Stack Exchange to be able to comment on your question and its answers after the migration, and to accept an answer. –  Paŭlo Ebermann Aug 18 '11 at 13:44
Please add a minimal working example (MWE) that illustrates your problem. –  Caramdir Aug 18 '11 at 15:31

Maybe you specified the line width incorrectly. Here's an example that shows that \ref does indeed produce the correct line width:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\centering
\begin{tikzpicture}
\begin{axis}