Home Uniquely NZ Travel Howto Pauline Small Firms Search
Diary of System and Website Development
Part 15 (July 2009 -> August 2009 )

 1st July 2009

Backing up and Moving a Home Directory prior to a Distribution Update

Backup using a Standard Tar Archive

There is also a very powerful command line archiving tool round which many of the GUI tools are based which should work on most Linux Distributions. In many circumstances it is best to access this directly to backup your system. The resulting files can also be accessed (or created) by the archive manager accessed by right clicking on a .tgz .tar.gz or .tar.bz2 file. The following commands will back up your home folder /home/yourusername if you change pcurtis to yourusername:

In a terminal type:

sudo tar cvpPzf "/media/WD Passport/mybackup.tgz" /home/pcurtis/ --exclude=/home/*/mybackup.tgz --exclude=/home/*/.gvfs

This is a single line if you cut and paste. The options cvpzf are: create archive, verbose mode (leave this out after the first time) , retain permissions, -P do not strip leading backslash, gzip archive and file output. Then follows the name of the file to be created, mybackup.tgz which in this example is on an external USB drive called 'WD Passport' - the backup name should include the date for easy reference. Next is the directory to back up, in this case /home/pcurtis). Next are the objects which need to be excluded - the most important of these is your back up file if it is in your /home area (so not needed in this case) or it would be recursive! It also excludes the folders (.gvfs) which is used dynamically by a file mounting system and is locked which stops tar from completing.

The backup process is slow (15 mins plus) and the file over a gbyte for the simplest system. After it is complete the file should be moved to a safe location, preferably a DVD if you did not use an external device. If you want to do a higher compression method the command "tar cvpjf mybackup.tar.bz2" can be used in place of "tar cvpzf mybackup.tgz". This will use bzip2 to do the compressing - j option. This method will take longer but gives a smaller file.

You can access parts of the archive using the GUI Archive Manager by right clicking on the .tgz file - again slow on such a large archive. A backup is most useful if you can effectively restore your entire system or data. This can be again done by a few commands but do not try this for fun as it will overwrite the entire part of the Ubuntu file system we archived, thus restoring the older image that we took.The following assumes the backup image is in the root directory of an external drive called 'WD Passport' :

sudo tar xvpfz "/media/WD Passport/mybackup.tgz" -C /home/pcurtis

The restoration uses the options - extract, verbose, retain permissions, from file and gzip. This will take a while because all your files will be overwritten with the versions from the image you previously backed up. The "-C /home/pcurtis ensures that the directory is changed so the files are restore to the original locations in the home directory.

If the old system is still present note that it only overwrites files, it does not deleted files from the old version which are no longer needed.

What I have done is to create a new user and then run as root from it and rename the /home/pcurtis directory to pcurtis-bak and create a new directory ready for the extraction from the tar archive. I expected to have to change the permissions of the new /home/pcurtis folder but the extraction seemed to have sorted it out.

If you want to delete the archive file then you will find it is owned by root so make sure you delete it in a terminal - if you use a root browser then it will go into a root Deleted Items which you can not easily empty so it takes up disk space for ever more. If this happens then read http://www.ubuntugeek.com/empty-ubuntu-gnome-trash-from-the-command-line.html and/or load the trash-cli command line trash package using the Synaptic Package Manager and type

sudo trash-empty

Distribution Upgrades

The above backup of ones home folder(s) is all in preparation for a distribution upgrade. In theory this is possible without lose of any of your files or configuration - in practice I and others have had some problems especially if you have loaded any addition software via extra repositories or directly via .deb files as the automated backup is very good but can not cover every contingency.

So what I have done splits into a number of parts

  1. Made a backup of the /home directory in a tar archive as above which should have all the data and configuration
  2. Kept a record of all the programs, utilities and libraries (packages) I have loaded and created a script to both load them and as a way of documenting for the future ie as every repository is added and every package is loaded I also add it to the script for the future. You can have a look at my scripts which I have called LoadStandardPrograms for Jaunty and LoadStandardPrograms-kalmic for Kalmic Koala
  3. I keep a list of packages added which are separate of the repository system such as Adobe Acrobat, Truecrypt, First Class and in some cases special drivers for Wifi etc and keep all the downloads in a folder so I can access them easily and again it self documents.
  4. I make a copy of the latest version of every system file I have had to edit such as fstab, rfcomm.conf, ppp.conf, menu.list and bashrc etc so again it is self documenting.
  5. Any special set up procedures are documented on my web site.

Now if I need to rebuild the system or do a clean install of a new distribution I can:

  1. Do a fresh install from CD - on systems with the /home on a separate partition it should be left intact if you make sure you do not reformat that partition.
  2. Install all the extra repositories and packages using the LoadStandardPrograms script for Jaunty or the LoadStandardPrograms-kalmic script for Kalmic Koala.
  3. Install any extra packages from the folder of .deb files and install scripts
  4. Edit/replace the system files which were changed and check that drives mount and the boot is as you want.
  5. Carry out any special procedures for installing drivers, permanently mounting drives, using modems and mounting Truecrypt volumes without an adminstartor password etc
  6. Create an extra user with Administrative privileges (so it can sudo), change to the new user, rename your normal user's home folder and replace it with the home folder folder from the tar archive.
  7. Log back into your usual username.
  8. Delete the backup user home folder - use sudo in a terminal or read above on how to empty the root trash.
  9. Set up file sharing by System -> Administration -> Samba and Printers by System -> Administration -> Printers -> Add printer and follow through the screens. Both require a reboot

You should now be back to where you were.

I have used the same basic proceedure to change partition sizes, add a partition for the /home directory, upgrade from Hardy to a fresh install of Jaunty and move a complete 'user' from a netbook to a laptop all in one operation.

Backing up and reloading the entire package list

This is an idea I got from the book Ubuntu Hacks which is in my book list as an alternative to my script LoadStandardPrograms . One copies the entire list of installed packages to a file and then loads them all, some 1600, back in - of course most of them will already be there but the system ignores them and just loads the extra 30 packages which should all be in my script with associated dependencies, perhaps 100 in total. It should work well for a reload of the same distribution or a minor upgrade. The terminal command to write the list of packages is:

sudo dpkg --get-selections | grep '[[:space:]]install$' | awk '{print $1}' > package_list
The operation is a nice example of piping throuagh a series of programs and redirection of the output to a file. grep selects the lines containing the string 'install' and awk is used to select and print only the first item on each line. awk, with its own self-contained language, is actually one of the most powerful data processing engines in existence — not only in Linux, but anywhere. It allows you to create short programs that read input files, sort data, process it, perform arithmetic on the input, and generate reports, among myriad other functions. To put it the simplest way possible, AWK is a programming-language tool used to manipulate text. When first created, AWK was designed to work in the text-processing arena, and the language is based on executing a series of instructions whenever a pattern is matched in the input data. The utility scans each line of a file, looking for patterns that match those given on the command line. If a match is found, it takes the next programming step. If no match is found, it then proceeds to the next line. This link is a good starting point http://www.oracle.com/technology/pub/articles/dulaney_awk.html . In fact the grep action could also be carried out in awk and when I have more time I might try that out.

