From: Matthew Leingang <leingang@co...>  20090729 13:44:30

On Jul 29, 2009, at 8:46 AM, waterloo wrote: > Thanks . > 1. \ifpgfmathunitsdeclared is a command of the TeX ? Yes, it is a special kind of macro known as a conditional. You might want to read about conditionals (p. 207 of the TeXbook) and the \newif command. > 2. I can not understand the syntax of the sentence: > "After a call of \pgfmathparse this if will be true exactly if some > unit was encountered in the expression. " > The grammar and syntax of it are right ? I'll substitute in the antecedent: "After a call of \pgfmathparse, \ifpgfmathunitsdeclared will be true [that is, this test will succeed] exactly if some unit was encountered in the expression." But you might be going down a rabbit hole. TikZ is designed to add another layer of abstraction between the user and all those PGF codes, so you may not need to do all this. It's often fruitful to say "I want to do X. I'm trying Y, but I'm having trouble with Z." If there is a better way to do X than Y people will tell you, but if all you ask about is Z you might not be able to even use the result. So what is it you want to do? Matthew  Matthew Leingang Clinical Associate Professor of Mathematics leingang@... 
From: waterloo <waterloo2005@gm...>  20090729 11:19:38
Attachments:
Message as HTML

I am reading 2.0 manual , can not understand the following sentence in `49.1 Commands for Parsing Expressions' . You can check whether an expression contained a unit using the TEXif \ifpgfmathunitsdeclared. After a call of \pgfmathparse this if will be true exactly if some unit was encountered in the expression. What does it mean ? Thanks 
From: waterloo <waterloo2005@gm...>  20090729 12:46:49
Attachments:
Message as HTML

Thanks . 1. \ifpgfmathunitsdeclared is a command of the TeX ? 2. I can not understand the syntax of the sentence: "After a call of \pgfmathparse this if will be true exactly if some unit was encountered in the expression. " The grammar and syntax of it are right ? 2009/7/29 Matthew Leingang <leingang@...> > Hi, > > I'm not sure if you're confused about TeX \if's or the way the pgf math > parser works. The thing about \pgfmathparse is it doesn't produce any > output, it stores results in macros. So the code > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}. > > will result in "The sum of 2 in and 4in is ." The \pgfmathparse macro puts > the result in \pgfmathresult, so if you wanted the result, you'd have to say > it as > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}\pgfmathresult. > > and you get "The sum of 2in and 4in is 433.61998", because that is 6in in > points. > > You don't have to use units: > > The sum of 2 and 4 is \pgfmathparse{2 + 4}\pgfmathresult > > gives "The sum of 2 and 4 is 6.0". > > You can check if the input to \pgfmathparse did use units with the > \ifpgfmathunitsdeclared macro. So you can say: > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > and you get "The sum of 2in and 4in is 433.61998, and units were used." > Whereas > > The sum of 2 and 4 is \pgfmathparse{2 + 4}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > gives "The sum of 2 and 4 is 6.0, and units were NOT used." > > Without a more specific question it's hard to answer. Hope this helps. > > Matthew > > > On Jul 29, 2009, at 7:19 AM, waterloo wrote: > > I am reading 2.0 manual , can not understand the following sentence in >> `49.1 Commands for Parsing Expressions' . >> You can check whether an expression contained a unit using the TEXif >> \ifpgfmathunitsdeclared. >> After a call of \pgfmathparse this if will be true exactly if some unit >> was encountered in the >> expression. >> >> What does it mean ? >> Thanks >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 >> 30Day >> trial. Simplify your report design, integration and deployment  and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. >> http://p.sf.net/sfu/bobjjuly_______________________________________________ >> pgfusers mailing list >> pgfusers@... >> https://lists.sourceforge.net/lists/listinfo/pgfusers >> > >  > Matthew Leingang > Clinical Associate Professor of Mathematics > leingang@... > > > > 
From: waterloo <waterloo2005@gm...>  20090729 12:54:00
Attachments:
Message as HTML

