How to auto-number a publication
Skills required | XML |
---|---|
Time required (minutes) | 15 |
Intended audience | Developer |
Difficulty | Easy |
Category | Document |
Objective
This tutorial demonstrates the auto-numbering for headings, paragraphs, appendices, and objects such as tables and images, and the ability to reference those numbers, for example, “see paragraph x.x”, confident that the referential integrity will correctly export to Word.
Prerequisites
To complete this tutorial requires:
- PageSeeder administrator access to a server with PageSeeder version 6.2 or later installed.
All the files for this tutorial are on Github .
Tutorial
Project setup and installing configuration bundle
- Login to PageSeeder as an administrator.
- Go to the project where you would like to install these capabilities. Alternatively create a new project by clicking the
System administration button at top right. Then click on New project under Projects & Groups and enter a project name, plus any description, then Submit. - Click the
Project administration button at the top. - Select Template files from the left menu and click the
Create button at the bottom of the page to open the Samples dialog. - Install a configuration bundle – Click the
Bundle button, then in the Bundle type field, select Document type from the dropdown. - Click the Select button to the right of a bundle – for this example, select Basic auto-numbered publication.
- Install the bundle under the root document type for your publication (e.g
references
, shown in the Document type field on the right of the dialog). Click Install.
Verify package content - project configuration files
In the Template files page check the files as follows.
Export process
The psml/references/export
folder (or the document type you specified) contains the following files:
Filename | Description |
---|---|
build.xml | Custom ANT script for exporting to docx. |
psml-to-docx.xsl | XSLT that adds the inline labels necessary for figure / table captions to auto-number in docx. |
Labels
The label
folder contains the following file:
Filename | Description |
---|---|
label-config.xml | The label-config.xml , contains all the available labels for a project. |
You can select Labels from the left menu and the following should be displayed:
Label | Type | Description |
---|---|---|
appendix | document | Identify appendix for alternate numbering. |
figure-caption | block | To identify text for a figure or image caption. |
table-caption | block | To identify text for a table caption. |
asciimath | inline | Not required for this tutorial. |
tex | inline | Not required for this tutorial. |
Publication types
Select Template configuration from the left menu, then Publication types tab. In the first column, it should show the report publication type, which includes these files:
Filename | Description |
---|---|
publication-config.xml | The configuration file that determines numbering in PageSeeder, including heading, paragraph, and figure / table numbering. |
pdf-export-config.xml | The configuration file that determines the formatting of PSML as PDF, see Exporting to PDF. |
word-export-config.xml | The configuration file that determines the formatting of PSML as DOCX, see Export Microsoft Word docx config usage. |
word-export-template.docx | The default DOCX template which you can customize. |
Click edit next to report in the Config column and the following publication-config.xml
appears. It can be customized for your own numbering schemes, see Publications and publication types. After saving changes click the reload button in the last column to apply them.
<publication-config> <toc title-collapse="always" block-labels="table-caption,figure-caption"/> <levels xref-relative-to="heading" para-relative-to="6" /> <numbering skipped-levels="strip"> <schemes> <scheme level="1" type="decimal" format="[1]" /> <scheme level="2" type="decimal" format="[1.][2]" /> <scheme level="3" type="decimal" format="[1.][2.][3]" /> <scheme level="4" type="decimal" format="[1.][2.][3.][4]" /> <scheme level="5" type="decimal" format="[1.][2.][3.][4.][5]" /> <scheme level="6" type="decimal" format="[1.][2.][3.][4.][5.][6]" /> <scheme level="7" type="loweralpha" format="[(7)]" element="para" /> <scheme level="7" type="decimal" format="[Table 1-][7]" block-label="table-caption" element="para"/> <scheme level="7" type="upperalpha" format="[Fig 1-][7]" block-label="figure-caption" element="para"/> <scheme level="8" type="lowerroman" format="[(8)]" element="para" /> <scheme level="9" type="upperroman" format="[(9)]" element="para" /> <scheme level="10" type="upperalpha" format="[(10)]" element="para" /> </schemes> </numbering> <numbering skipped-levels="strip" document-label="appendix"> <schemes> <scheme level="1" type="upperalpha" format="[Appendix 1]" /> <scheme level="2" type="decimal" format="[1-][2]" /> <scheme level="3" type="decimal" format="[1-][2.][3]" /> <scheme level="4" type="decimal" format="[1.][2.][3.][4]" /> <scheme level="5" type="decimal" format="[1.][2.][3.][4.][5]" /> <scheme level="6" type="decimal" format="[1.][2.][3.][4.][5.][6]" /> <scheme level="7" type="loweralpha" format="[(7)]" element="para" /> <scheme level="8" type="lowerroman" format="[(8)]" element="para" /> <scheme level="9" type="upperroman" format="[(9)]" element="para" /> <scheme level="10" type="upperalpha" format="[(10)]" element="para" /> </schemes> </numbering> </publication-config>
If you prefer a different name to report, select Template files from the left menu, scroll down to the report folder and select Rename from the right drop-down menu. Change the name and click Rename. Remember to substitute the new name whenever this tutorial mentions report.
Document types
The Template configuration page should display these PSML document types:
Document type | Description |
---|---|
default | The content of a publication. Includes a CSS style to display footnote and endnote references as superscripts in the user interface. |
endnotes | Endnotes for a publication. |
footnotes | Footnotes for a publication. |
XRef configuration
Select Edit XRef configs (top right).
Filename | Description |
---|---|
xref-config.xml | The Xref configuration for the import of cross-references including footnotes, endnotes, citations, and more as listed below. |
The following xref configs should be listed (see Xref config):
- footnote – to insert a footnote reference.
- endnote – to insert an endnote reference.
- para – to create an xref to a para with the number of the paragraph as the title. For example, “see clause 14.2.a” where the xref will automatically adjust if the paragraph number changes.
- internal-para – when an xref source and destination are both under the same parent number and can therefore use “relative references”. For example, “see (a)” instead of “see clause 14.2.a”.
- numbered-heading – to reference to a numbered heading. For example, “see section 14 Privacy” where the xref will automatically adjust if the heading number or text changes.
- caption – to create an xref to a numbered image or table caption.
Creating a publication
As an alternative to this step use a preprepared example publication as follows:
- In PageSeeder go to the project from Step 1 and create a new group by clicking the
Project administration button at the top. Then select Create group from the left menu and enter a group name, plus any description, then Submit and Go to group. - Click Group documents (folder icon) at the top, then click the documents folder.
- Select Upload document from the (+) menu top right and drag the
documents-[date].zip
file (downloaded from Github - see link under Prerequisites) to the upload dialogue. - Click the Unzip icon next to this zip file.
- Click the Continue button at the bottom of the dialogue.
- Click the Confirm and upload button and wait for the “Successfully uploaded” message, then click Close.
- Click the “System Report” folder, then click the “System Report” document.
- Click the Document information icon on the right, click Make this document a publication, ensure there is a Publication ID and for this example, select Publication type "
report
". Click Submit then Save and refresh the page in your browser.
Create a publication root document and content as follows:
- In PageSeeder go to a group under the project from Step 1. Alternatively create a new group by clicking the
Project administration button at the top. Then select Create group from the left menu and enter a group name, plus any description, then Submit and Go to group. - In this group create or open an existing document of the root type you selected previously (e.g.
references
). - Click the Document information icon on the right, click Make this document a publication, ensure there is a Publication ID and for this example, select Publication type "
report
". Click Submit then Save. - If there is no existing content, double-click in the root document, click Browse and create a document (for example
default
type), select it and save. On the root document press Ctrl-S to save everything. - Click a content document, add some headings and paragraphs if required and test the auto-numbering by making them numbered with the
Toggle auto-number icon in the edit toolbar. Press Ctrl-S to generate numbers. - Make the top level heading in the content document numbered and press Ctrl-S. Click the Document information icon on the right, click appendix next to Document labels, then click the Save button.
- Refresh the page in your browser and “Appendix A” will appear before the first heading, with "A-" prefixing the numbering on other headings. Remove the appendix label, save, refresh and the numbering will revert.
Export as a Word document
- Go to any document in your publication.
- Click the Document export (rocket) icon in the left margin.
- Under the Choose an export action drop down, select Export publication as custom DOCX and click Run.
- Open the document in Microsoft Word and see how the auto-numbering for headings, paragraphs, appendices, tables, images, and the references to these are displayed by Word.
Export as a PDF document
- Go to the root document in your publication.
- Click the Document information icon on the right, click + next to Document labels, type publication, then click the Save button.
- Click the Document export (rocket) icon in the left margin.
- Under the Choose an export action drop down, select Export publication as PDF and click Run.
- Open the document in Microsoft Word and see how the auto-numbering for headings, paragraphs, appendices, tables, images, and the references to these are displayed in PDF.