\documentclass[aspectratio=1610]{beamer}
\usepackage{amsmath}
\begin{document}
\def\function(#1){ 96* (#1)-16 *(#1)^2 }
%1. I am trying to condense the following two lines
\pgfmathparse{3+\function(1)}
\let\z\pgfmathresult
z result is \z %
%2. I would like store the result of the previous line in a 'variable'
%The following doesn't work
\def\myfp(#1,#2){\pgfmathparse{#1} \let\#2\pgfmathresult}
\myfp(3+ \function(1),\z)
% /This yields the right answer BUT z Result is \z ..... Yields error
%3. Why does the following mess up%
\let\z7\pgfmathresult
z7 result is {\z7}
%4. PLEASE point me to relevant documentation!
\end{document}
답변1
질문을 이해했는지 잘 모르겠습니다. 그러나 매크로를 호출하려는 경우에는 \z7
매크로 이름에 숫자가 포함될 수 없기 때문에 작동하지 않습니다. 그리고 도착하려면 백슬래시를 제거해야 했습니다.
\documentclass[aspectratio=1610]{beamer}
\usepackage{amsmath}
\begin{document}
\def\function(#1){ 96* (#1)-16 *(#1)^2 }
%1. I am trying to condense the following two lines
\pgfmathparse{3+\function(1)}
\let\z\pgfmathresult
z result is \z %
%2. I would like store the result of the previous line in a 'variable'
%The following doesn't work
\def\myfp(#1,#2){\pgfmathparse{#1} \let#2\pgfmathresult} % <removed \ before #2
\myfp(3+ \function(1),\z)
% /This yields the right answer BUT z Result is \z ..... Yields error
%3. Why does the following mess up%
%\pgfmathparse{\z*7}
\let\zseven\pgfmathresult
z7 result is {\zseven}
%4. PLEASE point me to relevant documentation!
\end{document}