I want to draw a macro for typeseting axis tick marks and labels. However, the following
\newcommand\obrPopisX[2][below]{\foreach \x/\xtext in {#2}
\draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[#1] {$\xtext$};}
does not produce good results of the optional parameter is "above" - the labels are too close, since they are attached to the point 2pt below the axis. As a partial workaround I can have
\newcommand\obrPopisX[2][below]{\foreach \x/\xtext in {#2}
{\draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt);
\draw [shift={(\x,0)}] (0,0) node[#1] {$\xtext$};};}
but this sets labels relatively to the point on the axis, not the end of the tickmark. I wish to define macro, which sets the labels relatively to the whole line, i.e. behaves like
\draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node ...;
or like
\draw[shift={(0,\y)}] (-2pt,0pt) -- (2pt,0pt) node ....;
depending on the fact if the keyword "above" is one of the optional parameters of the macro obrPopisX. Any idea? Probably I want to attach the label to the whole line rather than to the end point of the line. Thank you.