USETEMPLATE

From MusiCAD

USETEMPLATE is a template function that you can use in a layout template to use another template.

Syntax:

   USETEMPLATE();
   USETEMPLATE( templateName );
   USETEMPLATE( template name, condition );
   USETEMPLATE( templateName, condition, otherTemplateName );

Instead of an existing template you can use 'abort' when the execution of the template needs to be aborted. An assignment can also be used instead of a template: parameter=value

Conditions

Conditions are constructed as var operator value with

var

a property of the current melody (such as note size, line spacing) or
result of calculating the melody (such as number of lines/bars, whitespace).

operator    '=, >, < or ' <>
value the value to be tested for the property in question

Examples

To test whether at least one lyric type is being used, and if so, run the template mc-textbelow which will place all lyrics below the bar and the chords above it (assuming that mc-textbelow takes care of that.

In a template you use:

 !# USETEMPLATE( mc-textbelow, nLyrics>0 )

A template that places 4-part choir parts on two staves and vice versa:

 !# REQUIRE( nParts=4, #errNeed4Parts );
 !# USETEMPLATE( mc-4on2, nStaffs=4, mc-4on4 );

First it is checked whether there are exactly 4 parts present, and depending on the number of bars, the staffs are set to 2 or 4 bars. Instead of the literal text for the error message Only possible with 4 parts it says #errNeed4Parts which retrieves the text from the translation file.

To reapply the last applied layout template via layout templates use:

 !# USETEMPLATE()

By default, the paste button is linked to a template mc-favorite that applies it.