Formatting Images


[Home][Index][Previous][Next]
In the example on the previous page, the image code

{$IMG=Images/Proj30v45h.GIF}

caused the image to be placed at the left margin, with no text to the right of the image. This is the default behavior of the applet. There are, however, several ways to align images to make them fit into your questions more effectively.


The Align Token:

The ALIGN token is placed inside the image code string following the filename. Image alignment fall into two groups.

Images that are independent of the surrounding text (although the surrounding text may wrap around the images) use the ALIGN values NO_ALIGN (the default), CENTER, LEFT, and RIGHT. The image codes for these strings generally appear on their own line in the question file (Failure to observe this convention may result in bizarre behavior!).

ALIGN=NO_ALIGN
Causes the image to be placed at the left edge of the quiz window, with no text to its right. Image code strings with this alignment should appear on their own line in the question file, with no text to their right. This is the default behavior, and the token ALIGN=NO_ALIGN results in the same behavior as no ALIGN token at all.
ALIGN=CENTER
Causes the image to be centered between the left and right margins of the quiz window. Image code strings with ALIGN=CENTER alignment should start their own line in the question file, with no text to their right.
ALIGN=LEFT
Causes the image to be placed at the left edge of the quiz window, with text wrapped around the image to its right. (AppletQuiz will handle this text wrapping automatically - you do not need to do anything to your question text.) Image code strings with ALIGN=LEFT alignment should start their own line in the question file, although text may follow the image code on the same line.
ALIGN=RIGHT
Causes the image to be placed at the right edge of the quiz window, with text wrapped around the image to its left. (AppletQuiz will handle this text wrapping automatically - you do not need to do anything to your question text.) Image code strings with ALIGN=RIGHT alignment should start their own line in the question file, although text may follow the image code on the same line.

Images that are displayed within the surrounding text use the ALIGN values TOP (the default), BOTTOM, and MIDDLE: The image codes for these images generally appear within the line of text in which the images appear.

ALIGN=TOP
Causes the top of the image to align with the top of the surrounding text. This is the default behavior, and the token ALIGN=TOP results in the same behavior for image code strings within text as no alignment token at all.
ALIGN=BOTTOM
Causes the bottom of the image to align with the baseline of the surrounding text.
ALIGN=MIDDLE
Causes the middle of the image to align with the baseline of the surrounding text.


For Example:

\TITLE
Image Formatting Demo
\TF A T
{$IMG=Images/Proj30v45h.GIF}
The image above uses default formatting for image
codes that have their own line in the question file.
\TF A T
{$IMG=Images/Proj30v45h.GIF ALIGN=NO_ALIGN}
The image above uses ALIGN=NO_ALIGN. Notice that it
is formatted exactly like the preceeding question.
\TF A T
{$IMG=Images/Proj30v45h.GIF ALIGN=CENTER}
The image above uses ALIGN=CENTER. The image is
centered between the left and right margins, with no
text around it.
\TF A T
{$IMG=Images/Lens1.GIF ALIGN=LEFT}
The image (it is supposed to be a cross-section of 
a lens) to the left uses ALIGN=LEFT. The image is 
placed at the left margin and text is wrapped around 
it.
\TF A T
{$IMG=Images/Lens1.GIF ALIGN=RIGHT}
The image (it is supposed to be a cross-section of 
a lens) to the right uses ALIGN=RIGHT. The image is 
placed at the right margin and text is wrapped around 
it.
\TF A T
The image {$IMG=Images/Equation.GIF} in this question uses
default alignment, which means that its top is aligned
with the top of the surrounding text. 
\TF A T
The image {$IMG=Images/Equation.GIF ALIGN=TOP} in this 
question uses ALIGN=TOP, which means that its top is 
aligned with the top of the surrounding text, just like 
the preceding question. 
\TF A T
The image {$IMG=Images/Equation.GIF ALIGN=BOTTOM} in this 
question uses ALIGN=BOTTOM, which means that its 
bottom is aligned with the baseline of the surrounding 
text.
\TF A T
The image {$IMG=Images/Equation.GIF ALIGN=MIDDLE} in this 
question uses ALIGN=MIDDLE, which means that its 
middle is aligned with the baseline of the surrounding 
text.

The following applet runs this question file:

You need a Java-enabled browser to take this quiz.

[Home][Index][Previous][Next]
copyright © 1998 by Jerry L. Stanbrough - all rights reserved.
last update May 13, 1999 by JL Stanbrough (jstanbro@venus.net)