This is why ? 1.32852 \pgfmathparse{54pt/3cm*2.1} \pgfmathresult Thanks 2009/7/29 Matthew Leingang <leingang@...> > Hi, > > I'm not sure if you're confused about TeX \if's or the way the pgf math > parser works. The thing about \pgfmathparse is it doesn't produce any > output, it stores results in macros. So the code > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}. > > will result in "The sum of 2 in and 4in is ." The \pgfmathparse macro puts > the result in \pgfmathresult, so if you wanted the result, you'd have to say > it as > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}\pgfmathresult. > > and you get "The sum of 2in and 4in is 433.61998", because that is 6in in > points. > > You don't have to use units: > > The sum of 2 and 4 is \pgfmathparse{2 + 4}\pgfmathresult > > gives "The sum of 2 and 4 is 6.0". > > You can check if the input to \pgfmathparse did use units with the > \ifpgfmathunitsdeclared macro. So you can say: > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > and you get "The sum of 2in and 4in is 433.61998, and units were used." > Whereas > > The sum of 2 and 4 is \pgfmathparse{2 + 4}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > gives "The sum of 2 and 4 is 6.0, and units were NOT used." > > Without a more specific question it's hard to answer. Hope this helps. > > Matthew > > > On Jul 29, 2009, at 7:19 AM, waterloo wrote: > > I am reading 2.0 manual , can not understand the following sentence in >> `49.1 Commands for Parsing Expressions' . >> You can check whether an expression contained a unit using the TEXif >> \ifpgfmathunitsdeclared. >> After a call of \pgfmathparse this if will be true exactly if some unit >> was encountered in the >> expression. >> >> What does it mean ? >> Thanks >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 >> 30Day >> trial. Simplify your report design, integration and deployment  and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. >> http://p.sf.net/sfu/bobjjuly_______________________________________________ >> pgfusers mailing list >> pgfusers@... >> https://lists.sourceforge.net/lists/listinfo/pgfusers >> > >  > Matthew Leingang > Clinical Associate Professor of Mathematics > leingang@... > > > > 
From: Matthew Leingang <leingang@co...>  20090729 12:59:04

Hi, I'm not sure if you're confused about TeX \if's or the way the pgf math parser works. The thing about \pgfmathparse is it doesn't produce any output, it stores results in macros. So the code The sum of 2in and 4in is \pgfmathparse{2in + 4in}. will result in "The sum of 2 in and 4in is ." The \pgfmathparse macro puts the result in \pgfmathresult, so if you wanted the result, you'd have to say it as The sum of 2in and 4in is \pgfmathparse{2in + 4in}\pgfmathresult. and you get "The sum of 2in and 4in is 433.61998", because that is 6in in points. You don't have to use units: The sum of 2 and 4 is \pgfmathparse{2 + 4}\pgfmathresult gives "The sum of 2 and 4 is 6.0". You can check if the input to \pgfmathparse did use units with the \ifpgfmathunitsdeclared macro. So you can say: The sum of 2in and 4in is \pgfmathparse{2in + 4in}, and \ifpgfmathunitsdeclared units were used. \else units were NOT used. \fi and you get "The sum of 2in and 4in is 433.61998, and units were used." Whereas The sum of 2 and 4 is \pgfmathparse{2 + 4}, and \ifpgfmathunitsdeclared units were used. \else units were NOT used. \fi gives "The sum of 2 and 4 is 6.0, and units were NOT used." Without a more specific question it's hard to answer. Hope this helps. Matthew On Jul 29, 2009, at 7:19 AM, waterloo wrote: > I am reading 2.0 manual , can not understand the following sentence > in `49.1 Commands for Parsing Expressions' . > You can check whether an expression contained a unit using the TEX > if \ifpgfmathunitsdeclared. > After a call of \pgfmathparse this if will be true exactly if some > unit was encountered in the > expression. > > What does it mean ? > Thanks >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 > 30Day > trial. Simplify your report design, integration and deployment  and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobjjuly_______________________________________________ > pgfusers mailing list > pgfusers@... > https://lists.sourceforge.net/lists/listinfo/pgfusers  Matthew Leingang Clinical Associate Professor of Mathematics leingang@... 
From: waterloo <waterloo2005@gm...>  20090729 13:18:08
Attachments:
Message as HTML

In tikzpicture environment, `\fill ({sin(60)},2) circle (2pt); ' also works. What is difference between {sin(60)} and `\pgfmathparse{sin(60)}\pgfmathresult' ? Thanks 
From: Matthew Leingang <leingang@co...>  20090729 13:44:05

