[Solved] Vertically Centering Text

Discuss the word processor
Post Reply
User avatar
James Glover
Posts: 16
Joined: Sat Oct 15, 2016 10:57 pm

[Solved] Vertically Centering Text

Post by James Glover »

 Edit:  
Hi All,

How do you vertically center text on a line?

Please see the attached image.

I want to center the highlighted text, what I call a chapter header.

To be clear, I want the space immediately above the highlighted words SAMPLE TEXT to be the same as the space immediately below it but on the same line.

You see how here are are 1-2 pixels of space above the words SAMPLE TEXT, but 2-3 of pixels of space below it? I want them to be the same. I know this is possible because I have other chapter headers that meet this criteria, but I don't know how to adjust it.

Many thanks as always,

James
Attachments
sample text 1 attachement
sample text 1 attachement
sample text 1.jpg (16.22 KiB) Viewed 7860 times
Last edited by James Glover on Thu Jun 29, 2017 12:37 am, edited 1 time in total.
OpenOffice Version 4.1.3
Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Vertically Centering Text

Post by acknak »

In the simplest case:
Click in the heading, then Format > Paragraph > Indents & Spacing > Spacing ... and set the "Above/Below paragraph" settings to the same value.

From your screen capture, it looks like there are other elements—a frame or graphic on the left, for example. Depending on how those elements are anchored & wrapped, etc. the simple spacing may not have the effect you want. In that case, we're going to need to know more about your document, or perhaps simplest, to get access to a sample document.
AOO4/LO5 • Linux • Fedora 23
User avatar
James Glover
Posts: 16
Joined: Sat Oct 15, 2016 10:57 pm

Re: Vertically Centering Text

Post by James Glover »

Hi acknak,

As per your first suggestion, format/paragraph/indents & spacing, the above and below paragraph settings are the same.

I've attached a sample page.

In this example, the only highlighted subheader text that appears correctly (evenly spaced above and below on the same line) is Chapter 1 Subheader 3.

The chapter header font is Destroy, and the subheader font is Asimov from fontspace, which are free.

James
Attachments
SAMPLE PAGE 3.odt
(12.43 KiB) Downloaded 207 times
OpenOffice Version 4.1.3
Windows 10
User avatar
James Glover
Posts: 16
Joined: Sat Oct 15, 2016 10:57 pm

Re: Vertically Centering Text

Post by James Glover »

Oops, in the sample page doc, my spellcheck error is due to a lowercase leading character for the first word of the chapter 2 header.
OpenOffice Version 4.1.3
Windows 10
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Vertically Centering Text

Post by Zizi64 »

The vertical spacing of the charaters in a line of the paragraph (it more visible by the usage of a background color for the paragraph) depends on the applied FONT TYPE. You must choose an appropriate font set (install it for your op. sys, and select it in your document)...
Font spacing.png
I have not neither Asimov, nor Destroy, nor Leander, nor Libre Baskerville fonts that you used in your document, but the missing fonts will be replaced when I open your document.

Please upload a picture (screenshot) about the problem.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
erbsenzahl
Volunteer
Posts: 255
Joined: Tue Apr 18, 2017 8:23 am
Location: Germany

Re: Vertically Centering Text

Post by erbsenzahl »

Hi,

I downloaded your text file. For better understanding: Does it make sense to include a section into a section?

Now to your question as written above...
James Glover wrote:To be clear, I want the space immediately above the highlighted words SAMPLE TEXT to be the same as the space immediately below it but on the same line.
You see how here are are 1-2 pixels of space above the words SAMPLE TEXT, but 2-3 of pixels of space below it? I want them to be the same.
This is a property of the used font. You should create a new/other style for the paragraphs containing headlines and apply to all of your existing or new ones. Then you could enlarge the spacing above; if necessary fix the line spacing. Be aware that the paragraph's background will not follow the enlargement.
What you probably want is to alter the built-in proportions of the font what cannot easily be done. Maybe Scribus could do it better, but I'm not experienced in this dtp program.

Alternatives (quick and dirty): You may insert your headlines in a table cell, then you easily can apply vertical centering your text. But the problem of the font's specific properties will remain. If you need some other background for your text it will work as background of the table cell.
 Edit: Why do we have these problems? Think about small letters like y, p, g, j... - they also need space in a line, below the base line (body line). And don't forget the proportions, they regularly don't demand symmetric structure... 
Last edited by erbsenzahl on Sun Jun 18, 2017 9:54 am, edited 2 times in total.
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
User avatar
RoryOF
Moderator
Posts: 34611
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Vertically Centering Text

Post by RoryOF »

I would place my text in a frame and use the Background property of the frame to give the desired colouring.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Vertically Centering Text

Post by John_Ha »

... or in a table cell and do the same thing.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 34611
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Vertically Centering Text

Post by RoryOF »

One thing to check is that the Paragraph Style used for the text does _not_ have "Automatic" selected on its Indents and Spacing tab, as this will displace the text slightly to the right (1 em).
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
RoryOF
Moderator
Posts: 34611
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Vertically Centering Text

Post by RoryOF »

erbsenzahl wrote:: Does it make sense to include a section into a section?
My answer is not with reference to the discussion in this thread, but to the question quoted above: Yes, I think it does make sense that sections can be included within sections.

An example: One might write chapters of a work, each in its own section, so that the individual chapters can be displayed or hidden. This is the way I normally work. Each of my chapter sections is given a different background colour (for editing, not for printing), so that I am aware when I move from one chapter to another. The ability to insert a section within any Chapter section allows, for example, an area to be formatted in columns within that Chapter, or marked with a different background colour as an aide memoire that it might need rewriting.

Of course, one does not have to use sections within sections, but it can be useful. There are, no doubt, other ways of achieving these results, but the above is how I do it.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
erbsenzahl
Volunteer
Posts: 255
Joined: Tue Apr 18, 2017 8:23 am
Location: Germany

Re: Vertically Centering Text

Post by erbsenzahl »

@RoryOF
Thanks for your explanation. Maybe the thread starter James Glover had intended things like that. In the downloaded file this circumstances may be in a reduced procedure so that it was a riddle for me why he acted this way.
Cheers
LibreOffice current versions 7 and OpenOffice 4.1.15
on LinuxMint 20 - 21 Mate, W10-64 pro
User avatar
James Glover
Posts: 16
Joined: Sat Oct 15, 2016 10:57 pm

Re: Vertically Centering Text

Post by James Glover »

Many thanks to everyone who helped to offer advice and troubleshoot this.

As was said, the easiest fix was to insert frame, select text, enter text, and then format character.

I also found another font that didn't require this technique, which I'm using on a different doc.

A footnote: it still bothers me that on my original doc, the uppercase highlighted text rendered correctly with equal space that appeared above and below on the line. I tried numerous times to clear the style format of a page target area, and then copy/paste the correctly appearing text to that new area, only to have it revert when I edited the page and it moved from the line. I avoided this problem with my last published doc by inserting a filled rectangle as a graphic element that spanned the length of each highlighted header, taking up the empty space.

I learned a few new things this time. As my page layout is based on a template, I'll implement the text frame solution for the next go 'round.

Again, thank you all!

James
OpenOffice Version 4.1.3
Windows 10
Post Reply