TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

enter image description hereI use the code below to draw a rectangle enclosed by a oval, however it doesn't work.



% parameterized tikz graphics
\def\setA{(0,0) circle (1)}%
\def\setc{(1,0) ellipse (1,2)}%
\def\setB{(#1,0) circle (1)}%
% define the bounding box
\def\boundb{(-2,2) rectangle (4,-2)}%
    \draw \boundb;
    % intersection
    \clip \setc;
    \begin{scope}[even odd rule]% first circle without the second
    \clip \setB \boundb;
    \draw \setc;


    %first frame, xb=0.0
    \gdef\xb{0}% xb initial value
    %remaining frames, xb=0.1...2.1
    \whiledo{\lengthtest{\xb pt < 2.1pt}}{%
        \FPeval{xb}{\xb+0.1}% new xb
        \xdef\xb{\xb}% make \xb global

share|improve this question
can you add a figure to explain – rpapa Jul 28 '12 at 12:27
OK, I have added it. – sweetyBaby Jul 28 '12 at 12:32
for ellipses use \def\setc{(1,0) ellipse (1 and 2), so and instead of , – Tom Bombadil Jul 28 '12 at 12:53
@TomBombadil Even (1,0) circle (1 and 2) works. – percusse Jul 28 '12 at 13:09
@percusse: I know, I usually use circle, that's one less character than ellipse ;) – Tom Bombadil Jul 28 '12 at 15:47
up vote 1 down vote accepted

I don't understand what exactly you want to do but the following is working without any problems in Adobe Reader.


                                 \useasboundingbox (0,0) rectangle (5cm,4cm);
  \draw (0.5cm,0.5cm) rectangle (4.5cm,3.5);
  \draw (2.5cm,2cm) circle (\nstep cm and 0.8*\nstep cm);

Note that the variable names should start with i,n,d etc. (see the animate manual p.4) to reflect the type of the variable.

share|improve this answer

Your Answer


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.