Expertsystemen

 

Adding anchors and references

The anchor

The next step is to set an anchor in the text fragment to which you want to be able to jump. The anchor is added as in the picture below:

adding the anchor
adding the anchor

The anchor is written as [anchor.referencechapter2], where anchor indicates we are dealing with an anchor or reference, and referencechapter2 is the name of our anchor. We know it is an anchor, and not a reference, since the code contains just two parts.

The reference

Now that we have an anchor, we may reference it. The text fragment containing the reference looks like the picture below:

adding the reference
adding the reference

The code for the reference is written as [anchor.referencechapter2.1]. The first part, anchor, indicates, again, that this code is part of a reference or anchor. We know it is a reference, since there are three parts. The second part, referencechapter2, is the name of the anchor we made earlier want to refer to. The last part, 1, is the link text you can read and can click on.

Note that we have used the number 1 here for the link text. This could have been anything, it need in fact not have been a number. This link text will serve as the initial link text in the document. The actual eventual link will be based on the number of the list item our destination anchor happens to end up in. We will see this happening in the next article.

Note that, while in the above examples we included just the code for the anchors and references, we could have very well also added extra text around them.

Properties of the reference

In Word, a reference can have a lot of properties:

properties of a reference link
properties of a reference link

These properties all have their effect on how a link is shown in the document. The checked boxes you see in the image are the default way that references are inserted in Word by the xxllnc Expertsystemen Server: the full reference number.

Sometimes though a different kind of reference is needed, for example, consider the following numbering: ‘4.4 sub c’. If we want the link text to be just ‘c’, we need the paragraph number in its relative context. You can make the reference ‘relative’ by adding %r (for relative) at the end second part of your reference:

[anchor.referencechapter2%r.1]

If you want to show the entire text of the paragraph your anchor occurs in instead of its number, use %t (for text) in the second part of your reference:

[anchor.referencechapter2%t.1]

It is also possible you want the reference to be in lowercase (%L) or uppercase (%U). This is possible by using %L and %U after the optional first % reference.

[anchor.referencechapter2%t%L.1]
[anchor.referencechapter2%L.1]