Insert the page number in your footer or header and make all formatting adjustments.
Then, create your shape in such a way it is located inside the header/footer area. This is easier if you enable View
>Formatting Marks
.
Right-click on shape and Area
to select None
fill mode.
Right-click again on shape and Position & Size
. Check the Anchor is To paragraph (otherwise set it so). Set Width and Size to the required dimensions (at least larger than roughly twice the font size of the page number). In the Position section, set Horizontal to Center
to Paragraph text area
ant Vertical to Center
to Paragraph text area
.
The result is:
EDIT 1
To address the shortcomings mentioned in the comment below, I found a contorted workaround. It is quite difficult to tune it, but it gives a good approximation.
The basic idea is to anchor the shape To Character.
CAUTION 1! Succeeding in positioning the anchor is tricky. For best results, work with a high zoom factor (200% seems a bare minimum because the anchor mark is a fixed-size icon) so that the mark becomes “small” with regard to character size or at least the same size…
CAUTION 2! When editing text close to the anchoring point or field, you may easily lose the relationship between shape and character and shape will revert to anchoring on first character of paragraph.
Once, you have set anchot mode To Character, drag the anchor mark along your sentence until the mark is located above the desired character or field.
Since it seems to be impossible to Arrange
>Send to Back
the shape relative to text (only shape against shape), you must either set fill color to None or play with Transparency
.
Basic Position é Size
ic Center
/Center
as explained above. However, it looks like the center point is the lower left point of the character bounding rectangle. This causes the shape to be offset to the left of the optimal position. To compensate for that, I set the horizontal position as From left
by xxx Character
. In the image below xxx is equal to -0.8 cm so that 2-digit page numbers appear centered in the shape. Single digit and 3-digit page numbers are no so well centered.
Note also I put tabs around the combined shape/field in order to move it by modifying the tab setting. This is also to take into account the shape because you can’t rely on wrap options to “space” the “object” from surrounding text. An alternative is to type enough spaces to create the separation, but this is bad practice and you become dependent on actual content of the field.
Since the shape/field is a combined “object”, it is aligned (left, right, center) like a charm by Writer machinery.
Experiment and enjoy.
Result:
To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!