The command to read the file back in is also a good example of the power of linux commands and piping output from one into another:

cat package_list | xargs sudo apt-get install

cat is used to send the list through a pipe to xargs which calls apt-get install with parameters made up from the input piped into it. It divides the input into chunks and calls apt-get install as many times as are required.

Whenever I see command lines such as these I look up the various commands using man commandname to see what they do. You will often find that people have piped together a series of simple ways of using the commands which they know and understand rather than save a a few characters by using many options with a single command.

A script to Search for and Replace a character string in a folder of files

Searching and Replacing is one of the more common activities, both in a single file and in a folder of files of the same type. Linux provides a Stream EDitor (sed) which can search for and replace a search string with replace string throughout a file. A example of use on a single file follows. The -i (in place) parameter carries it out in the same file.

sed -i 's/searchstring/replacestring/' filename

The sed command can also make a backup automatically - if you follow the -i parameter with a string it will add that to the filename when it makes the copy. The following line is my actual test and you will note that I have added the time and date in the backup name to avoid overwriting the original if I run the command several times by accident or to refine the search - perhaps even more important is that it provids an audit trail of changes.

sed -i.bak_`date +%d-%m-20%y_%H%M-%S` 's/sounds and music/SOUNDS AND MUSIC/' search_replace_test

The above is a single line which must not be split if you do a cut and paste from a display on a small screen. The quotes round the date command are back ticks `` which are usually at the top left on your keyboard and are used to evaluate the expression within them. Do a man date to understand the format parameters used by the date command. The next set of quotes are ordinary single quotes and are needed if the strings contain spaces.

We will now look at how to wrap this to carry out the search and replace on a whole folder. This is a very useful activity and another example of the power of linux commands especially when piped together.

find ./ -type f -exec sed -i.bak 's/searchstring/replacestring/' {} \;

This command visits everything in . ( your current folder when it is run) and it’s subdirectories, and makes the substitution in files. This line has two main parts - the find command whose -exec parameter executes the following sed command for every file that is of type f (normal file). The final ; (which has been escaped by a \ so it can be used in scripts) terminates the -exec . Take great care when testing this command and never add a sudo in case you change every system file on the machine. Note that the backup is created whether changes are made or not. Replacing -type f with, for example, -name *.htm will limit the damage to .htm files!

A Script to make a backup of a file with date and time in the backup name

The techique to make backups in my search and replace command led me to create a simple script to make a backup of a file the new name including the date and time:

#!/bin/bash
# Script to copy single file to the same name with ending in .bak_date_time
# Addition arguments to cpbk are ignored.
# Lives in ~/bin/cpbk where it must be given execute permissions
# and ~/bin should have been be added to to #PATH in ~/.bashrc
# If you wish to use it on system files using sudo in must also be in /usr/bin
# with ownership changed to root and given execute permissions
#
arg2="$1.bak_`date +%d-%m-20%y_%H%M-%S`"
cp "$1" "$arg2"

Note that my script files are self documenting. The task for the reader is to add a check if a backup file exists and the first time just call it .original

Changing the name of a user

This is much more difficult than one might imagine but there is a utility which does the basic work and updates many of the files but only in the home directory.

Code to change a username - user must not be logged in if numeric uid changed

usermod -l <newname> -d /home/<newname> -m <oldname>

-u accepts uid as parameter, and you can move the directory by using -d with the -m

Also, you may want to change the group name - by default the group name is same as user login
Code:

groupmod -n <newgroup> <oldgroup>

Note: This does not sort out address which are hard coded which are used by Wine and some mozilla profiles

Changing the Computer name

This is stored in /etc/hostname alone so this is a very easy change in a terminal

sudo gedit /etc/hostname

9th July 2009

Weather Maps whilst Mobile

As you will realise we do some sailing and from my background I have an interest in meteorology. I recently saw UGrib in action which takes weather data in the GRIB format and displays it in a very user friendly way and have been looking for equivalent Linux programs. GRIB (Gridded Information in Binary) was originally devised to efficiently transfer data sets between national meteorological services. Most of the data are output from Numerical Weather Prediction (NWP) models. Data analyses and forecasts are stored on a latitude/longitude grid using binary format to minimise file size. Subsets of this data can be requested from various servers by FTP or as email attachments. Forecasts of whatever elements are required, for several days ahead, are usually much less than a single image from a meteorological site. Processing into whatever chart displays and animations is done chart using standard software on the GRIB file which is be stored for latter offline use. The standard free source of GRIB output is from the US National Weather Service.

There are a number of Programs for interrogating GRIB servers and downloaded selected data and displaying it as well as sites which email GRIB files for display offline. The best known is Ugrib which is only available under Windows and will not run under Linux using Wine as it needs the full .net version 2.0 framework. I have run it on my Windows box as a standard to judge the others against. It has an easy selection of the area to download the file and the subset of the data available which is limited to the Surface Pressure, Wind Speed and accumulated rainfall. The displays are clear and spot values are provided under the cursor. Animations are easily set up. There is a useful feature called a Meteogram which displays times series in a graphical window for the point under the cursor. The main shortfalls are in the limited data which can be included in the Grib file and displayed, for example there is no download or display of temperature or humidity.

zyGrib - for Linux with a version available for Windows

zyGrib is written in Linux but there is a Windows version available. The interface and display is not as refined as that of Ugrib but the number of parameters which can be downloaded and displayed is greater. There is usually a repository which you can add to the package manager if you use a Debian derivative such as Ubuntu.

Installing zyGrib from source - the hard way

There was no up to date repository or .deb file on the zyGrib site when I started although there normally would be one. This meant that the archive had to be downloaded, unpacked and installed. The instructions are translated from French and are not very clear but the operation is actually very simple.

First we need the latest QT4 system installed. Qt is a cross-platform application and GUI (Graphical User Interface) framework which is used to write applications once and deploy them across many desktop and embedded operating systems without rewriting the source code. It is used widely. The easiest way to install QT4 is in a terminal where you type:

sudo apt-get install qt4-dev-tools libqt4-dev

Now we need to extract the source from the archive into our home folder by dragging the archive to our home folder, double clicking on the archive and dragging the zyGrib folder into the home folder.

We need to modify one file within the .zyGrib folder called Makefile if we are using Ubuntu to tell the compilation process where to find
the QT4 system. This is in the first line and in the case of Ubuntu this is the only change needed as QT4 is selected by default over any other versions present. In other distributions QTBIN will be different and you may have to change all occurances of qmake to qt4-make. In Ubuntu Hardy heron and Jaunty Jacalope Makefile should now looks like:

