Question about the use of \def

View: New views
8 Messages — Rating Filter:   Alert me  

Question about the use of \def

by Michael Kubovy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear PGF users,

If I uncomment line 26 and comment line 27 below, the compilation  
fails. Can anyone tell me what I'm doing wrong? It would be helpful if  
you cc-ed me when responding to the list.

%! program = pdflatexmk

\documentclass{minimal}
\usepackage[latin1]{inputenc}
\usepackage{tikz,pgfbaseimage}
\usepackage{amssymb,amsmath,latexsym}
\usetikzlibrary
{shapes,arrows,decorations,backgrounds,fit,trees,patterns}
\usepackage{xspace}
\usepackage[active,tightpage,pdftex]{preview}
\PreviewEnvironment{tikzpicture}

\def\bg{8} % background rectangle
\def\mask{7}
\def\rightWidth{0.5}
\def\rightHeight{0.3}
\def\leftWidth{0.5}
\def\leftHeight{0.2}

\begin{tikzpicture}[>=stealth,scale = 1]
        \fill[gray] (-\bg, -\bg) rectangle (\bg, \bg);
\begin{scope}[rotate=15]
        \clip (0, 0) circle (\mask);
        \foreach \x in {-\bg, -6, ..., \bg} {
                \fill[white] (\x, -\bg) rectangle (\x + 1, \bg);
                \foreach \y in {-\bg, -7.2, ..., \bg}
% \fill[black] (\x, \y) ellipse (\rightHeight and \rightWidth);
                        \fill[black] (\x, \y) ellipse (0.3 and \rightWidth);
        }
        \foreach \x in {-7, -5, ..., \bg}
                \foreach \y in {-8.4, -7.2, ..., \bg}
                        \fill[black] (\x, \y) ellipse (0.2 and \leftWidth);
        \foreach \x in {-7, -5, ..., \bg}
                \fill[black] (\x, -\bg) rectangle (\x + 1, \bg);
\end{scope}
\end{tikzpicture}

\end{document}

Thanks,
MK
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
       McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Mark Wibrow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This is a bug in the parsing of ellipses which cannot cope with the
first radius being specified using a macro because the following space
is ignored and the 'and' is treated as part of the radius
specification which results in all sorts of mayhem. If you are stuck
with the 2.0 release then the following will work:

\fill[black] (\x, \y) ellipse (\rightHeight+0 and \rightWidth);

Or

\fill[black] (\x, \y) ellipse ({\rightHeight} and \rightWidth);

If you update to the latest CVS versions (can't remember when it came
in) there is a new (and preferred) way to specify the radii using
keys:

\fill[black] (\x, \y) ellipse [x radius=\rightHeight,y radius=\rightWidth];

Regards

Mark

2009/10/24 Michael Kubovy <kubovy@...>:

> Dear PGF users,
>
> If I uncomment line 26 and comment line 27 below, the compilation
> fails. Can anyone tell me what I'm doing wrong? It would be helpful if
> you cc-ed me when responding to the list.
>
> %! program = pdflatexmk
>
> \documentclass{minimal}
> \usepackage[latin1]{inputenc}
> \usepackage{tikz,pgfbaseimage}
> \usepackage{amssymb,amsmath,latexsym}
> \usetikzlibrary
> {shapes,arrows,decorations,backgrounds,fit,trees,patterns}
> \usepackage{xspace}
> \usepackage[active,tightpage,pdftex]{preview}
> \PreviewEnvironment{tikzpicture}
>
> \def\bg{8} % background rectangle
> \def\mask{7}
> \def\rightWidth{0.5}
> \def\rightHeight{0.3}
> \def\leftWidth{0.5}
> \def\leftHeight{0.2}
>
> \begin{tikzpicture}[>=stealth,scale = 1]
>        \fill[gray] (-\bg, -\bg) rectangle (\bg, \bg);
> \begin{scope}[rotate=15]
>        \clip (0, 0) circle (\mask);
>        \foreach \x in {-\bg, -6, ..., \bg} {
>                \fill[white] (\x, -\bg) rectangle (\x + 1, \bg);
>                \foreach \y in {-\bg, -7.2, ..., \bg}
> %                       \fill[black] (\x, \y) ellipse (\rightHeight and \rightWidth);
>                        \fill[black] (\x, \y) ellipse (0.3 and \rightWidth);
>        }
>        \foreach \x in {-7, -5, ..., \bg}
>                \foreach \y in {-8.4, -7.2, ..., \bg}
>                        \fill[black] (\x, \y) ellipse (0.2 and \leftWidth);
>        \foreach \x in {-7, -5, ..., \bg}
>                \fill[black] (\x, -\bg) rectangle (\x + 1, \bg);
> \end{scope}
> \end{tikzpicture}
>
> \end{document}
>
> Thanks,
> MK
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
> Parcels:    Room 102        Gilmer Hall
>       McCormick Road    Charlottesville, VA 22903
> Office:    B011    +1-434-982-4729
> Lab:        B019    +1-434-982-4751
> Fax:        +1-434-982-4766
> WWW:    http://www.people.virginia.edu/~mk9y/
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Michael Kubovy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

