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 would like to have a shape in my diagram looking like this:

desired shape

My main problem is to arrange the nodes as tightly as possible. My current approach is

\documentclass{standalone}

\usepackage{tikz}
\usepackage{amssymb}

\begin{document}
\tikzstyle{state}=[circle, draw, minimum size=5mm,inner sep=0pt]
\tikz{
\node[state] (a) {};
\node[left of=a] {$\vartriangleright$};
}
\end{document}

which results in

enter image description here

This is of course not preferable. I just need to know how to place the triangle node as tightly as possible right next to the circle node.

share|improve this question
    
Welcome to TeX.sx! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are "too localized". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. –  Benedikt Bauer Oct 19 '12 at 19:12
2  
I just edited my post. I hope it is more appropriate now. –  user1658887 Oct 19 '12 at 19:37
1  
The following works: \node [anchor=east, inner sep=0, outer sep=0, xshift=1pt] at (a.west) {$\vartriangleright$};, but not sure why the xshift was required. –  Peter Grill Oct 19 '12 at 19:57
add comment

2 Answers

up vote 3 down vote accepted

Maybe you want to try this:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw [line join=round] (-1,0) -- ++(150:1) -- ++(270:1) -- cycle;
    \draw (0,0) circle (1);
\end{tikzpicture}
\end{document}

enter image description here

I assumed that you use the \vartriangleright command just to get a triangle and not because you need exactly this specific type of triangle. Therefore I have drawn the triangle myself as it is way easier to align then.

As the position of the outer boundary of the circle on the x axis is just the x coordinate of the circle's center minus the radius of the circle, I took this point ((-1,0)) as the reference point for the tip of the triangle. From this point on the triangle is drawn with polar vectors ((<angle>:>length>)) - for a equilateral triangle this is the simplest way as you don't have to calculate the corners in Cartesian coordinates but just give the lengths and angles to the next corner.

share|improve this answer
    
Thx, i use it now like this \newcommand{\foo}[2]{ \node[state] (#1) {#2}; \draw [line join=round, thick] (#1.west) -- ++(-.4, .125) -- ++(0, -.25) -- cycle } –  user1658887 Oct 19 '12 at 20:30
add comment

The node positioning supports the key node distance. By adjusting the node distance by hand you can move the triangle so that both touch each other.

If you use a TikZ triangle instead of the math character there are other ways to adjust the distance but this works here nicely:

\documentclass{standalone}

\usepackage{tikz}
\usepackage{amssymb}

\begin{document}
\tikzstyle{state}=[circle, draw, minimum size=5mm,inner sep=0pt]
\tikz{
\node[state] (a) {};
\node[left of=a,node distance=10pt] {$\vartriangleright$};
}
\end{document}

and results in:

enter image description here

share|improve this answer
add comment

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.