PTC ALD in Arbortext Styler > Components of Documents and Templates > Style Components > Paragraph Level Styling > Starting a Paragraph
Starting a Paragraph
As mentioned previously, a paragraph starts automatically when a chunk of content starts. When a paragraph starts in this way,PTC Arbortext Layout Developer applies a set of default properties to ensure text can be output.
There are other ways to instruct PTC Arbortext Layout Developer to start a paragraph:
By outputting a hard return
PTC Arbortext Layout Developer’s FOM has a tool for outputting text, formatting.write() and formatting.output(). To include a hard return:
where \n is the line break.
To apply style to the new paragraph created after the hard return:
where <paragraph> is markup referring to an PTC Arbortext Layout Developer tag that applies the styling.
formatting.write() outputs text exactly as declared, including special characters. formatting.output() processes text as it is written. For example:
formatting.write("<hello>"); inserts <hello> into the text.
formatting.output("<hello>"); inserts the markup <hello> into the text, which calls the PTC Arbortext Layout Developer tag named hello if it exists.
formatting.output() can be used to execute PTC Arbortext Layout Developer items such as PIs and show strings.
When using \n, it is difficult to know how many hard returns will be applied at a given point in complex templates. This could result in multiple empty lines in output.
With a record end command
Record end ends a line and starts a new paragraph. It can end the line in a number of different ways, for example ending the page, ending the column, or ending the line with a soft line break.
A record end command only applies the line end when there is content on the line. You can have a number of consecutive record ends without additional white space.
PTC Arbortext Layout Developer provides the FOM formatting method formatting.recordEnd() for this command, for example:
Where END_PARAGRAPH is an instruction to end the line by ending the paragraph. Line end options are specified in the fFormatting.RecordEndType constant.
Record end has other options to control the type of break and a condition for when to apply the break. As with a hard return, some style must be applied immediately after issuing the record end command.
formatting.paragraphStart() method
This method effectively issues a record end plus paragraph and text styling objects. It accepts a fParagraph object and a fStyle object, which provide default paragraph and style properties for the paragraph being started.
For example:
var p = new fParagraph;
var s = new fStyle;

p.leading = "30pt";
p.textAlign = fParagraph.ALIGN_CENTER;
p.marginTop = "60pt";

Refer to Text Styling for information about fStyle object usage.