How do I embed images in PGML solution? I know how to embed images in PGML text by wrapping the PG command in BEGIN_TEXT and END_TEXT, but in solution if I do this the images will be visible to the students.
Thanks.
[@ ... @]
command can be used to do this. For example:
[@ image(insertGraph($graph), width=>200,height=>200,tex_size=>480) @]*where
$graph
is a graph object created from the macros in PGgraphicmacros.pl
would do it.
Here is the meaning of the stars that follow the command. The command between the [@ ... @]
is passed to Perl for execution, and the result is treated as a string that will be inserted into the PGML output. The stars control how that string is processed prior to insertion.
"Hi<br>there"
, you would get exactly that in the output (in particular, the <br>
would not operate as an HTML line break, and you would see the actual less-than, br, and greater than in the output.WIth one star, no escaping is performed, and the result is used as it is. So if the result of the command is already HTML formatted, you would want to use the star. In the example above, since the
image()
command returns formatted results already, you use the star to prevent PGML from escaping the formatting that is already part of the result.
With two stars, the result is processed for additional PGML commands. So if the result returned PGML that needed to be parsed and processed, you would use two stars.
Hope that clears things up a bit.