QTBIN=/usr/bin

all:
rm -f ./zyGrib
cd src/bzip2; $(QTBIN)/qmake; make
cd src/zlib-1.2.3; $(QTBIN)/qmake; make
cd src/proj-4.6.0/src/; $(QTBIN)/qmake; make
cd src; $(QTBIN)/qmake; make
echo "-----------------------------------"

clean:
rm -f zyGrib
rm -f src/zyGrib
cd src/bzip2; $(QTBIN)/qmake; make clean
cd src/zlib-1.2.3; $(QTBIN)/qmake; make clean
cd src/proj-4.6.0/src/; $(QTBIN)/qmake; make clean
cd src; $(QTBIN)/qmake; make clean

Now open a terminal and change to the zyGrib folder and type make as below

cd zyGrib
make

This will now compile the binary which we will run and place it in the same folder system. It seems to produce a number of warnings which are not good news but it does run reasonably well when one finally types:

./zyGrib

It must always be run from that zyGrib folder so you may want to make a simple script to change folder and run it and put a launcher on the Deskto - my script follows

#!/bin/bash
# Script to run zyGrib normally placed in home/yourusername/bin
# and run by a launcher on the Desktop
# Remember to make the script executable.

cd ~/zyGrib
./zyGrib

I found the Linux version I had installed 3.4.2 to be slow and sometime froze for long periods (perhaps for good in some cases) when selecting, zooming or moving the map area displayed, in particular on the Wind with a small display so I also tried the running the Windows version under Wine and that was much faster and more reliable - this turned out to be version 3.4.1. This problem has been mentioned in the zyGrib forums so is probably particular to version 3.4.2 - hopefully it will be sorted.

xyGrib the easy way for Ubuntu

Two days latter the site said that repository was available for Debian/Ubuntu and I followed the xyGrib instructions on how to add the repository and key and then installed from it on my desktop computer. The proceedure is:

Firstly install the GPG key for the repository by entering in a terminal:

wget http://doc.hausser.ch/debpackages/dha-debpackages.key -O - | sudo apt-key add -

Then add the repository by adding the following line to /etc/apt/sources.list directly or by System -> administration -> Synaptic Package Manager -> Settings -> Repositories -> Third Party Software -> Add

deb http://doc.hausser.ch/debpackages ubuntu-dha free

The program can now be installed (in /opt/zyGrib) by apt-get in a terminal:

sudo apt-get install zyGrib

The files were placed in their proper places and a link to start it was was added in the applications menu under accessories - this is a much better way to go than compiling and installing from the binary.

A couple of days latter the version in the repository was updated to contain 3.4.2 and the Ubuntu Update Manager did its job and xyGrib was updated to version 3.4.2 which is now running fine on my Desktop Computer.

Runing the Windows version of zyGrib under Wine

I set up the Windows version 3.4.1 under Wine on the MSI Wind U100 before the repository was updated.

The Windows version is downloaded as an archive containing a folder called zyGrib-win which can be placed anywhere, even on the desktop for testing purposes. It is run by double clicking on the zyGrib.exe executable. Using Wine, if you set up a script run from a launcher you must change into the folder containing the executable before you run it. Logically it ought to be in your c: drive at c:\Program Files\zyGrib_win . Your virtual c:/ drive under wine is at ~/.wine/drive_c so the program should be at ~/.wine/drive_c/Program Files/zyGrib_win .

xyGrib versus Ugrib

I initially thought that Ugrib was more refined but comparitively the number of parameters you can display and map is small. The options to personalise the displays is also minimal in the free version. Once I had got used to zyGrib and set up some of the options like land and sea colours, cloud cover colour and map resolution I found it superior in almost every respect having a choice of far more plots and being far more configurable. It only lacks the meteogram facility for plotting the a time series at a chosen point ie precipitation, and wind predicted at my home for the next 7 days although you can use an animation to get a good idea of what will happen.

Email based services for Grib files and the Viewfax display program.

My experiences will follow but it is really all covered by Frank Singleton's who is an old friend and colleague's of mine who has written Weather for Sailors dedicated to meteorology and sailing. In summary I installed the beta of Viewfax - Airmail's Weather Fax Companion v 5.043 - under wine (Wine Is Not an Emulator) which is a simple viewer for Grib and other similar files and it worked exactly as described by Frank when tested using emailed GRIB files from www.mailasail.com/Support/Weather . You need Viewfax for the mailasail emailed GRIB files as I found that I could not get them to open in zyGrib. There are a number of other email requested GRIB files sources on Frank's pages under Free GRIB Messages and other Objective Forecasts - I tried a number.

Some of these services can be set up to send emails on a regular basis like saildocs which I have also tested out in a basic way. The GRIB files delivered by Saildocs can be viewed in Viewfax (under Wine in Ubuntu) and can also be opened in zyGrib which then provides animation and consistency with meteorological forecasts download directly in zyGrib online. A good way to work is to set up a link on the desktop to the folder used by zyGrib and drg the downloaded files into it. All these services seem to have a common access route whereby you send an emain with certain data in the Title or in the body and this is handled by an autoresponder which immediately sends the requested data back to you. In the case of saildocs this can be subscribed to on a daily repeating basis which is perfect as you can pick up very quickly alongside any other emails and examine the maps at your leisure.

15th July 2009

Tips and Tricks in Ubuntu

The Terminal and GUI alternatives

It is interesting that the commonest objection to Linux is that newcomers believe they have to use a terminal for many operations. It is often the best, simplest and safest way when you ar familiar with it but you almost everything in a GUI with a few tricks. Firstly you will need to be comfortable with right click menus as they will be used extensively to access operations from a GUI interface which would otherwise be done in a terminal. Mostly we will be working from the file browser rather than a terminal which is fine if one is working on ones own files and in ones own home folder - but what do we do if we want to work on system files owned by root? In a terminal we put sudo or gksudo in front and after entering a password we can temporarily run commands as if we were the root user. The trick if you want to work on the system files from within the file browser is to start up the file browser useing sudo so from then on every activity from within the file browser is done as if you were root including opening the text editor for editing system files and setting the permissions, ownership etc of a file via properties. This is very powerfual and also very dangerous if you forget that you are 'root'. All you need to know is the the command to open the file browser is nautilus and you can then open the browser (nautilus) as root by typing the following command in a terminal.

gksudo nautilus

But you you say, we are still using a terminal! The way round it is to create a 'Launcher' on the desktop or in a panel by

Right click on an empty bit of desktop
Click Create Launcher
Leave Type as: Application
In name enter: Root File Manager
In Command enter in lower case: gksudo nautilus
In Comments enter: Herein lie Demons - you will be running as Root - if you do not understand that back off!
Click OK

