I have the following problem with tikzpicture. I've added a plot in my text, which has different line styles and markers inside. For better referencing of single curves, I decided to build the line and marker styles with tikzpicture, e.g. a dashed line with a triangle:
\newcommand{\dashedTri}{
\begin{tikzpicture}
\draw[black,dashed,line width=1.5pt](0,0) -- (5mm,0);
\node[very thick, mark size=3pt,color=black] at (1mm,0){
\pgfuseplotmark{triangle}
};
\end{tikzpicture}
}
Which creates:
Note: I also created a diamond marker with a dashed line, by replacing triangle with diamond in the upper code snippet.
Here I have two problems:
- To have the triangle appear in the middle of the line, I had to put
at (1mm,0)instead of(2.5mm,0). When using a circle (i.e.o), puttingat (2.5mm,0)was okay for centering. Does anyone know, why I need different positioning for different markers? - As indicaded by the (later added) red squares in the text: when using these
tikzpicturesthe spacing in the text looks strange, as if the box has a too large width. Adjusting the width (viaresizebox) hasn't solved the problem. Does anyone know, how to "nicely" embed the tikzpicture in the text?
Cheers, Robert


%– ebosi Nov 30 '16 at 15:20\dashedTricommand starts with a space: just after the opening brace: So use{%there. And there is another one after\end{tikzpicture}. Put a%also there. – Pieter van Oostrum Nov 30 '16 at 15:28