Hi, The tikz parser knows to run expressions in {} through the pgfmath parser. This is good news: if all you're doing is pictures, you usually don't have to call the pgfmath parser. But outside of that environment, you would need to tell pgfmath to parse it. So The sine of 60 degrees is {sin(60)} won't compute it, but The sine of 60 degrees is \pgfmathparse{sin(60)}\pgfmathresult will. Matthew On Jul 29, 2009, at 9:17 AM, waterloo wrote: > In tikzpicture environment, > `\fill ({sin(60)},2) circle (2pt); ' also works. > > What is difference between {sin(60)} and `\pgfmathparse{sin(60)} > \pgfmathresult' ? > > Thanks  Matthew Leingang Clinical Associate Professor of Mathematics leingang@... 
From: Matthew Leingang <leingang@co...>  20090729 13:44:20

Yes, in section 49.1 you have "The result stored in the macro \pgfmathresult is a decimal without units. This is true regardless of whether the ⟨expression ⟩ contains any unit speciﬁcation. But, any units speciﬁed will be converted to points ﬁrst." Matthew Leingang On Jul 29, 2009, at 8:53 AM, waterloo wrote: > This is why ? 1.32852 \pgfmathparse{54pt/3cm*2.1} \pgfmathresult > > Thanks > > 2009/7/29 Matthew Leingang <leingang@...> > Hi, > > I'm not sure if you're confused about TeX \if's or the way the pgf > math parser works. The thing about \pgfmathparse is it doesn't > produce any output, it stores results in macros. So the code > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}. > > will result in "The sum of 2 in and 4in is ." The \pgfmathparse > macro puts the result in \pgfmathresult, so if you wanted the > result, you'd have to say it as > > The sum of 2in and 4in is \pgfmathparse{2in + 4in} > \pgfmathresult. > > and you get "The sum of 2in and 4in is 433.61998", because that is > 6in in points. > > You don't have to use units: > > The sum of 2 and 4 is \pgfmathparse{2 + 4}\pgfmathresult > > gives "The sum of 2 and 4 is 6.0". > > You can check if the input to \pgfmathparse did use units with the > \ifpgfmathunitsdeclared macro. So you can say: > > The sum of 2in and 4in is \pgfmathparse{2in + 4in}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > and you get "The sum of 2in and 4in is 433.61998, and units were > used." Whereas > > The sum of 2 and 4 is \pgfmathparse{2 + 4}, and > \ifpgfmathunitsdeclared > units were used. > \else > units were NOT used. > \fi > > gives "The sum of 2 and 4 is 6.0, and units were NOT used." > > Without a more specific question it's hard to answer. Hope this > helps. > > Matthew > > > On Jul 29, 2009, at 7:19 AM, waterloo wrote: > > I am reading 2.0 manual , can not understand the following sentence > in `49.1 Commands for Parsing Expressions' . > You can check whether an expression contained a unit using the TEX > if \ifpgfmathunitsdeclared. > After a call of \pgfmathparse this if will be true exactly if some > unit was encountered in the > expression. > > What does it mean ? > Thanks >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 > 30Day > trial. Simplify your report design, integration and deployment  and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobjjuly_______________________________________________ > pgfusers mailing list > pgfusers@... > https://lists.sourceforge.net/lists/listinfo/pgfusers > >  > Matthew Leingang > Clinical Associate Professor of Mathematics > leingang@... > > > > >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 > 30Day > trial. Simplify your report design, integration and deployment  and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobjjuly_______________________________________________ > pgfusers mailing list > pgfusers@... > https://lists.sourceforge.net/lists/listinfo/pgfusers  Matthew Leingang Clinical Associate Professor of Mathematics leingang@... 
From: waterloo <waterloo2005@gm...>  20090729 13:55:21
Attachments:
Message as HTML

