Hi Stuart,

Thanks for the tip. I eventually did the following:
1. Create the picture with E's (& R's) in the right places.
2. The randomization is for the number, so it comes out as E_1 etc. Same for 
resistance.
Which brings the following question? Is there a way to specify the font type 
and size?

Regards,
-hk


On Fri, Jan 18, 2019 at 7:56 PM Raeburn, Stuart 
<raeb...@msu.edu<mailto:raeb...@msu.edu>> wrote:
Hi HK,

As a work-around you could create an image file for each text label you wish to 
display, and include subscripts and superscripts when you create each image 
file.  You would then upload each file to your Authoring Space and publish.

Within the labelgroup inside the randomlabel item in the problem you would set 
the type attribute to image, and use something similar to:

<labelgroup name="EMF" TeXsize="\normalsize" type="image">
<location x="124" y="21" />
    <label description="E1">/res/fsu/hkng/path_to_images/e1label.png</label>
<location x="124" y="225" />
    <label description="E2">/res/fsu/hkng/path_to_images/e2label.png</label>
</labelgroup>

where /res/fsu/hkng/path_to_images/e1label.png and 
/res/fsu/hkng/path_to_images/e2label.png would be the locations of the 
published label images.

Notes:
1. randomlylabel.pm<http://randomlylabel.pm> uses the GD library to create the 
labeled image, and a call to image->stringFT() was added to the LON-CAPA code 
in randomlylabel.pm<http://randomlylabel.pm> rev. 1.19 (2004).  The comment 
logged with that commit is: "- added font support (I can't get ttf to work)"

2. The call to $image->stringFT() to use a TrueType Font (ttf) for a text label 
available in randomlylabel.pm<http://randomlylabel.pm> is not currently used 
because randomlabel.pm<http://randomlabel.pm> currently only supports 
specification of the first three arguments (x, y, text) of the six arguments 
which the perldoc for randomlylabel.pm<http://randomlylabel.pm> indicates would 
be possible for the LABEL item. The other three (unsupported by 
randomlabel.pm<http://randomlabel.pm>) are: font, color, direction.

3. The CPAN documentation for the GD library documents that the text label can 
contain UTF-8, as long as libgd has been compiled with TrueType support, and 
the appropriate TrueType font is installed on the system. In that case a 
superscript 1 could be included as &#185; and a superscript 2 could be included 
as &#178;


Stuart Raeburn
LON-CAPA Academic Consortium

________________________________________
From: LON-CAPA-users 
<lon-capa-users-boun...@mail.lon-capa.org<mailto:lon-capa-users-boun...@mail.lon-capa.org>>
 on behalf of H.K.Ng<http://H.K.Ng> <h...@fsu.edu<mailto:h...@fsu.edu>>
Sent: Friday, January 18, 2019 9:22 AM
To: Discussion list for LON-CAPA users
Subject: [LON-CAPA-users] subscript/superscript in randomlabel

Hi,
 Is there a way to display subscript/superscript in randomlabel? Tried a few 
things but none works. Thanks.

<randomlabel width="306" height="269" TeXwidth="75" bgimg="Graphics/21_25.png">
<labelgroup name="EMF" TeXsize="\normalsize" type="text">
<location x="124" y="21" />
    <label>E<sub>1</sub></label>
<location x="124" y="225" />
    <label>E2</label>
</labelgroup>
</ramdomlabel>

Regards,
-hk

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org<mailto:LON-CAPA-users@mail.lon-capa.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.lon-2Dcapa.org_mailman_listinfo_lon-2Dcapa-2Dusers&d=DwICAg&c=HPMtquzZjKY31rtkyGRFnQ&r=wTSZ5EgyXvEFGuAc4iHTrg&m=vKQOW2DjQJBkbpvdiivXEY2TJCoMqKj2wC87arzvQDc&s=y-WSGpNhtxSam9JCZu_uxbIlFMa6meyndyMqsi36_3w&e=
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Reply via email to