You can do the same sort of thing to add it to the Application Menu under System after Right click on Applications -> Edit Menus

So how does this work in practice? In setting up Ubuntu the way I want I have to back up then edit about 7 system files owned by root so I open my file browser as root using the launcher we have just made, enter your password and navigate to the folder holding the file. I use the drop down at the top right to put the file browser into the 'View as Icons' view. If the file is a hidden system file starting with a dot then you also need to do a Cltr h to display it. I now hold down the Ctrl key and drag the file I want to work on to an empty space - this makes a copy with (copy) added to its name. I now right click on the original file and click Open which will bring up a box offering to run in a terminal or display - we want Display which will open a text file in the text editor (gedit) as root so we can now make the changes we want and save then. We then close the text editor and then the file browser and that is it. WARNING do not delete files when running as root in a GUI as they go into roots Deleted Items folder which you have no easy way of emptying.

Setting up and using Scripts

Scripts are a very powerful feature of Linux. At their simplest they enable you to carry out any sequence of commands you could run in a terminal and need to repeat but they can also include constants, variables, logic, flow control and functions etc like any other programming language.

At this point I ought to introduce the concept of a shell as it will turn up if you do any reading about scripts. A Linux shell program interprets user commands, which are either directly entered by the user in a terminal, or which can be read from a file called a shell script. Shell scripts are interpreted, not compiled. The shell reads commands from the script line per line and searches for commands on the system which are passed them to the kernel to be run and other scripts which it runs in a sub-shell. In contrast a compiler converts a program into machine readable form, an executable file - which may then be used in a shell script. Don't worry if it does not all make much sense at the moment, you do not need to know even the grossly simplified details I have given above to make use of simple scripts.

It makes life easy if the system knows where to look for scripts, they can then be just refered to by the filename rather than having to explicely provide the 'path'. It is common practice to keep ones own scripts in a folder in your home directory called bin ie in /home/yourusername/bin or to use the abreviation built into the system ~/bin where ~ is short for the path to your home folder. You will meet ~ in lots of scripts so remember what it means - the advantage is not only that it is quicker to write but also that a script is independent of the username it is run from. Likewise . refers to the current folder you are in and .. the folder one level above.

One important piece of information for those who have used other Linux distributions is that the addition of a path to a /bin directory is set in Ubuntu linux in .bashrc not .bash_profile as is described in some places. Also note that files starting with a . are hidden - use View -> Hidden Files in the File browser to find them. The lines I added were:

# Additions to the standard ~/.bashrc file to set up path to
# /bin directory in home folder
PATH=$PATH:~/bin

To be continued

23rd July 2009

Re-configuring when adding a New Flat Screen Monitor

This is out of date sequence so I can keep all the book stuff together.

My elderly 19 inch Dell CRT monitor finally died after 9 years of use and I rapidly tired of a 13" screen so I looked at the various options. My criteria was that I wanted at least the same height and resolution of active screen area. I thus came to the conclusion that now wide sceen is the accepted shape I would need a 22" monitor to get the same height as a 19" 4x3 and the options were a 16x9 or 16x10 ratio - both gave a slight increase in the number of vertical lines (from 960 to 1050 or 1080) with the 16x10 giving a very slightly higher actual working area and half an inch extra height over whilst a 16 x 9 whould have left me with half an inch less height than before. The 1680 x 1050 screens were also appreciably cheaper than the 1920x1080 - I have no high definition kit so it was primarily for computer use although I did specify a Digital as well as Analog input. I ended up buying a LG W2242T 22" 1680x1050 screen with DVI and VGA inputs and a 4:3 screen option for use with machines such as the MSI Wind U100. It was on a special offer at ebuyer bringing the price down to £119 with free (slow) delivery.

When I put it onto the old home built machine I found I could not get any higher resolution than I had before and the settings had obviously not been updated. I looked in /etc/xorgs.conf and saw a comment that one could run a re-configuration of the xserver (window manager) which I assumed would be the equivalent of a reinstall when screen resolutions, keyboards etc are detected. So I ran their suggestion in a terminal:

sudo dpkg-reconfigure -phigh xserver-xorg

and after logging out and back in I had all the resolutions available under System -> Preferences -> Screen including 1680 x 1050. It is very sharp and clear and the wide screen transforms many programs as one can keep lots of side panels open at the side whilst still having an A4 sized working area in the middle. It is going to transform some activities such as graphics using GIMP which proved almost impossible on a 1024 x 768 screen

18th July 2009

 

Open Secrets

Publishing in Style using OpenSource Software

Formatting a book

Pauline has just got clearance to publish her second book after an 18 month wait so time for a change of direction.

Requirements for formatting a book for printing

Books have an interesting and variable set of requirements when you come to format, number and title the pages for printing. In particular, the various parts have different page numbering requirements and some may be un-numbered. It is best to try and decide on an overall layout before you start to format the book and preferably when you are writing it. The first major publication I produced was the thesis for my doctorate and I spent some time analysing all the others I could get hold of in my field so I knew what layout was conventional, the breakdown of content, average lengths of each part etc. I did that analysis at the end of the first year of my three, going on four year research program so I could write any background parts at an early stage and get the various drawings and pictures produced in parallel with other talks and publications, many at somebody else's cost! The same plannng is sensible for a book and a piece of good advice I was given was to look in the local library and see where your book would sit on the shelves and examine all those round it for format and with an eye to likely competition. Once on the shelf the cover and title are both paramount it getting your book even opened. The same applies on the internet but there is no substitute for a visit to a physical library to get your thoughts in order.

Whatever sort of book you are writing there are some conventions you will want to consider and probably follow. By convention the parts that make up a Book are:

  1. The Title page - un-numbered but in the initial roman numerical sequence (i, ii, iii etc)
  2. A page often refered to as The Verso as it is often on the back of the title page which contains the ISBN Number, copyright information and other standard text - un-numbered but in the initial numerical sequence (i, ii, iii etc)
  3. Dedication(s) optional or may be within Acknowledgements - un-numbered but in the initial numerical sequence (i, ii, iii etc)
  4. The Table of Contents and possible Tables of Figures, un-numbered but reflecting the following numbered parts (Prefice, Acknowledgements, Body, Appendices and Index) correctly. Left and right pages may need to be different. Numbered in the initial numerical sequence (i, ii, iii etc)
  5. Prefix and/or Forward (optional) - numbered in the initial numerical sequence (i, ii, iii etc) - left and right pages differ
  6. Acknowledgements - numbered in the initial numerical sequence (i, ii, iii etc) - left and right pages differ
  7. Body of book possibly broken into Parts (optional) and definitely Chapters. The page numbering is reset to start at 1 in arabic 1, 2 ,3 etc). Left and Right pages different layout because of the binding. Headings typically contain Title on left, Chapter on right. First page of each part and chapter different. First page of chapter often forced to be a right (odd numbered page) . First page of a part may only have Title of the Part and may follow a blank page without a printed number but still in the numbering sequence.
  8. The Appendices, References and Index (if present) will be similar or identical to the Body but with less information in the Header.
  9. Blank final page - must have nothing on it (used by printer to overlay information)