How to compute \pgfmathparse{54pt/3cm*2.1} \pgfmathresult to get 1.32852 ? Thanks 2009/7/29 Matthew Leingang <leingang@...> > Yes, in section 49.1 you have > > "The result stored in the macro \pgfmathresult is a decimal without units. > This is true regardless of whether the ⟨expression ⟩ contains any unit > speciﬁcation. But, any units speciﬁed will be converted to points ﬁrst." > > Matthew Leingang > > > > On Jul 29, 2009, at 8:53 AM, waterloo wrote: > > This is why ? 1.32852 \pgfmathparse{54pt/3cm*2.1} \pgfmathresult >> >> Thanks >> >> 2009/7/29 Matthew Leingang <leingang@...> >> Hi, >> >> I'm not sure if you're confused about TeX \if's or the way the pgf math >> parser works. The thing about \pgfmathparse is it doesn't produce any >> output, it stores results in macros. So the code >> >> The sum of 2in and 4in is \pgfmathparse{2in + 4in}. >> >> will result in "The sum of 2 in and 4in is ." The \pgfmathparse macro >> puts the result in \pgfmathresult, so if you wanted the result, you'd have >> to say it as >> >> The sum of 2in and 4in is \pgfmathparse{2in + 4in}\pgfmathresult. >> >> and you get "The sum of 2in and 4in is 433.61998", because that is 6in in >> points. >> >> You don't have to use units: >> >> The sum of 2 and 4 is \pgfmathparse{2 + 4}\pgfmathresult >> >> gives "The sum of 2 and 4 is 6.0". >> >> You can check if the input to \pgfmathparse did use units with the >> \ifpgfmathunitsdeclared macro. So you can say: >> >> The sum of 2in and 4in is \pgfmathparse{2in + 4in}, and >> \ifpgfmathunitsdeclared >> units were used. >> \else >> units were NOT used. >> \fi >> >> and you get "The sum of 2in and 4in is 433.61998, and units were used." >> Whereas >> >> The sum of 2 and 4 is \pgfmathparse{2 + 4}, and >> \ifpgfmathunitsdeclared >> units were used. >> \else >> units were NOT used. >> \fi >> >> gives "The sum of 2 and 4 is 6.0, and units were NOT used." >> >> Without a more specific question it's hard to answer. Hope this helps. >> >> Matthew >> >> >> On Jul 29, 2009, at 7:19 AM, waterloo wrote: >> >> I am reading 2.0 manual , can not understand the following sentence in >> `49.1 Commands for Parsing Expressions' . >> You can check whether an expression contained a unit using the TEXif >> \ifpgfmathunitsdeclared. >> After a call of \pgfmathparse this if will be true exactly if some unit >> was encountered in the >> expression. >> >> What does it mean ? >> Thanks >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 >> 30Day >> trial. Simplify your report design, integration and deployment  and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. >> http://p.sf.net/sfu/bobjjuly_______________________________________________ >> pgfusers mailing list >> pgfusers@... >> https://lists.sourceforge.net/lists/listinfo/pgfusers >> >>  >> Matthew Leingang >> Clinical Associate Professor of Mathematics >> leingang@... >> >> >> >> >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 >> 30Day >> trial. Simplify your report design, integration and deployment  and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. >> http://p.sf.net/sfu/bobjjuly_______________________________________________ >> pgfusers mailing list >> pgfusers@... >> https://lists.sourceforge.net/lists/listinfo/pgfusers >> > >  > Matthew Leingang > Clinical Associate Professor of Mathematics > leingang@... > > > > 
From: Matthew Leingang <leingang@co...>  20090729 13:44:30

On Jul 29, 2009, at 8:46 AM, waterloo wrote: > Thanks . > 1. \ifpgfmathunitsdeclared is a command of the TeX ? Yes, it is a special kind of macro known as a conditional. You might want to read about conditionals (p. 207 of the TeXbook) and the \newif command. > 2. I can not understand the syntax of the sentence: > "After a call of \pgfmathparse this if will be true exactly if some > unit was encountered in the expression. " > The grammar and syntax of it are right ? I'll substitute in the antecedent: "After a call of \pgfmathparse, \ifpgfmathunitsdeclared will be true [that is, this test will succeed] exactly if some unit was encountered in the expression." But you might be going down a rabbit hole. TikZ is designed to add another layer of abstraction between the user and all those PGF codes, so you may not need to do all this. It's often fruitful to say "I want to do X. I'm trying Y, but I'm having trouble with Z." If there is a better way to do X than Y people will tell you, but if all you ask about is Z you might not be able to even use the result. So what is it you want to do? Matthew  Matthew Leingang Clinical Associate Professor of Mathematics leingang@... 
From: waterloo <waterloo2005@gm...>  20090729 13:59:40
Attachments:
Message as HTML

Good advice. I just want to grasp pgf deeply. Because I use latex to note, I often need to draw a picture . PGF is a new thing to me , I don't know which part is necessary, which part is less used . Thanks > But you might be going down a rabbit hole. TikZ is designed to add another > layer of abstraction between the user and all those PGF codes, so you may > not need to do all this. It's often fruitful to say "I want to do X. I'm > trying Y, but I'm having trouble with Z." If there is a better way to do X > than Y people will tell you, but if all you ask about is Z you might not be > able to even use the result. So what is it you want to do? > > Matthew > > >  > Matthew Leingang > Clinical Associate Professor of Mathematics > leingang@... > > > > 