BTW, these fixes didn't work:

On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:

> If you are stuck
> with the 2.0 release then the following will work:
>
> \fill[black] (\x, \y) ellipse (\rightHeight+0 and \rightWidth);
>
> Or
>
> \fill[black] (\x, \y) ellipse ({\rightHeight} and \rightWidth);
>
> 2009/10/24 Michael Kubovy <kubovy@...>:
>> Dear PGF users,
>>
>> If I uncomment line 26 and comment line 27 below, the compilation
>> fails. Can anyone tell me what I'm doing wrong? It would be helpful  
>> if
>> you cc-ed me when responding to the list.
>>
>> %! program = pdflatexmk
>>
>> \documentclass{minimal}
>> \usepackage[latin1]{inputenc}
>> \usepackage{tikz,pgfbaseimage}
>> \usepackage{amssymb,amsmath,latexsym}
>> \usetikzlibrary
>> {shapes,arrows,decorations,backgrounds,fit,trees,patterns}
>> \usepackage{xspace}
>> \usepackage[active,tightpage,pdftex]{preview}
>> \PreviewEnvironment{tikzpicture}
>>
>> \def\bg{8} % background rectangle
>> \def\mask{7}
>> \def\rightWidth{0.5}
>> \def\rightHeight{0.3}
>> \def\leftWidth{0.5}
>> \def\leftHeight{0.2}
>>
>> \begin{tikzpicture}[>=stealth,scale = 1]
>>        \fill[gray] (-\bg, -\bg) rectangle (\bg, \bg);
>> \begin{scope}[rotate=15]
>>        \clip (0, 0) circle (\mask);
>>        \foreach \x in {-\bg, -6, ..., \bg} {
>>                \fill[white] (\x, -\bg) rectangle (\x + 1, \bg);
>>                \foreach \y in {-\bg, -7.2, ..., \bg}
>> %                       \fill[black] (\x, \y) ellipse (\rightHeight  
>> and \rightWidth);
>>                        \fill[black] (\x, \y) ellipse (0.3 and  
>> \rightWidth);
>>        }
>>        \foreach \x in {-7, -5, ..., \bg}
>>                \foreach \y in {-8.4, -7.2, ..., \bg}
>>                        \fill[black] (\x, \y) ellipse (0.2 and  
>> \leftWidth);
>>        \foreach \x in {-7, -5, ..., \bg}
>>                \fill[black] (\x, -\bg) rectangle (\x + 1, \bg);
>> \end{scope}
>> \end{tikzpicture}
>>
>> \end{document}
>>
>> Thanks,
>> MK
>> _____________________________
>> Professor Michael Kubovy
>> University of Virginia
>> Department of Psychology
>> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
>> Parcels:    Room 102        Gilmer Hall
>>       McCormick Road    Charlottesville, VA 22903
>> Office:    B011    +1-434-982-4729
>> Lab:        B019    +1-434-982-4751
>> Fax:        +1-434-982-4766
>> WWW:    http://www.people.virginia.edu/~mk9y/
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart  
>> your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> pgf-users mailing list
>> pgf-users@...
>> https://lists.sourceforge.net/lists/listinfo/pgf-users
>>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Michael Kubovy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Mark,

