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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Aug 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:



\addplot +[line width=2pt] {rnd}; \label{graph1}
\addplot {rnd}; \label{graph2}

\ref{graph1} 2pt line; \qquad \ref{graph2} normal line
share|improve this answer

Your Answer


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