The main differences you will find are in the number of different sections that are present and how they are broken up. Some books will have quite a few blank pages so that the starts of the various sections are on a new page and on the right hand page. The may want to have a new part start on a Right hand page and have the following Chapter also sart on a right hand page. Starting all chapters on a right hand page is common but does add many blank pages. If the book will be produced only as an eBook or in in parallel with a real book then you will want to keep empty pages to an absolute minimum or remove them altogether in the eBook version.

The parts that make up a page are:

The information which will be found in the header/footer will include the Book Title, the Author and possibly the Chapter Title along with the page number and possibly a horizontal line to separate it from the body.

There seems to be no standards other than pages must be in a numerical sequence and even then some pages may not have a visible number! By convention the preamble pages have roman numerals and the numbering restarts in arabic from 1 at the First Chapter (or Parts if you have used them). Have a look at books in a similar area to which you intend to publish and there may be a concensus within that area you could follow.

It is worth while creating an outline of some form early on as I did for my thesis but one which can contain more information as you progress. The is an example of what I suggest and I have included a column marked Style which you will shortly come to understand

Section Page
No
First
Page
No
Header First Header
Left
Header
Right
Footer
First

Footer

Force
Position
Force Blank
Page
First Page Style Page Style Comments
Title - - - - - - - Right - Preamble - -
Verso - - - - - - - Left - Preamble - -
Blank                        
Dedications Roman - - - - - Page No Right - Preamble
Roman

-

Single Page
Blank                   Preamble -  
Table of Contents - Roman - - - - - Right - Preamble Preamble
Roman
-
Introduction Roman Roman - - - - Page No Right? - Preamble
Roman
Preamble
Roman
-
Acknowledgements Roman Roman - - - - Page No Right? - Preamble
Roman
Preamble
Roman
-
Blank ??                   Preamble -  
Part 1 - - - - - - - Right After Heading
Page
- -
Blank                   Heading
Page
-  

Chapters ...
~7 ~70pages

- Arabic - Book
Title
Chapter
Title
- Page No ?? - Heading
Page
Default -
Blank ??                   Heading
Page
-  
Part 2 - - - - - - - Right After Heading
Page
- -
Blank                   Heading
Page
-  
Chapters ...
~15 ~100 pages
- Arabic - - - - Page No ?? - Heading
Page
Default -
Blank ??                   Heading
Page
-  
Part 3 .... - - - - - - - Right After Heading
Page
- -
Blank                   Heading
Page
-  

Chapters ...
~9 ~60pages

- Arabic - - - - Page No ?? - Heading
Page
Default -
Appendices ...
3 ~5 pages
- Arabic - - - - Page No Right - Heading
Page
Postamble -
References
~9 pages
- Arabic - - - - Page No Right - Heading
Page
Postamble -
- - - - - - - - - - - - -
- - - - - - - - - - - - -

As the book progresses and your thoughts firm up you can fill in more of the table. You may then decide you need to bring out more on the Appendices and may be format them differently, perhaps more like the Chapters or you may want to add an Index. You can however at any time get an idea of the overheads you are adding in forcing starts to be on the right and other sources of blank pages.

What goes on a page

 

Using Open Office to format a book for printing

This is best done by defining a series of styles for the pages and text. The style is changed for a page in the book by inseting Insert -> Manual Break which provided the opportunity for a change in style and to reset the numbering. Normal page breaks inserted by Ctrl Enter do not change the style. In the definition of a style you specify what style follows for the next page ie a left page style will specify it is followed by the matching right page style and vice versa.

There is an excellent introduction to styles at http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Writer_Guide/Stylist

Unfortunately after a series of tests I discovered that saving an Open Office (OO) writer file in Word 97/2003 format does not save the Page Styles as they do not exist in Word 97/2003 so that did not help with getting a suitably formatted file to sent to Lulu.

Microsoft Word 2003 running under Wine 1.0 (stable version)

I had no obvious choice at this point but to consider using Microsoft Office - Pauline has a Student and Teacher Edition version 2003 which allows one to have 3 copies installed and I also have an unused copy of Office 2000 Professional. The obvious way forwards was to see if I could use Wine.

Wine (Wine Is Not an Emulator) enables one to run many Windows programs in Linux. To loosely quote the developers "Wine is an Open Source implementation of the Microsoft Windows API on top of the X windows system and Unix. Wine is a compatibility layer for running Windows programs and does not require Microsoft Windows - it is a completely free alternative implementation of the Windows API (Application Programming Interface) consisting of 100% non-Microsoft code". It is under continuous development and the number of applications it can handle has increased dramatically including a number of the most demanding games.

I checked at WineHQ and the tests on Microsoft Office 2003 were promising - several people had awarded Word 2003 a silver or higher which would be usuable and problems seemed to have been in installing what one wanted initially and in the equation editor, neither showstoppers for me. I therefore inserted the CD and ran the install as if I was on an XP box. The install went fine, it asked and accepted my CD code and I declined to authenticate it as I would have 50 runs to see if it was worth using one of my 3 'lives'. Most features I have tested seem to work although there have been a few strange things including my initial attempts to print but my tests have been on a huge document which has been reformated from A4 to the much smaller Royal size so it is difficult to know whether my problems were specific to running under Wine. It certainly has had many hours use with no more crashes than I would expect directly under Windows XP.

Microsoft Word 2000 runs under Wine 1.126 (beta version)

I tried to Install Office 2000 on another machine under Wine 1.01 (the stable version with Jaunty Jacalope) and it seemed to install OK but never accepted the CD key properly when installing Microsoft Office and just closed every program I tried (Word, Powerpoint etc.,) after 3 attempts at entering the key. I looked at WineHQ and the reports of success with Office 2000 were all with the development versions of Wine versions 1.1 so I decided in for a penny, in for a pound. I installed the latest version, 1.126, by adding the Wine repository and security key. There are full instructions at http://www.winehq.org/download/deb which are the basis of what follows.

First a warning: You will be changing from a tried, tested and stable version of Wine to be utilising the latest beta development packages which will be periodically updated and may suffer from regressions, and an update may break functionality in Wine for an existing program. The version of Wine available packaged in Ubuntu Hardy Heron and higher of is probably adequate for all but the most demanding applications. If you use the development version to get a particular program working you may want to stop updates at that point other than for security reasons.