Where is it? How do I update? Is there new documentation?

MK

On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:

> If you update to the latest CVS versions (can't remember when it came
> in) there is a new (and preferred) way to specify the radii using


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Mark Wibrow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Not sure why my suggestions don't work. Sorry.

If you aren't happy with setting up CVS access from the sourceforge
website (http://sourceforge.net/cvs/?group_id=142562), then conviently
packaged builds can be downloaded from:

http://www.texample.net/tikz/builds/

Regards

Mark

2009/10/24 Michael Kubovy <kubovy@...>:

> Thanks Mark,
>
> Where is it? How do I update? Is there new documentation?
>
> MK
>
> On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:
>
>> If you update to the latest CVS versions (can't remember when it came
>> in) there is a new (and preferred) way to specify the radii using
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Michael Kubovy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How can I tell which version LaTeX is using?

On Oct 25, 2009, at 1:30 PM, Mark Wibrow wrote:

> Hi,
>
> Not sure why my suggestions don't work. Sorry.
>
> If you aren't happy with setting up CVS access from the sourceforge
> website (http://sourceforge.net/cvs/?group_id=142562), then conviently
> packaged builds can be downloaded from:
>
> http://www.texample.net/tikz/builds/
>
> Regards
>
> Mark
>
> 2009/10/24 Michael Kubovy <kubovy@...>:
>> Thanks Mark,
>>
>> Where is it? How do I update? Is there new documentation?
>>
>> MK
>>
>> On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:
>>
>>> If you update to the latest CVS versions (can't remember when it  
>>> came
>>> in) there is a new (and preferred) way to specify the radii using
>>
>>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Mark Wibrow-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

It should say in the log file.

Regards

Mark

2009/10/27 Michael Kubovy <kubovy@...>:

> How can I tell which version LaTeX is using?
>
> On Oct 25, 2009, at 1:30 PM, Mark Wibrow wrote:
>
>> Hi,
>>
>> Not sure why my suggestions don't work. Sorry.
>>
>> If you aren't happy with setting up CVS access from the sourceforge
>> website (http://sourceforge.net/cvs/?group_id=142562), then conviently
>> packaged builds can be downloaded from:
>>
>> http://www.texample.net/tikz/builds/
>>
>> Regards
>>
>> Mark
>>
>> 2009/10/24 Michael Kubovy <kubovy@...>:
>>>
>>> Thanks Mark,
>>>
>>> Where is it? How do I update? Is there new documentation?
>>>
>>> MK
>>>
>>> On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:
>>>
>>>> If you update to the latest CVS versions (can't remember when it came
>>>> in) there is a new (and preferred) way to specify the radii using
>>>
>>>
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Question about the use of \def

by Michael Kubovy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are these the latest?

Package: pgfrcs 2008/02/20 v2.00 (rcs-revision 1.21)
Package: pgf 2008/01/15 v2.00 (rcs-revision 1.12)

if I didn't screw up, this is what comes from http://www.texample.net/tikz/builds/

MK

On Oct 25, 2009, at 1:30 PM, Mark Wibrow wrote:

> Hi,
>
> Not sure why my suggestions don't work. Sorry.
>
> If you aren't happy with setting up CVS access from the sourceforge
> website (http://sourceforge.net/cvs/?group_id=142562), then conviently
> packaged builds can be downloaded from:
>
> http://www.texample.net/tikz/builds/
>
> Regards
>
> Mark
>
> 2009/10/24 Michael Kubovy <kubovy@...>:
>> Thanks Mark,
>>
>> Where is it? How do I update? Is there new documentation?
>>
>> MK
>>
>> On Oct 24, 2009, at 2:49 PM, Mark Wibrow wrote:
>>
>>> If you update to the latest CVS versions (can't remember when it  
>>> came
>>> in) there is a new (and preferred) way to specify the radii using

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users