Create Style, Example 3: Numbering Style
The following comes from an actual question posed to the DuxUser on-line forum.
The problem: We produce a lot of double-sided documents where we wish to begin with Roman Page Numbers, as in i, ii, iii, iv, etc., but then wish to switch to Arabic Numbers, as in 1, 2, 3, 4. However, we always want to start the Arabic numbered pages on an odd (right hand) page. Also, if the preceding (Roman numbered page) contains no text, we do not want it to be numbered.
Create a new document (using File: New). Use an existing DBT template that is as close to your requirements as possible. For this example we are assuming that your selected template contains no "initial" style (as you will see).
We wish to begin all documents with Roman numbers. We can do this in two ways.
- Go to the Layout menu, select Page Numbering, and in the dialog that comes up, leave the Start Page Numbering at 1, and select the "Roman" radio button. This will insert two codes into our document - [pv1] and [pntr] which mean, Start Page Numbering at 1, and make them Roman Numbers.
- Go to the Document menu, and select Add Style. Before you proceed, look in the list of existing styles to see if there is one called "initial". For this example, we assume there will not be. So, in the "New Style Name" text box, type the word "initial", exactly as shown but without the quotes. Press the OK button, and a new dialog appears called "Edit Style Codes".
With your cursor In the "Beginning Codes:" text box, hold down the Ctrl key, and press the left square bracket. A pair of square brackets will appear in the text box, with your cursor between them. Type "pv1", (no quotes), then press the End key to place your cursor to the right outside the Code. Hold down the Ctrl key again, press left square bracket, and between the brackets type "pntr" (no quotes). Tab to the OK button and press it.
So what is the difference between first and second method, since both will result in Roman numbers in our document?
- The codes we have entered in the first method will show up in Coded View (Alt + F3 toggle).
- They will NOT show up using the second method. Therefore there is less risk of someone accidentally deleting them. "initial" is a special style name assigned specifically for templates to set the default parameters for a document.
We want to set up our Roman numbered pages using the second method. With that done, we can now actually create a new template that includes our new "initial" style. (See Document: Create Template.) You will need to give your new template a meaningful name. In this case we will call it, "Hotel Room Details". Once you have created the template, close this current document so that you can check your work.
To do that, start a new document, and this time the template, "Hotel Room Details" should be in our list.
To be sure that what we have done so far works, type in some text, and make sure that Roman numbers appear on the pages.
After creating three pages, how do we make the fourth page (which has no text) totally blank, and begin the fifth page with an Arabic number one?
At the very end of the Roman numbered section, we would place these codes in the following order.
[svpnp0:0] Do not number left or right hand pages. (That stops numbering on the blank page.)
[sdo] Advance to an odd (right hand) page.
[pg1] Begin numbering at 1.
[pnta] Make that numbering Arabic.
[svpnp2:2] Number odd and even pages.
But ouch! That is a lot to remember every time you do one of these Hotel Room things!
The solution is to create a Style to do all of that work.
From the Document menu, select "Add Style". In the "New Style Name" box type a meaningful name, all as one word, like "ArabicRightHand" (without the quotes).
Press the OK button, and up will pop the "Edit Style Codes" dialog. In the same way as you entered codes for the Roman numbering, enter the above codes into the "Beginning Codes"box using Ctrl+[ before entering each code: svpnp0:0 sd0 pg1 pnta svpnp2:2
There is no need to type anything into the "Ending Codes" box. Press OK.
Now we have a style called ArabicRightHand, but we are not quite finished.
First, you might want to test the style. Type some text at the beginning of the document, place your cursor at the end of the would-be Arabic numbered section, and from the Layout Menu, select Apply Style, then select ArabicRightHand. If it does not work as expected, go back using Document: Modify Style where you can rectify any mistakes, then test it again.
Finally, once your new ArabicRightHand style is working, you want to save it into your custom template. Go to the Document Menu, select "Create Template". Navigate down the list to "Hotel Room Details" (the template you created earlier) and press OK. When asked if you wish to replace the existing template, select YES. When asked if you wish to save codes and text, select NO. This saves your new style into the custom template, but not the text you created just to test it.
You should now have a template which will begin with Roman numerals, then, when you apply the ArabicRightHand style at the correct place in your document, the next text will begin on a right hand page with Arabic numbers.