The latest version is utilised by adding a new repository by System -> Administration -> Software Sources -> Third Party Software -> Add and copy and paste one of the lines below depending on which version you are running.

deb http://wine.budgetdedicated.com/apt hardy main

deb http://wine.budgetdedicated.com/apt jaunty main

After adding the repository, you also need to add the key for the repository to your system's list of trusted keys.

Download and save Scott Ritchie's key (right click -> save as) to your desktop. Then open the Authentication tab, click import key file, and select the key file you just saved (Scott Ritchie.gpg). You can delete this file after doing this step.

Click close to finish, and then reload the package information when prompted. If you have Wine installed, the system's update manager will now inform you of the latest Wine beta release and prompt you to upgrade.

This still did not get the already installed version of Word working so I had to do a total uninstall and start again after which it seems to run perfectly and almost all the menus, buttons and actions seem to be the same as below or similar enough that it is obvious.

Returning from a Beta to a stable version of Wine

I had to do this: Whilst Word 2000 seemed to work fine under the beta version 1.126 I found that both of my FirstClass programs did not and I had to change back to version 1.01 to get them back in operation and then Word 2000 stopped again.

To get back to the stable version first uninstal Wine using Administration -> Synaptic Package Manager then untick the Wine Development Repositories reached by Administration -> Software Sources -> Third Party Software then Reinstall using Administration -> Synaptic Package Manager. You may need to reboot as you are running a Windows like system. You should not have lost any of the programs under Wine as uninstalling does not remove the ~/.wine folders and each user has his own version of Wine.

Formatting the book in Word 2003

The follow instructions and screen shots have come from Word 2003 but the same functions exist and are accessible by different menus and different places in most versions of Word. It is also obvious that I am running under Ubuntu Linux (8.04) and Wine (1.0) from the screens shots for the disbelievers amongst you that you do not have to [initially] give up you Windows programs when you make the transition, in fact I used Dreamweaver running under Wine to write this section of the website to reinforce my point.

Now back to the actual job of formatting the book. Windows does not have Page Styles but you can get most of what one wants from the set up for a page. This is reached from File -> Page setup and I have taken screenshots of the 3 tabs I have changed.

 

The above left shows that I have selected a left and right page arrangement with an area called the gutter which takes into account the fact that a book is bound so you can not open it out flat. You can get the same effect with various combinations of gutter and inside margins.

The above right shows the custom size for a Royal size book from the Lulu Template..

 

This is the important and less obvious tab where it has been defined that the left and right pages are different and that there is a different first page - this follows every new section and is how you get a different layout for the first page of a chapter and for the initial pages.

We now need to understand a bit about Headers and Footers which are also mentioned. We are going use them for the page number and some other information such as the Title, Author or Chapter Title and they can be different for footer and header in each section and between the first, left and right pages. By default each sections headers are the same as the previous chapter - ie they are linked so if you set up the page number and Book Title anywhere in the body of the book in the header of a left page it will be on every page which is a left page which is what we want. We will not want it the Title on a first page as that is a new chapter but may want the page number. The problem comes if you use the Chapter Title in a header. You now have to stop it linking from section to section and this is possible but again the facility is well hidden.

First go to the section with the header you want to change and unlink. Microsoft Word is very crude and unrefined when it comes to headers and footers and you have to change mode to edit them by View -> Header and Footer

You will see the text in the body is greyed out and the header in surrounded by a dotted box. Most important note the important information above which gives the information that we are not only changing the Odd Page Headers in Section 15 but, because it states Same as Previous, also in Section 14 and whatever else it links back to and possibly every section that follows.

Lets now see how to make changes to the linkage and add and set up page numbers as well as adding text and lines. When you switcher to the mode where you can work on headers a new toolbar appears and disappears when you finish. This is normally 'floating' but you can drag it out of the way or lock it to the top or side.

You can only find out what the buttons do by hovering over thembut you can see one is a toggle which is depressed and that is the important one which defines the 'Same as Previous' and the one you will often need to click.

The first three are to do with page numbers and 1 and 3 are respectively 'Insert a page number' and 'Format a Page Number'

You can now see how we change the numbering format 1, 2, 3 or i, ii, iii, iv etc and how we restart page numbering when we leave the Title, Prefix and Contents which have roman numbering to arabic which is reset for the body of the book. The last three enable you to move quickly between headers and footers and backwards and forwards while you are setting up.

You should start at the begining by entering everything that will remain the same (page numbers, lines and the Book Title) and then work down unlinking the headers and footers as required and entering the chapter headings.

It goes without saying that before you start you should have made sure all the Chapter Titles have a style so they can appear in the Table of Contents - we are currently using reserving Heading 2 for Parts and using Heading 3 for Chapter Titles. Every Chapter Title should be preceeded by a Section Break which is inserted by Insert -> Break not a Page Break which you get by Ctrl Enter . You get the following choices when you do Insert -> Break:

We normally want to select 'Next page' as above but if you want to force a change to an 'Odd page' you can do so at the price of an empty page.

Show/Hide Button. It is often useful to show the formating information - spaces, end of paragraphs, breaks etc., - and this can be toggled by 'show/hide' which is a button on the toolbar which is easy to miss:

Show Hide button

Where do I find a Horizontal Line

The 'toggle header and footer' button: If you look to the right of the 'show/hide' button in the picture above left you will note I have added a 'toggle header and footer' button to the toolbar by Tools -> Customise -> Commands and dragging your selection to where you want it.

Horizontal lines: Another useful insertion for headers and footers which is difficult to find is a horizontal line, it is hidden in with borders see the picture above right

 

Fonts acceptable to Lulu

Arial - this is an example of Arial
Book Antiqua
Bookman Old Style
Century
Courier
Garamond - This is an example of Garamond
Palatino
Tahoma - this is an example of Tahoma

Times New Roman - this is an example of Times New Roman
Verdana - this is an example of Verdana
Symbols

Many of these are not standard in Ubuntu but can easily be added if you have a dual booted system from the Windows font file.

Adding Fonts in Linux so they are accessible from Open Office and Word running under Wine.

I initially wanted to install some extra Fonts in Ubuntu, namely the Nadianne True Type font I use for Invitations, Wine Labels etc. and the various Windings fonts which provide ticks and other symbols used by Pauline for marking Open University eTMA scripts. Some of the fonts used by Lulu are not standard under Ubuntu so also need to be added. Nadianne is not a standard Windows font and originally I think came with a printer but the others are common to Windows XP hence the need to import them for marking. There should be no licence issues in using them on a dual booted machine with a valid copy of Windows. You can find the the Windings and other fonts in c:\windows\fonts. The True Type fonts which are available to all users are stored in folders under /usr/share/fonts/truetype in Ubuntu Linux so type in a terminal:

