Numbers in Sysquake for LaTeX?

23 views
Skip to first unread message

DJ

unread,
Oct 19, 2009, 6:58:35 AM10/19/09
to Sysquake
Hi I have a little problem in sysquake...

I would like to create files, where I input the variables in the
beginning, so I only have to update numbers in ONE place, without
getting really long calculations. I have following "made up" procedure
that I would like to get to work:

e.g.

\newcommand{\mynewparameter}{200}
%SETS \mynewparameter == 200

\newcommand{\additionalnewparameter}{$\sqexpr{1.4*\mynewparameter}$}
%SETS \aditionalnewparameter == 200*1.4

And this works fine, but I can not use "\additionalnewparameter" in
further calculations in sysquake; e.g.

$\sqexpr{1.4*\additionalnewparameter}$! Then I get the ??sysquake??-
error...!

Likewise I get the ??sysquake?? if I use my variables, defined outside
the sysquake environment, are used, e.g.:

\begin{sysquake}
if (\mynewparameter<\additionalnewparameter)
z = 1
else
z = 2
end
\end{sysquake}

but it works fine if I just use number and not predefined commands?

I think that the output from sysquake is "not a number"? and that you
can not import your variables from latex into sysquake, but I am not
sure... Does anyone have ideas on how to bypass this? It would really
help a lot!

Thanks!

Regards,
Daniel

Yves Piguet

unread,
Oct 19, 2009, 7:09:43 AM10/19/09
to sysq...@googlegroups.com
Hello,

> \newcommand{\mynewparameter}{200}


> \newcommand{\additionalnewparameter}{$\sqexpr{1.4*\mynewparameter}$}

> $\sqexpr{1.4*\additionalnewparameter}$! Then I get the ??sysquake??-

You can't use (La)TeX variables in Sysquake code. Sysquake code is a
verbatim block of text for LaTeX. But you can define Sysquake
variables at the beginning and use them in other blocks of code:

\begin{sysquake}
mynewparameter = 200;
additionalnewparameter = 1.4 * mynewparameter;
\end{sysquake}

...

$\sqexpr{1.4*additionalnewparameter}$

Hope this helps,

Yves

Yves Piguet

unread,
Oct 19, 2009, 8:31:06 AM10/19/09
to sysq...@googlegroups.com
> This yields that I have to do all calculations in the beginnning of
> the document and just use the results further down in the text (to
> keep system in larger files)... A little more complicated, but I
> guess it could work...

When I wrote "at the beginning", I meant before the variables are
used. You can split Sysquake code into as many \begin{sysquake}...\end
{sysquake} blocks as you want and put them wherever you want in the
LaTeX file(s). Sysquake code is interpreted in the same order as the
blocks where it is placed. So I don't see any difference with LaTeX
variables with that respect. LaTeX variables and Sysquake variables
have other differences, of course.

Best regards,

Yves

Daniel Justesen

unread,
Oct 19, 2009, 8:35:05 AM10/19/09
to sysq...@googlegroups.com
No, I just found out! It works great... It actually keeps the calculations much "simpler", as you can keep everything in "MatLAB"
 
Thanks.

DJ
Reply all
Reply to author
Forward
0 new messages