Difference between revisions of "Documentation/OOoAuthors User Manual/Writer Guide/Working with Master Documents"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Combining several documents into a master document)
m (interwiki link added)
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{NeedsWork}}
+
{{DISPLAYTITLE:Working with Master Documents}}
This page was created by converting ODT to Mediawiki using Writer2MediaWiki.
+
[[de:DE/Dokumentation/OOo_2.x/Handb%C3%BCcher/Writer-Handbuch/Arbeiten_mit_Globaldokumenten]]
 
+
{{WriterMasterDocTOC|ShowPrevNext=block
 +
|PrevPage=Documentation/OOoAuthors User Manual/Writer Guide/Creating a bibliography
 +
|NextPage=Documentation/OOoAuthors_User_Manual/Writer Guide/Styles and master documents}}__notoc__
 
This is Chapter '''13''' of the '''OpenOffice.org 2.x Writer Guide''' (Third edition), produced by the [http://oooauthors.org/ OOoAuthors group]. A PDF of this chapter is available from the [http://documentation.openoffice.org/manuals/oooauthors2/ OOoAuthors Guides page] at OpenOffice.org.
 
This is Chapter '''13''' of the '''OpenOffice.org 2.x Writer Guide''' (Third edition), produced by the [http://oooauthors.org/ OOoAuthors group]. A PDF of this chapter is available from the [http://documentation.openoffice.org/manuals/oooauthors2/ OOoAuthors Guides page] at OpenOffice.org.
 
[[User_Manuals| &lt;&lt; User Manuals page]]<br>
 
[[Writer Guide| &lt;&lt; Writer Guide Table of Contents]]<br>
 
[[Writer Guide/Creating Tables of Contents, Indexes, and Bibliographies| &lt;&lt; Chapter 12 Creating Tables of Contents, Indexes, and Bibliographies]] &nbsp;&nbsp;|
 
&nbsp;&nbsp;[[Writer Guide/Working with Fields| Chapter 14 Working with Fields &gt;&gt;]]
 
 
  
 
= Why use a master document? =
 
= Why use a master document? =
Line 16: Line 12:
  
 
You can use several methods to create master documents. Each method has its advantages and disadvantages. Which method you choose depends on what you are trying to accomplish. The different methods are described in this chapter, along with suggestions on when to use each one.
 
You can use several methods to create master documents. Each method has its advantages and disadvantages. Which method you choose depends on what you are trying to accomplish. The different methods are described in this chapter, along with suggestions on when to use each one.
 
= Styles and master documents =
 
Styles that are used in subdocuments, such as paragraph styles, are automatically imported into the master document after you save the master document. When you modify the style in the master document, the style in the subdocument remains unaffected. That is, the style in the master document takes precedence over the style in the subdocument.
 
 
'''Note:''' Use the same document template for the master document and its subdocuments. When you modify or create a style, add it to the document template, and then reload the styles from the template into the master document and the subdocuments. This way the subdocuments will look the same when they are loaded into the master document as they do when viewed as individual files.
 
 
= Using the Navigator =
 
The Navigator is a very useful tool that helps you move quickly to specific parts of your document. It also provides information about the content of the document and enables you to reorganize some of the content. For example, if each chapter in your final book is a separate document, then in the master document they can be reordered, and the references are renumbered automatically and the table of contents and index can be updated.
 
 
In Writer, the Navigator has two distinct forms. One form is used in ordinary text documents and the other in master documents.
 
 
In an ordinary text document, the Navigator displays lists of the graphics, tables, index entries, hyperlinks, references, and other items in the document, as shown below. Click the + sign by any list to display the contents of the list. You can double-click an entry in the Navigator and jump immediately to that place in the document.
 
 
[[Image:WG13-1.png|Navigator for a text document]]<br>''The Navigator for a text document.''
 
 
In a master document, the Navigator lists the subdocuments and text sections, as shown in below. The use of the Navigator in a master document is covered in more detail later in this chapter (see “Step 5. Insert the subdocuments into the master document” and [[#Cross-referencing between subdocuments|Cross-referencing between subdocuments]].
 
 
[[Image:WG13-2.png|Navigator for a master document]]<br>''The Navigator for a master document.''
 
 
= Creating a master document =
 
The three most common scenarios for creating a master document depend on the current state of your document:
 
 
* You have one existing document (a book) that you want to split into several subdocuments (chapters) that will be controlled by the master document.
 
* You have several existing documents (chapters) by one or more authors that you want to combine into one book, controlled by the master document.
 
* You have no existing documents but intend to write a long book containing several chapters, possibly by multiple authors.
 
 
We will look at each of these scenarios in turn.
 
 
== Splitting one document into a master document and subdocuments ==
 
When you have one existing document that you want to split into several subdocuments that will be controlled by the master document, you can split the document automatically.
 
 
Use this method if the original document uses only the ''Default'' page style, is numbered sequentially from the first page, and uses the ''Heading 1'' style to identify the start of each chapter. In these conditions, this method will work well.
 
 
'''Advantages:''' This method is quick and easy, and any existing cross-references between chapters are preserved. Although cleanup work may be necessary, once you have done the cleanup, the document will behave itself.
 
 
'''Disadvantages:''' If the original document was complex, you may have major cleanup work to do because some formatting will be lost—for example, page styles, page breaks, restarted page numbering.
 
 
'''How to do it:''' Open the document and click '''File > Send > Create Master Document''' to split the document. You will find that each of the subdocuments begins with a ''Heading 1'' and the file names are all ''maindocnameX.odt'', where X is 1, 2, 3, and so on. If you have a Preface or other “chapter” starting with a Heading 1 before Chapter 1, the file names will not directly correspond to the chapter numbers.
 
 
== Combining several documents into a master document ==
 
This method works best when all of the documents were created from the same template, but you can also use it when the documents were created from different templates.
 
 
Use one of the techniques described in [[#Starting with no existing documents|Starting with no existing documents]] to create a blank master document and insert the other documents as subdocuments of the master document.
 
 
This method is especially useful if the subdocuments are created or maintained by multiple writers. All writers on the project can work on their subdocuments without fear of version control issues that can occur when multiple people work on the same document.
 
 
== Starting with no existing documents ==
 
The ideal situation is to start with no existing documents, because you can do everything the way you want from the beginning. Writer provides three ways to create a master document:
 
 
Method 1. Quick and easy, but not recommended
 
 
Method 2. Not too complicated, but with restrictions
 
 
Method 3. Complete controlIn each case, you need to have a disciplined approach to make sure the master document works correctly and reliably. Each method below describes the steps to take. Be sure to do the steps in the order given.
 
 
'''Method 1. Quick and easy, but not recommended'''
 
 
Writer provides a quick and easy way to create a master document, but the master document is not associated with a template, so changes to styles and formatting are more difficult to apply reliably.
 
 
 
{| class="prettytable"
 
| <center>'''Note'''</center>
 
| If the subdocuments were all created with the same template and the styles were not modified in the documents, then the styles are imported into the master document with the subdocuments, and styles and formatting should be correct in the master document. This method works best when these conditions are met.
 
 
|}
 
How to do it:
 
 
# Click '''File > New > Master Document'''.
 
# Use the Navigator to insert new documents or existing files into the master document, as described in “Step 5. Insert the subdocuments into the master document” on page 10.
 
 
'''Method 2. Not too complicated, but with restrictions'''
 
 
This technique works well if you want to use sequential page numbering throughout the final document (not restarting at 1 at any point), and each chapter starts with a ''Heading 1'' on a new page. If you want to restart page numbering anywhere in the document, use Method 3.
 
 
How to do it: Follow the instructions in the next section (Method 3. Complete control), but do not put in the text sections between the subdocuments or try to change the page numbering.
 
 
'''Method 3. Complete control'''
 
 
This method gives you complete control over complex documents with several page styles or restarted page numbering. It is a bit more work to set up, but works reliably.<ref name="ftn1">However, the method does not work in some situations. See “[[#Problem solving|Problem solving]]” on page [[#Problem solving|18]] for details.</ref>
 
 
How to do it: Follow these steps, in the order given. Each step is explained in detail in the following subsections.
 
 
Step 1. Plan the project
 
 
Step 2. Create a template containing the required styles, fields, and other elements
 
 
Step 3. Create the master document and subdocuments from the same template
 
 
Step 4. Insert some information directly into the master document
 
 
Step 5. Insert the subdocuments into the master document
 
 
Step 6. Add a table of contents, bibliography, or index
 
 
'''Step 1. Plan the project'''
 
 
Although you can make changes at most steps in this process, the more you can plan before you start, the less work you will have to do to correct any problems later. Here are some things you need to plan:
 
 
* Parts of book or report required, and the page numbering to be used in different parts of the book. Consider as an example a book with these parts:
 
 
 
{| class="prettytable"
 
| '''Part'''
 
| '''Length'''
 
| '''Page numbering'''
 
 
|-
 
| Title (cover) page
 
| 1 page
 
| no page number
 
 
|-
 
| Copyright page
 
| 1 page (back of title page)
 
| no page number
 
 
|-
 
| Table of Contents
 
| unknown length
 
| start with i
 
 
|-
 
| Preface (Foreword)
 
| 2 pages
 
| continue from ToC
 
 
|-
 
| Chapters 1 to 8
 
| unknown length
 
| start with 1
 
 
|-
 
| Appendixes A, B
 
| unknown length
 
| continue from Chapter 8
 
 
|-
 
| Index
 
| unknown length
 
| continue from Appendix B
 
 
|}
 
* What pages will be in the master document and what will be in the subdocuments. The ToC and index must be in the master document. A typical arrangement would be:
 
 
 
{| class="prettytable"
 
| '''Part'''
 
| '''Location'''
 
 
|-
 
| Title (cover) page
 
| In master document
 
 
|-
 
| Copyright page
 
| In master document
 
 
|-
 
| Table of Contents
 
| In master document
 
 
|-
 
| Preface (Foreword)
 
| Subdocument
 
 
|-
 
| Chapters 1 to 8
 
| Subdocuments
 
 
|-
 
| Appendixes A, B
 
| Subdocuments
 
 
|-
 
| Index
 
| In master document
 
 
|}
 
* Page, paragraph, character, frame, and numbering styles. See Chapter 6, “Introduction to Styles” and Chapter 7, “Working with Styles” for instructions on how to create or modify styles. Some styles for the example book are:<br/> '''Page styles'''
 
 
 
{| class="prettytable"
 
! Name
 
! Characteristics
 
! Next page style
 
 
|-
 
| Title page
 
| No header, footer or page numbers; layout different from other pages
 
| Copyright page
 
 
|-
 
| Copyright page
 
| No header, footer or page numbers; layout different from other pages
 
| Front matter first page
 
 
|-
 
| Front matter first page
 
| No header; page number in footer, Roman numbers (i, ii, iii); layout different from following pages
 
| Front matter left page
 
 
|-
 
| Front matter left page
 
| Header and footer, one containing the page number (Roman)
 
| Front matter right page
 
 
|-
 
| Front matter right page
 
| Margins mirrored from Front matter left page; Roman page number
 
| Front matter left page
 
 
|-
 
| First page
 
| No header; page number in footer, Arabic numbers (1, 2, 3); layout same as Front matter first page
 
| Left page
 
 
|-
 
| Left page
 
| Layout as for Front matter left page, but Arabic page numbers
 
| Right page
 
 
|-
 
| Right page
 
| Layout as for Front matter right page, but Arabic page numbers
 
| Left page
 
 
|}
 
'''Paragraph styles'''
 
{| class="prettytable"
 
! Name
 
! Characteristics
 
! Next paragraph style
 
 
|-
 
| Heading 1
 
| 18 pt, bold, 0.30” above, 0.15” after, page break before
 
| Body text
 
 
|-
 
| Heading 2
 
| 14 pt, bold, 0.30 “ above, 0.15” below
 
| Body text
 
 
|-
 
| Body text
 
| 12 pt, double space, 0.25” indent before
 
| Body text
 
 
|-
 
| Page break
 
| 6 pt, no space before or after, page break before
 
| Body text
 
 
|}
 
'''Character styles'''
 
{| class="prettytable"
 
! Name
 
! Characteristics
 
 
|-
 
| Emphasis
 
| 12 pt, italic
 
 
|-
 
| Body text
 
| 12 pt
 
 
|}
 
* Insert fields and AutoText entries as required. See other chapters in this book for ideas.
 
 
'''Step 2. Create a template containing the required styles, fields, and other elements'''
 
 
You can create your template from an existing document or template that contains some or all of the styles you want for this document, or you can create the template from a blank document. For more about templates, see Chapter 10, “Working with Templates”.
 
 
If you use an existing document or template, delete all the text from it except for fields in headers and footers before saving it as the template for this project. It will still have all the styles you defined, even if the text is not there. You can change the styles in the template as your project develops.
 
 
Be sure to use '''File > Templates > Save '''when creating the template.
 
 
'''Step 3. Create the master document and subdocuments from the same template'''
 
 
If you are starting a new project, create the master document and all the subdocuments from the same template. Not using the same template could create style inconsistencies that require time and effort to correct. For example, if two subdocuments have a style with the same name that is formatted differently in each document, the master document will use the formatting from the first subdocument that was added. This could cause your document not to look like you expect. Using the same template for all subdocuments saves time and frustration.
 
 
It does not matter in what order you create the master and subdocuments, and you do not have to create all the subdocuments at the same time, when you are starting the project. You can add new subdocuments at any time, as you need them—as long as you always create them from the same template.
 
 
'''''Create the master document'''''
 
 
Follow this process to create the master document. You can use other methods, but each method (including this one) has its drawbacks.
 
 
# Open a new document from the template you created in Step 2, by clicking '''New > Templates and Documents''', then selecting the template you created. Be sure the first page of this new document is set to the page style you want for the first page of the final document; if it is not, change it. In our example, the style for the first page is ''Title page''.
 
# If any text or page breaks came into this document from the template, delete the text. (Fields in headers and footers can stay.)
 
# Click '''File > Send > Create Master Document'''. Save the master document in the folder for this project, not in the templates foldert. We will return to this master document later. For now, you can either leave it open or close it, as you prefer.
 
 
'''''Create subdocuments'''''
 
 
A subdocument is no different from any other text document. It becomes a subdocument only when it is linked into a master document and opened from within the master document. Some settings in the master document will override the settings in a subdocument, but only when the document is being viewed, manipulated, or printed through the master document.
 
 
Create a subdocument in the same way as you create any ordinary document:
 
 
# Open a blank document based on the project template (very important) by clicking '''New > Templates and Documents''', then selecting the template.
 
# Delete any unwanted text, and set the first page to the page style you specified for the first page of a chapter.
 
# Click '''File > Save As'''. Give the document a suitable name and save it in the folder for this project.
 
 
If you already have some of the chapters written, the files are probably not based on the template you just created for this project. You will need to change the template attached to the existing files. The only way to do this is:
 
 
# Open a blank document based on the project template.
 
# Copy the contents of the original document into this new document. Use '''File > Paste Special''' to avoid copying the styles from the original documents to the new document.
 
# Apply the template styles throughout the document.
 
# Click '''File > Save As''' and save the new document in the project folder with a suitable name.
 
# Rename the original chapter file so you do not use it by mistake.
 
 
'''Step 4. Insert some information directly into the master document'''
 
 
The instructions in steps 4 and 5 use the page numbering requirements given in Step 1. If your book has different requirements, change these instructions to suit.<ref name="ftn2">See “[[#Problem solving|Problem solving]]” on page [[#Problem solving|18]] for one example.</ref>
 
 
These instructions are fairly tedious, but once you have the master document set up, you should not have to change it, and with a bit of practice setting it up goes quickly.
 
 
# Open the master document and do the following.
 
 
* Make sure paragraph marks are showing (you can set them in '''Tools > Options > OpenOffice.org Writer > Formatting Aids''', or click the '''Nonprinting characters '''icon [[Image:]]).
 
* Show text boundaries, table boundaries, and section boundaries ('''Tools > Options > OpenOffice.org > Appearance''').
 
 
# Type the contents of the title page (or leave placeholders and fill in later). With the insertion point in the last blank paragraph on the page, click '''Insert > Manual Break'''. On the Insert Break dialog box (Figure 3), select '''Page break''' and the page style for the second page (''Copyright page'' in our example), and leave the '''Change page number '''checkbox deselected. Click '''OK'''.
 
 
<center>[[Image:]]</center>
 
 
''Figure 3. Inserting a page break between the title page and the copyright page''
 
 
# Type the contents of the copyright page (or leave placeholders). Insert another manual page break, this time setting the page style to ''Front matter first page''. Select the '''Change page number''' checkbox and choose 1 in the box below that, as shown in Figure 4. This number 1 will show in your document as i, because the page style is defined to use Roman numerals.
 
 
<center>[[Image:]]</center>
 
 
''Figure 4. Inserting a page break before the first page of the front matter''
 
 
# Let’s assume the third page is for the Table of Contents. Leave a blank paragraph or two on this page and insert another page break, with the next page again set to the ''Front matter first page ''style, which we want to use for the first page of the Preface. Because we want the page numbering for the Preface to continue from the page numbers of the Table of Contents, do '''''not '''''select the '''Change page number '''checkbox this time. Notice that the Navigator shows one item, labeled '''Text'''.
 
 
'''Step 5. Insert the subdocuments into the master document'''
 
 
At last we are ready to add the subdocuments.
 
 
 
{| class="prettytable"
 
| <center>'''TIP'''</center>
 
| Subdocuments are inserted into a master document ''before'' whatever item is highlighted in the Navigator. If you insert the ''last'' subdocument first, and then insert the other subdocuments before the last one, they will end up in the correct sequence without the necessity of moving them up or down in the list.
 
 
|}
 
# Display the Navigator (click '''Edit > Navigator''', or press ''F5'', or click the '''Navigator''' icon [[Image:]] .
 
# On the Navigator, select '''Text''', then long-click on the '''Insert '''icon and click '''File'''.
 
 
<center>[[Image:]]</center>
 
 
''Figure 5. Inserting a subdocument into a master document using the Navigator''
 
 
A standard File Open dialog box appears. Select the required file (which you created in Step 3) and click '''OK'''. This example uses six chapters and a preface; we will load Chapter 6 first, as suggested in the Tip above.
 
 
The inserted file is listed in the Navigator ''before'' the Text item, as shown in Figure 6.
 
 
<center>[[Image:|thumb|<center></center>]]</center>
 
 
''Figure 6. Navigator after inserting one subdocument''
 
 
# Because the ''Text'' section contains the title page and other material you have already inserted, highlight it and click the '''Move Up''' icon to move it to the top of the list.
 
# Highlight the subdocument you just inserted (Chapter 6), then long-click on the '''Insert '''icon and click '''File''' to insert the ''first'' subdocument; in this example, Preface. Chapter 6 remains highlighted. Repeat with Chapter 1, Chapter 2, and so on until all the subdocuments have been added to the list. The Navigator will now look something like Figure 7.
 
 
[[Image:|thumb|<center></center> ''Figure 7. The Navigator showing a series of files in a master document '']]
 
 
# Save the master document again. Now highlight each chapter in turn and insert a Text section before it. When you are done, the Navigator should look like Figure 8.
 
 
[[Image:|thumb|<center></center> ''Figure 8. The Navigator showing a series of files and text sections '']]
 
 
 
{| class="prettytable"
 
| <center>'''TIP'''</center>
 
| You can define your ''Heading 1'' paragraph style to start on a new page, and thus avoid inserting manual page breaks between chapters, but this causes a page numbering problem if you want to restart page numbering at the beginning of Chapter 1.
 
 
To restart page numbering, you must insert a manual page break; but because the Heading 1 style on the first page of Chapter 1 forces yet another page break, you end up with one or more unwanted blank pages before the first page of Chapter 1. The technique described in this chapter avoids this problem.
 
 
|}
 
# Check whether the first page of the master document has the correct page style. If not, change it to the correct style (''Title page'' in this example).
 
 
Scroll to the place where the first subdocument begins. Check whether its page style is correct, and change it if necessary (''Front matter first page'' in this example).
 
 
The first subdocument (Figure 9) has a blank paragraph at the top of the page; this was inserted as part of the manual page break. Set this paragraph to the PageBreak style you created in Step 2.
 
 
<center>[[Image:]]</center>
 
 
''Figure 9. Page break before subdocument, which is in a protected section''
 
 
# Notice that the document is in a protected section. That means you cannot change any of the contents of this subdocument from within the master document. (If you remove the section, the contents become part of the master document itself; they are no longer in a subdocument. If you make changes in either the master document or the subdocument, those changes are not made in the other document. For more about sections, refer to the online help or to Chapter 4, “Formatting Pages”.)
 
 
Scroll down until you find the beginning of Chapter 1. You will find that it is on the same page as the end of the Preface, and there is a blank paragraph in the text area between the two sections (the Preface and Chapter 1), as shown in Figure 10.
 
 
Click on this blank paragraph and insert a page break, specifying the ''First Page'' style and the page number to start at 1. Click '''OK'''.
 
 
<center>[[Image:]]</center>
 
 
''Figure 10. A text area between two sections of a master document''
 
 
# Scroll to the first page of Chapter 2. You’ll find that it is on the same page as the end of Chapter 1, and there is a blank paragraph in the text area between the two chapters.
 
 
Click on this blank paragraph and insert a page break, specifying the ''First Page'' style, but do ''not'' select the '''Change page number''' checkbox.
 
 
Repeat for all of the chapters, so that each chapter starts on a new first page.
 
 
# Save the master document again.
 
 
'''Step 6. Add a table of contents, bibliography, or index'''
 
 
You can generate a table of contents, bibliography, or index for the book, using the master document. You must insert these items into a text section in the master document. For more about these document elements, see Chapter 12, “Creating Tables of Contents, Indexes, and Bibliographies”.
 
 
Put the insertion point on the page in the first text section where the table of contents is to go and create the table of contents.
 
 
If you do not have a Text section at the end of the master document, insert one before the last subdocument, then move it down so it is after the last subdocument. Now, if you have included bibliographic entries in your subdocuments, you can put the insertion point on the page in this last text section where the bibliography is to go and create the bibliography.
 
 
If you have included index entries in your subdocuments, put the insertion point on the page in the last text section where the index is to go and create the index.
 
 
= Editing a master document =
 
After creating a master document, you may want to change its appearance or contents.
 
 
== Changing the appearance of the document ==
 
You can change the styles in the template as your project develops. Do not make changes to styles in the master document or in any of the subdocuments—make those changes in the template.
 
 
To update the master document (and all of the subdocuments) with changes to the template, just open the master document. You will get two messages: first, to ask if you want to update all links; and second, if you want to apply the changed styles. Answer ''Yes'' to both of these messages.
 
 
== Editing subdocuments ==
 
You cannot save edits made to a subdocument from within the master document. Instead, you must open the subdocument, either by double-clicking on it in the master document’s Navigator, or by opening it from outside the master document. Then you can edit it just as you would edit any other document. Just one rule: if you make any changes to the styles while editing a subdocument, you must copy those changed styles to the template so they are available to all of the subdocuments and to the master document.
 
 
If you change the contents of any subdocument, you need to manually update the table of contents, bibliography, and index from within the master document.
 
 
= Cross-referencing between subdocuments =
 
The methods described earlier in this chapter are all most writers will need when using master documents. However, you might need to automatically update cross-references between subdocuments. This section describes how to do this.
 
 
The process to create cross-references between subdocuments is tedious, but it works. (An alternative is to use Ian Laurenson’s OutlineCrossRef3 macro, available from [http://homepages.paradise.net.nz/hillview/OOo/OutlineCrossRef3-fr-3.odt http://homepages.paradise.net.nz/hillview/OOo/OutlineCrossRef3-fr-3.odt].)
 
 
# First set references in each subdocument, just as you would when you are cross-referencing within a single document. When you do this, select the entire text you want to use as the reference, such as a a heading or figure number. Keep a list of what you have named the reference fields, and be sure every name is unique. One way to keep track of this information is by putting it in a separate text file or a spreadsheet.
 
 
The field names are case-sensitive. You can check the field name by holding the cursor over the referenced item. In our example (Figure 11), the heading has the field name ''word count''.
 
 
<center>[[Image:]]</center>
 
 
''Figure 11. Finding the field name for a heading''
 
 
# Open the master document. In the Navigator (Figure 12), select a subdocument and click the '''Edit''' icon (or right-click and choose '''Edit '''from the pop-up menu). The subdocument opens for editing.
 
# In the subdocument, place the cursor where you want the cross-reference to appear. Click '''Insert > Cross Reference'''.
 
# In the Fields dialog box, on the ''References'' page, select''' Insert Reference''' in the ''Typ''e list on the left hand side (Figure 13). The ''Selection'' list in the middle column shows only the reference field names for the subdocument you are using, so ignore that list and check the list you created manually in step 1.
 
 
<center>[[Image:]]</center>
 
 
''Figure 12. Selecting a subdocument in the Navigator''
 
 
# In the '''Name '''field in the lower right hand column, type the name of the reference you set in the subdocument you are referring to. In our example, the reference is in Chapter 3, and its name is ''word count''.
 
 
<center>[[Image:|thumb|<center>''Figure 13. Fields dialog box showing manual entry of field name''</center>]]</center>
 
 
# Click '''Insert,''' type any text you want to appear between the reference and page number (such as “on page”), and then insert another reference with the '''Page''' format. Nothing will appear in the subdocument except tiny gray bars indicating the fields. If you hover the mouse pointer over one of these fields, you should see the field name (Figure 14).
 
 
<center>[[Image:]]</center>
 
 
''Figure 14. Viewing the field name''
 
 
(You can turn on the display of field codes by clicking '''View > Field Names.''' The two fields shown as gray lines in Figure 14 now look like Figure 15.)
 
 
<center>[[Image:|thumb|<center>''Figure 15. Displaying field codes''</center>]]</center>
 
 
# After you have inserted all the cross-references required in the subdocument, save and close it and return to the master document window.
 
 
Within the master document, navigate to the page of the subdocument on which you inserted the cross-reference field. You should now see the text of the cross-reference appear in the spot where you inserted it (Figure 15), because within the master document, the subdocument can find the target of that field reference.
 
 
<center>[[Image:|thumb|<center>''Figure 16. Field contents showing where inserted in file''</center>]]</center>
 
 
This technique also works if you open a subdocument directly in step 2 (that is, not from within the master document) and insert a cross-reference field.
 
 
= Creating one file from a master document and its subdocuments =
 
Master documents are .odm files containing linked subdocuments, which are in .odt format. Although linked files are very useful when writing and editing a large document such as a book, sometimes you might need to have a copy of the entire book in one file.
 
 
To export a master document to a .odt file (without affecting the original .odm file), do this:
 
 
# Open the master document and choose '''File > Export''' from the menu bar.
 
# On the Export dialog (Figure 17), type a name for the exported .odt file and choose '''OpenDocument Text (.odt)''' from the ''File format'' list. Click '''Export'''. This step changes the .odm file into a .odt file.
 
 
<center>[[Image:|thumb|<center>''Figure 17: Exporting a master document to an OpenDocument Text (.odt) file''</center>]]</center>
 
 
# Close the master document and open the new .odt file, updating all links.
 
# Choose '''Edit > Links''' from the menu bar.
 
# The Edit Links dialog (Figure 18) shows all the linked files. Select all the files in the Source file list and click '''Break Link'''. This step embeds (includes) the contents of all the subdocuments into one single file.
 
 
<center>[[Image:|thumb|<center>''Figure 18: Breaking links to include files in one document''</center>]]</center>
 
 
= Problem solving =
 
Some combinations of choices do not work together. This section describes some problems and what to do about them.
 
 
== Including a chapter reference in the header of the first page ==
 
'''The problem'''
 
 
If you use the method described in “Step 5. Insert the subdocuments into the master document” beginning on page 10 (putting a page break paragraph into the master document between the subdocuments), '''and''' you put a cross-reference to the chapter name and number in the header of the '''first''' page of each chapter, then the cross-reference field on the first page will pick up the chapter name and number from the previous chapter. This happens because with this method the first (blank) paragraph on those pages is actually the '''last''' paragraph of the previous chapter. The example did not include a cross-reference to the chapter name and number in the header of the first page, so it did not have this problem.
 
 
First page '''footers''' do not have this problem; they correctly pick up the current chapter’s name and number.
 
 
'''The solution'''
 
 
The cure for this problem is as follows:
 
 
# Use '''File > Templates > Edit''' to open the template used for the master document and its subdocuments.
 
# Modify the style for the chapter title (usually ''Heading 1'') to enable a page break before, using the page style you want for the first page of each chapter. Save and close the template.
 
# When you reopen the master document, it should ask two questions: “Update all links?” and “Your styles don’t match the template. Do you want to update your files?” Be sure to answer ''Yes'' to both questions.
 
# Modify the chapter title style (''Heading 1'') in the master document file as you did in the template file in step 2. Save the master document.
 
# Open the Navigator in Master Document view and delete the Text sections between the chapters. Update all links.
 
 
The headers on the first page of each chapter will now display the correct chapter name and number.
 
 
'''The problem with the solution—and a workaround'''
 
 
This solution creates another problem, '''if''' you want to restart page numbering at 1 on the first page of the first chapter '''and''' have pages numbered sequentially through all the chapters.
 
 
Normally you would restart numbering by specifying the starting page number when you modify the ''Heading 1'' style to start on a new page. However, if you do that, then each chapter restarts page numbering at 1. (Sometimes this is what you want, but often it is not.)
 
 
In this case, you will have to include an “offset” in the page number field—that is, you tell OOoWriter how many pages to subtract to make the first page of the first chapter to be page number 1. Of course, to make this work, you need to know how many pages are in the front matter, and you may not know that until after you have finished the entire book. If you add or delete some pages (for example, if the table of contents grows from 4 pages to 5), you will need to adjust the offset accordingly. Therefore, this adjustment is best made at the end of the project.
 
 
Here is how to do it.
 
 
# In the master document itself—not in the subdocument—place the cursor just in front of the Page field on the first page of the first chapter. Right-click and choose '''Fields''' from the pop-up menu.
 
# In the Edit Fields dialog box (Figure 19), type a negative even number (–2, –4, etc.) in the ''Offset'' box. Click '''OK''' to save this change.
 
 
<center>[[Image:|thumb|<center>''Figure 19. Using an offset to start at a different page number''</center>]]</center>
 
 
# You might need to make the same change on the second page of the first chapter.
 
 
== Including landscape pages in a portrait-oriented master document ==
 
'''The problem'''
 
 
Master documents ignore manual page breaks in subdocuments '''if''' the manual break specifies the following page style. Landscape pages are inserted into portrait-oriented documents by inserting a manual page and specifying a landscape page style (and then changing back to portrait orientation by inserting another manual break and specifying the following page style). This technique works fine until the document becomes a subdocument within a master document. At that point the landscape pages become portrait pages and the page break itself is ignored.
 
 
'''The solution'''
 
 
# Remove the landscape pages from the subdocument and put them in a separate document. Note that if the landscape pages are in the middle of the original subdocument, you will end up with at least three documents: (a) the portion of the subdocument before the landscape pages, (b) the landscape pages themselves, and (c) the portion of the subdocument after the landscape pages.
 
# Insert documents (a) and (c) individually into the master document.
 
# Then do one of the following:
 
 
* Insert a text section into the master document itself between documents (a) and (b). In the text section, insert a manual page break (specifying the landscape page style), and then paste the contents of document (b)—the landscape pages—into the master document. If necessary, insert another manual page break (specifying one of the relevant portrait page styles) before document (b).
 
 
or* Insert document (b) into the master document as a subdocument, using the method described on page 10 to include a manual page break in a text section before and after the landscape document.
 
 
When deciding which method to use, you need to consider the placement of headers and footers (if any) that appear in your document. If you want portrait headers and footers on the landscape pages, use the technique described in Chapter 4, “Formatting Pages”.
 
 
== Anchoring pictures to a page ==
 
'''The problem'''
 
 
A picture (graphic) anchored “to page” in a subdocument is not displayed in the master document although it always appears correctly in the subdocument.
 
 
Because the master document reorganizes the page flow, page numbers, and cross-references when it collates all the subdocuments together, the absolute reference to a page X in a subdocument is lost in the master document. The picture loses its anchor reference and simply disappears.
 
 
'''The solution'''
 
 
To avoid this problem but keep pictures positioned precisely on a particular page, anchor the pictures as follows:
 
 
# Right-click on the picture and choose '''Picture''' from the pop-up menu.
 
# On the ''Type'' tab of the Picture dialog box (Figure 20), set the anchor to ''To character'' or ''To paragraph''.
 
 
<center>[[Image:|thumb|<center>''Figure 20. Anchoring a graphic and setting its position on a page''</center>]]</center># Under ''Position'', choose suitable horizontal and vertical references to the page.
 
  
  
 
{{CCBY}}
 
{{CCBY}}
[[Category: Documentation]]
+
[[Category: Writer Guide (Documentation)]]

Latest revision as of 19:31, 25 September 2009


This is Chapter 13 of the OpenOffice.org 2.x Writer Guide (Third edition), produced by the OOoAuthors group. A PDF of this chapter is available from the OOoAuthors Guides page at OpenOffice.org.

Why use a master document?

Master documents are typically used for producing long documents such as a book, a thesis, or a long report. A master document is especially useful when graphics, spreadsheets, or other material causes the file size to become quite large. Master documents are also used when different people are writing different chapters or other parts of the full document, so you don’t need to share files. A master document joins separate text documents into one larger document, and unifies the formatting, table of contents (ToC), bibliography, index, and other tables or lists.

Yes, master documents do work in OOoWriter. However, their use is full of traps for inexperienced users. Until you become familiar with the traps, find out whether they affect what you are doing, and learn how to avoid (or work around) them, you may think that master documents are unreliable or difficult to use. In fact, avoiding or working around most of the traps is quite easy to do.

You can use several methods to create master documents. Each method has its advantages and disadvantages. Which method you choose depends on what you are trying to accomplish. The different methods are described in this chapter, along with suggestions on when to use each one.


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools
In other languages