gksudo nautilus /usr/share/fonts/truetype

Next I created a new folder for your extra fonts which I called ttf-extra by a right click -> create folder etc.

Drag the extra fonts into the ttf-extra folder from where they were stored

Then alert Ubuntu that you added the fonts by typing the following in a terminal

sudo fc-cache -f -v

This rebuilds the font cache - the options are verbose and to force complete regeneration of the cache (neither may be necessary but I followed the instructions before reading the manual page)

It is possible from something else I read that creating a folder .fonts in your home directory and copying the font into it may be sufficient for a single user - I have not tried it. Other Linux systems may store fonts in a different place so you can try a search for truetype or fonts.

 

24th July 2009

Covers for Publishing via Lulu

I have been exploring the use of GIMP to produce the cover for Pauline's Book. GIMP is not the easiest program to use as it goes back a long way to before GUI interfaces had become reasonably standardised beteen operating systems. It is howver very powerful as I have discovered in the past. This time I am using it in a different way to previously and it took a days to get up the learning curve to be able to do anything useful including several hours working through the help system and introductory tutorials. In particular I wanted to be able to use the layers facility as I had the cover picture scanned in two parts and I wanted to be able to merge them and then make the unpainted sky area transparent so I cound change the background under the text for the title, subtitle and authors name. Eack block of text you add in GIMP has its own transparent layer with the text in a font, colour etc of your choice but not changeable within the block.

Lulu has two options of interest for creating a Cover using ones own full size graphics - the first takes one or two full size graphics and I will get to defining full size, and creates the spine with a Title, Author etc for you. The second allows you to upload the completed cover including the spine. The second needs you to calculate the width of the spine from the number of pages and you also have to add all the back cover text to the large graphic. The reason to use the second route is that it seems to be the only way to add your own ISBN number rather than ones which they issue in their own name as Publishers.

So what are the sizes needed? It is not just the final book size as there is a certain amount of trimming after the book is bound which can take off up to .25". Lulu provides various templates and information but the bottom line is that the covers for a Royal size book need to be 1890 x 2835 pixels and set to 300 dpi - this gives an etra .15 inch on the unbound edge and .25 for the top and bottom. Their template also indicates that you should count the outermost 105 pixels as a buffer which is clear of text. I have been working with an image of 2000 x 3000 to give me some scope to trim at the end. I have decided on doing it in several layers once I had combined my scans, a one off job. The layers are

  1. Author text - white
  2. Sub Title text - black
  3. Title text - black
  4. Pauline's Painting with a transparent area for the background
  5. Background 2 - Blue Colour - Transparency adjused to lighten background
  6. Background - White

If we make a full cover the layers will have to increase with a layer for the spine ( a graphic???), another background colour or split the existing background and layers for each set of text and graphics on the back cover plus the graphic for the Barcode with the ISBN number. If the background is the same under the spine and the back cover then we can just make final adjustments on the edge of the back cover for a few pages more or less.

The cover size for Royal is given in the cover tables at http://www.lulu.com/uk/help/book_covers_faq#cover_dimensions to be 6.265 x 9.459" or 15.91 x 24.024cm (1880 x 2837) and this is a very good match to their template which you can download of 1890 x 2835 which is x 24.0 cm

 

Royal Word Processor Page and Full Cover Template Dimensions

Word Processor Custom Page: 15.60 cm x 23.40 cm

Full bleed cover image to upload to Lulu Cover creator (Lulu template) 1890 x 2835

Full page for the cover PDF: 31.8 cm + spine x 24.0 cm

Images for front or back as part of full page cover: 1878 x 2835 pixels

 

1st August 2009

Books in OpenOffice 3.0

I have spent a long time trying to get the desirable layout for Pauline's book with respect to the various types of pages, the Table of Contents, Headings for the various 'levels' and the ability to add the chapter to the Headers on right hand pages. This is all done by a combination of Styles and the Outline of the document. From the start I have been using Paragraph Styles to define the layout of each paragraph and Page Styles to get the 'mirror' layout required for a book where left and right pages have to be different because of the need to allow more margin against on the side adjacent to the spine where the book is bound. However when I started I did not realised the significance of the Outline.

Document Outlines and the Table of Contents.

Every document in Open Office has an Outline but its importance is far from obvious in simple documents. The Outline is what determines the layout in the Table of Contents and much of the automatic numbering in headings - neither are present or active by default so the impact is not visible initially and it is only when one come to do 'clever' things that it all becomes obvious, or in my case obscure! The explanation that follows may be a simplification but it got me to the point where I understood enough for laying out the book.

In this part of my Howto I am going to make the assumption that we will use the Style Heading 3 for our chapter headings in the book [and that we may want to have the chapter number automatically added to the text we enter for each chapter title and in the Table of Contents]

Firstly the Heading Style is directly related to the the Levels in the Outline - every time you add a Heading x (where x is 1 to 10) to your Document you add another entry to the document Outline at level x. In a default situation everything which is in the document Outline is in the Table of Contents (TOC). The initial styles for the the Various Headings are defined and these map onto styles for the TOC ie the Heading 3 style which is about right for a book chapter without changes will be mapped to a style called Contents 3 which again will look sensible in our contents list. You can then change the styles for Heading 3 and Contents 3 to suit your exact requirements in the book including adding automatic numbering.

Initially there are no numbers displayed with these Heading or Contents styles. The numbers can be set up using Tools -> Outline Numbering. In the Outline Numbering you become fully aware of Levels - Heading 3 by default is linked to Level 3 of the Outline. See below for how I have it set up for Level 3. Only Level 3 is changed from the defaults and looks like the following:

 

You will note that I have specified the Number using the drop down list on the first tab and on the second I have set that the number is followed by a tab to space it away to an absolute position of 1.4 cms and also an indent of 1.4 cms to align the text if it is more than one line in length. After this the display of a Heading 3 has a number in front of it in the body of the text.

We now need to insert a Table of Contents at the front of the book by Insert -> Indexes and Tables -> Indexes and Tables. We get the following which is OK for the Index/Table Tab.

We now need to look at the Entries Tab which initially looks like the following when we click on Level 3:

The changes needed to format the table of contents do not follow any standard method I have met. The line called Structure is what does the work and you can find out what is there and what it does by hovering over each entry.

We now want to separate the Chapter Number and the Entry text by a Tab Stop which we will need to add. Click the box between the |-# and the |- then click the Tab Stop Button after which we get a display like the following which includes our new Tab:

You will see that a new entry has appeared in the Structure with a T in it. I have already set the Tab Stop position to 0.80 cms. If you want to edit this (or the tab at the end) then you click on the T to get the configuration as displayed. If you want to delete an entry completely click on it then hit the Del key on your keyboard which will remove it completely.

You do not need to change the other 3 tabs

