File:  [LON-CAPA] / loncom / html / adm / help / tex / Variables_in_the_Text_Block.tex
Revision 1.7: download - view: text, annotated - select for diffs
Mon Jun 12 17:25:06 2017 UTC (7 years, 2 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, HEAD
- Add width for inline image.

    1: \label{Variables_in_the_Text_Block}
    2: 
    3: \index{variables in text block}
    4: Once you've defined variables in the \textbf{Script}, you can display them in
    5: the \textbf{Text Block}. For example, using the previous three-line script
    6: we've created so far, you can place the following in the \textbf{Text Block}:
    7: 
    8: \begin{verbatim}
    9: See the 3: $variable<br />
   10: See the string: <b>$stringVar</b><br />
   11: \end{verbatim}
   12: %
   13: \begin{figure}
   14: \begin{center}\includegraphics[width=0.70\paperwidth]{numericalResponseVarInText}\end{center}
   15: 
   16: 
   17: \caption{Result of Variables in the Text Block\label{Result of Variables in the Text Block Figure}}
   18: \end{figure}
   19: If you save that and hit \textbf{View}, you should get what you see in figure
   20: \ref{Result of Variables in the Text Block Figure}. Note how the {}``\$variable''
   21: was turned into a 3, and the {}``\$stringVar'' was turned into {}``I have
   22: a variable with the value 3.''
   23: 
   24: If you are generating numbers using a formula which includes a division operation, it is advisable to format your output.
   25: For example, if \$variable=1/3, it will display with too many digits. You can adjust the format
   26: using the \texttt{num} output tag \index{num output tag} \index{format numbers in text block} 
   27: described in the Output Tags section \ref{Authoring_Output_Tags}
   28: 

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