File:  [LON-CAPA] / loncom / html / adm / help / tex / Variables_in_the_Text_Block.tex
Revision 1.4: download - view: text, annotated - select for diffs
Wed Jun 26 08:14:55 2013 UTC (11 years, 1 month ago) by lira
Branches: MAIN
CVS tags: HEAD
editing author manual

\label{Variables_in_the_Text_Block}

\index{variables in text block}
Once you've defined variables in the \textbf{Script}, you can display them in
the \textbf{Text Block}. For example, using the previous three-line script
we've created so far, you can place the following in the \textbf{Text Block}:

\begin{lyxcode}
See~the~3:~\$variable<br~/>\\
See~the~string:~<b>\$stringVar</b><br~/>
\end{lyxcode}
%
\begin{figure}
\begin{center}\includegraphics{numericalResponseVarInText}\end{center}


\caption{Result of Variables in the Text Block\label{Result of Variables in the Text Block Figure}}
\end{figure}
If you save that and hit \textbf{View}, you should get what you see in figure
\ref{Result of Variables in the Text Block Figure}. Note how the {}``\$variable''
was turned into a 3, and the {}``\$stringVar'' was turned into {}``I have
a variable with the value 3.''

If you a generating numbers by a formula by division, you will want to format your output.
For example, if \$variable=1/3, it will display with too many digits. You can adjust the format
using the \textbf{num} output tag \index{num output tag} \index{format numbers in text block} 
described in section \ref{Authoring_Output_Tags}


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>