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 want to draw an ellipse and its centre point in the one command, like so:

\draw (1,0) [fill] circle (1mm) node[below]{$1$} ellipse (5 and 2);

I want the centre point filled but not the ellipse. Perhaps I could draw the ellipse first and then activate the [fill] option but is there a command like [nofill] to turn off filling before tikz draws the ellipse?

share|improve this question
    
Is there a particular reason you want to do this all with one \path command? –  Mike Shulman Oct 7 '10 at 19:23
    
@Mike: Just that I'd prefer to avoid any duplication of typing the (1,0) part. It seems odd that I can do all three commands in one \path but when I want to fill I'd need to resort to a second command. I mean, obviously I have just done it as two path commands since there doesn't seem to be a clear solution. –  bryn Oct 8 '10 at 0:29
    
You could give (1,0) a coordinate name so that at least if you change it you'll only have to change it in one place. I agree that it would be nicer if you could draw, or fill, only part of a path, see e.g. tex.stackexchange.com/questions/3513/… –  Mike Shulman Oct 12 '10 at 0:10
add comment

4 Answers

No, this is not possible. From the manual (section 73.1 in version 2.10):

All options that influence how a path is rendered always influence the complete path.

Here the circle and ellipse are in the same \draw command and hence part of the same path (the exception to this is that edge and node commands always create a new path). So you need to either mark the center with a node as Thorsten suggested (maybe with a filled circular node) or split the code into two separate \draw statements. For the latter it is potentially useful to name the coordinate:

\fill (1,0) node[coordinate] (thecenter) {} circle (1mm) node[below]{$1$};
\draw (thecenter) ellipse (5 and 2);
share|improve this answer
    
I'm not sure whether to "accept" this answer. I think you're right but I don't want it to be the case (i.e. I don't want to accept it). –  bryn Feb 21 '11 at 4:56
add comment

According to the manual (p. 136) you can use [fill=none] in this way.

\draw (1,0) [fill] circle (1mm) node[below]{$1$} [fill=none] ellipse (5 and 2);

I haven't tried it myself, though.

share|improve this answer
    
Unfortunately this doesn't fill the center point neither. –  Thorsten Donig Oct 6 '10 at 19:33
    
I wonder if tikz just looks at all the options [fill], [fill=none] and bundles them up before it even begins drawing the path, which might make it impossible to do what I want. –  bryn Oct 6 '10 at 22:03
    
It may be, I know some options work like that, although I'm not sure if fill is one of them. –  David Z Oct 6 '10 at 22:33
add comment

Since the options for the draw command can be given in several places, my guess is that the answer is that it cannot be done in one command. However, perhaps using postaction and preaction there could be some trickery...though I cannot think what.

share|improve this answer
add comment

Perhaps another approach can be helpful. Just use the \textbullet as a node in the center of the ellipse.

\draw (1,0) node {\textbullet} node[below] {1} ellipse (5 and 2);

However, this has the disadvantage that the size of the central point is fixed now.

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.