About Arbortext Styler > Defining Page Layout > Side by Side Alignment
  
Side by Side Alignment
It is possible to format two or more elements side by side in output, rather than the second element always following the first and appearing below it. This type of formatting has many uses, for example graphics aligned next to text for purposes of illustration, or side heads or titles.
To achieve side by side formatting, specify in the stylesheet that the first element (current element) should be displayed to the side of the element that follows it in the source XML file (following element). This setting is configured in the Side by side category for the Elements list, by giving the Align side by side with following field a value of Yes. You may then set appropriate measures to ensure the required distance between each element in output. The following elements do not have to have any special side by side properties configured.
All side by side properties must be specified on the same object. They cannot be combined from multiple objects. For example, a context may derive all side by side properties from a property set (or condition), but it should not set some properties explicitly and derive others from a property set (or condition).
The current element must precede the following elements in the source XML file. However, the current element may be formatted to either the right or the left of the following element in output.
The following sections provide some examples on using side by side formatting to achieve certain effects. Sample files and stylesheets that demonstrate these examples can be found at Arbortext-path/samples/Styler/SideBySide.
Example: Side Titles
This example demonstrates how to output the title of a section next to the content of the section, instead of above it.
Within section, the title element is the current element and will be given side by side alignment properties. The para elements are the following elements. It is possible to format title to appear on either the left or the right of the content of the para elements. In this example it will appear on the left, as shown below:
This image displays the title of a section next to paragraphs of text in that section
Refer to the samples sidehead/sidehead_left.xml and sidehead/sidehead_left.style in the samples directory for the settings necessary to format a section in this way.
The sample stylesheet is configured to use PTC ALD as its print engine. Leave this setting in place while you try this example.
1. For the section element, go to the Indent category and configure a left indent large enough to accommodate the length of the title text plus any further gap that is desired. In the sample stylesheet the indent is set to 15pc relative to the parent left indent.
This step will ensure that all the content of the section starts at 15pc from the parent left indent. You therefore do not have to set the same indent for each of the separate child elements of section.
2. For the title in section context, configure the following settings in the Side by side category:
Align side by side with following: Yes
Placement: Left
Horizontal offset: -15pc
Note that the negative horizontal offset for the title will offset the left indent configured for the rest of the content of the section. The title will start at the parent left indent of section.
Width: 13pc
Setting the width of the title to 13pc with reference to the section’s left indent of 15pc implies a 2pc gap between the end of the title text (plus any added gap) and the start of the content of the following paragraph.
Horizontal gap: 0pc
As best practice, specify a gap of 0 to apply margins to the block. Set indents for the following content element to create the gap wherever possible.
In FOSI and XSL-FO print/PDF outputs, a non-zero gap will cause unintended results when you are creating a non-wrapping alignment.
In PTC ALD print/PDF and HTML outputs, a gap specified with a non-zero value will only have an effect if it is larger than the gap that results from the indent settings for the following content element.
3. For the para element, go to the Indent category and set the left indent values to 0pc. This will ensure that the content of para starts at the end of the width measurement specified for the title element.
4. Preview your document for print via the PTC ALD engine. You will see that the title and para elements in a section are aligned as you have described. The title of the section will start at the parent left indent. The paragraphs in the section will start at 15pc from the parent left indent.
Activate the block guides and the grid in the PTC ALD Preview window by clicking the Show / Hide the blocksThe Show / Hide the blocks icon - a rectangle containing 4 blue horizontal lines and The Show / Hide the grid icon - a white rectangle containing red dots buttons. Select the unit of measurement you have used from the drop down list The units drop down list - a box containing the word Points and a drop down arrow. This will display all the blocks you have configured with your side by side settings.
Example: Side by Side Procedure
This example demonstrates how to output the steps in a procedure with informative graphics next to the text of the step. The example assumes that the source document type contains the following markup (for illustration purposes only):
<!ELEMENT procedure (title?, step+)>
<!ELEMENT step (info?, para+)>
<!ELEMENT info (warning | caution | figure)+>
Within step, the info element is the current element and will be given side by side alignment properties. It will contain a figure. The para elements are the following elements. It is possible to format info to appear on either the left or the right of the content of the para elements. In this example it will appear on the right, as shown below:
This image displays two steps of a procedure with a graphic placed to the right of them.
Refer to the samples procedures/procedure_right.xml and procedures/procedure_right.style in the samples directory for the settings necessary to format a procedure in this way. The graphics are located at Arbortext-path/application/com.arbortext.sma/graphics.
The sample file is formatted via the Default Page Set in its associated stylesheet. The page set defines a page width of 8.5 in. It has left and right margins of 1in each, providing a content area of 6.5in.
1. For the info element, set the Structure Type to Block in the Breaks category.
Configure the following settings in the Side by side category:
Align side by side with following: Yes
Placement: Right
Horizontal offset: 0pc
Width: 19pc
Horizontal gap: 0pc
Here you have specified that info should be aligned to the right of the following elements (para). There is 19pc of available horizontal space for info, and no offset value means it should fill that horizontal space. Note that the sample XML file specifies scalefit=”1” for the graphic, which scales the graphic to fill the available space.
2. For the first para in step and not first para in step contexts, set the Structure Type to Block in the Breaks category.
Configure the following settings in the Side by side category:
Align side by side with following: No
Configure the following settings in the Indent category:
Right: 20pc relative to Parent right indent
Here you have confirmed that the para element will be positioned to the left of the info element. para will be aligned from the right of the content area on the page, and will start at 20pc from the right margin. With reference to the width of 19pc set for info, this implies that an additional 1pc of space will separate the right edge of the para from the graphic in the info element.
3. For the first para in step context, configure the numbering for the steps in the procedure. Ensure that the numbering restarts at procedure.
4. For the title in figure context, set the Spacing After field in the Spacing category to a suitable value. This will ensure that the figure title is separated from any text or graphic that comes beneath it.
You must avoid setting a Spacing before value for the info, figure, and graphic elements or the first para in step context. The tops of the graphics may not align with the top of the step text if a non-zero value is used here.
5. For the step element, configure the following settings in the Side by side category:
Align side by side with following: No
End all contained alignments: No
Here you have confirmed that all steps in a procedure will continue the side by side alignment settings. This includes those that don’t include their own graphics - the text of steps without their own graphics will immediately follow the text of the previous step. See step 2 in the sample file which aligns to the side of the graphic from step 1 in output.
Note that, for HTML outputs, you must set the End all contained alignments field to Yes to prevent graphics from overlapping. This is a bug in Internet Explorer 7.
6. Preview your document for print via the PTC ALD engine. You will see that the info and para elements in a step are aligned as you have described.
Activate the block guides and the grid in the PTC ALD Preview window by clicking the Show / Hide the blocksThe Show / Hide the blocks icon - a rectangle containing 4 blue horizontal lines and The Show / Hide the grid icon - a white rectangle containing red dots buttons. Select the unit of measurement you have used from the drop down list The units drop down list - a box containing the word Points and a drop down arrow. This will display all the blocks you have configured with your side by side settings.
Some suggested variations on the styling defined here:
You may want the text of steps without their own graphics to be placed vertically below the graphic of the preceding step. In this case, set the value of the End all contained alignments field to Yes for step.
If a step’s text is long enough to extend below the graphic it is aligned with, you may want the text to wrap around under the graphic. To achieve this effect, modify the original styling as follows:
For the info element, set the Horizontal gap field in the Side by side category to a non zero value, e.g. 1pc.
For the first para in step and not first para in step contexts, remove the right indent settings in the Indent category.
In this case you do not need to use edited source to set a left indent for FOSI and XSL-FO outputs.
As noted earlier, the title in figure context specifies a Spacing after value. In all outputs, this controls the space after the title when what follows is a new step or a new element within the same info parent. It does not impact the space after the title when step text wraps beneath the title. To control that space, add a Spacing after value to the info element. Use a low precedence so it does not affect the spacing after a new step following the title.
Note that HTML outputs add vertical space values together rather than merging them. This means that having a Space after value set for both info and title in figure will create more space than is desired. In the procedure_right.style sample, the info element sets Spacing after to 3pc, but has HTML File-specific properties that set it to 0pc.
If an HTML output is configured to format list items as tables, then all the lines of a list items are indented the same. A list that’s adjacent to the current (aligned) element will only wrap at a list item boundary.