If you want to make changes to an existing TOC right click anywhere on it and click Edit Index/Table to get back to the above display.

Assuming we only have Heading 3 we are now set for automatic numbering.

It would however be nice to put the 'headings' for all the other pages in the preamble and postamble into the table of contents. It would seem logical to add these as more Heading 3s but that does not work as they are also numbered which we do not want - the same goes for the Parts. These have to be added as Headings at a lower level such as 4 and 5 to avoid them messing up the numbering. The initial Styles for Heading 4 and Content 4 will need to be changed to give sensible displays in the book and in the Table of Contents. It took me hours to realise that this seemingly back to front way was the only easy way to avoid the number sequence being disturbed. I therefore use Heading 4 for the Parts and Heading 5 for headings such as acknowledgements and references and change the styles to roughly match what was used by Headings 2 and 3 and Contents 2 and 3.

Editing Styles

There are several ways to get to the Style you want to edit - I will chose a general way which allows one to carry out most of the operations involving Styles you will need to do to format your book. This is to use the Styles and Formatting floating Panel. You can toggle it on and off at least 3 ways: by clicking on the big button to the left of the Style drop down on the Formatting Toolbar, by F11 and by Format -> Styles and Formatting. The first is easiest. It looks like:

The first 5 buttons across the top select between styles for paragraphs, text, frames, pages and lists. The last button allows you to create a new style based on the one selected. At the bottom you can filter the styles which are displayed - it is set to Applied which restricts the display to those in use - at times you may need to see them all to apply a new style. If you want to apply a style you can drag it onto the page, paragraph, selection etc. When you want to edit it you right click the style and click modify.

If you have a reasonably big/wide screen it makes life very easy if you drag the panel (by the top bar) to either side at which point it will attach itself (dock) and the the editing area will will resize to match. You can then keep it there all the time or toggle it by the button as above.

You will probably want to check and possibly change 5 of the tabs for paragraphs: Organiser, Indents and Spacing, Alignment, Fonts and maybe Borders.

We will now look at my requirements and how I have modified the Header 3 Style to what I want for the chapter titles in the book.

So I open up the Styles and Formatting Window as above, select paragraphs (first button) right click Heading 3 and click Modify which gives me:

You will see that I am in the process of selecting one of my own Styles to follow a Heading 3 - a nice touch but you can always change it afterwards. Now to any easy part:

We have chosen Arial Bold 12pt for our chapter heading above. Now the difficult part - indenting and lining up the text on the subsequent lines of the title:

You will note that the first line is brought back so the overall indent to the chapter number is 0.6cms then all the text lines up at 1.40 cms from the margin. There is also a vertical space of 0.52cm above the chapter title to space it from the top margin and 0.71cm below to space it away from the first paragraph of text which we have chosen to be my bookflush style (which does not have any spaces on the start of the first line)

You will need to do the same Indentation trick on the Contents 3 style to line everything up in the Table of Contents even if you make no other changes.

Contents 5 used for other section headings has a 0.80cm indent to also line up with the text in the 'body' and no difference for the first line.

Setting up the Page Styles and Pages in the Book

If you are setting up or changing a Page Style you will want to check or change: Organiser, Page, Header and Footer. Organiser is important as it defines what Page follows - Default will be followed by Default, a page with a Book Chapter Title (your Header 3) will be followed by Default. Specially defined pages for the Preamble and Postamble will be followed by identical pages. The main setting up is on the Page tab which is where you define the size of paper, all four margins, the layout (mirrored) and Numbering (used in page numbers etc). The Header and Footer Tabs are self explanitory and need to be set sensibly to match up with the margins set earlier and with other page styles in use. The following is an example of the Page tab for my Default Page Style.

Above should be Width 15.6 and Height 23.4

It is best to set up the Default Page tab first the you can base the other Page styles you use on it. I have 3 additional Styles: Heading Page, Preamble and Postamble. Default has a Header and Footer and is used for the body of the book. A Heading Page starts each 'chapter' in the body of the book or other sections and has no Header or Footer, they are also used for blank pages which have no footer (page number). Preamble pages have Roman Numbering for the page number in the footer and no Header and are used for the continuation pages for the Prefix etc which are placed before the main 'chapters' of the book start. Postamble pages have no Header and Arabic numbering for the page number in the footer and are used for the continuation of References, Acronyms etc.

Where a Footer is present it just contains a centered page number. A page number is inserted by Insert -> Page Number.

Where a Header is Present (ie the Default Page with a Header 3) it contains the book title typed in on any left hand page and a right justified Chapter Title on the right hand pages inserted by Insert -> Fields -> Other -> Document -> Chapter -> Chapter Name - Set Level 3 -> Insert. The Chapter Field can then be selected like any other text and Right Justified and the font and font size can be chosen to match the book title on the left hand pages.

There has to be a Manual Page Break before each change of Page Style - a Page Break using a Ctrl Return is not sufficient as you can not chose the new style. This is done by Insert -> Manual Break and selecting Page and chosing the Style of the following page as below for a page with a heading:

You do not need to always change the style following a Heading Page as you will recall we set up the Organiser tab for the Heading Page to set the following Page to have Style Default. If it is in the preamble and postamble areas we do need to use a Manual Page Break to change the Style and it is probably safer to always do so. Unfortunately the Manual Page Breaks do not appear as a field which you can see although the top margin outline is slightly thicker.

Other codes and fields can be made visible by a combination of Tools -> Options -> OpenOffice.org Writer -> Formatting Aids and View -> Options .

5th August 2009

Cover Page for Books on Lulu

There are a number of 'tricks' in laying out a book cover. First you need to know the exact size of the cover required and be prepared to correct to what is requested when you get to that point. You can then complete the image to the exact size to match the front cover and insert it on the right of a Openoffice page which you set up. As the number of pages changes you may need to make small adjustments to the size.

The spine text can be set up using a text box accessed via the Drawing Tools toolbar and rotated after the text has been inserted. The text box can be exactly sized to match the spine using the various numerical options rather than draging the corners and after rotation can be positioned exactly the same way.

Background colour is where we need a trick as the colour is normally only under the text area and not under the margins. The trick is therefore to reduce the margins to the size that you want covered by background colour ie left, top and bottom margins to 0.0cms and the right margin to make sure you have a text area extending under the spine. Then set a border for the page which is the same colour as the background and give this a border width to provide the text area you require. The following screens shots will make it all clear:

First set the background colour:

Now set the size of the page and margins to define the area we want to be the background colour ie the whole left side and extending under the spine.

Now we defining a border which is the same colour as the text and delineate the area for text by setting the spacing to the contents. You will find there is a limit of 5 cms hence the size large of the right margin above.

And we now have what we want.

 

Valid HTML 4.01 Copyright © Peter & Pauline Curtis
Content revised: 2nd August, 2020