Vertical centering of section layouts

Hi Keith, thanks for all you do on here. I’ve poked around via search and seen that people who request vertical centering are usually referred to pagepadding within the section layouts menu, but I would like to provide my own example that makes this hard-return method impossible – I’m writing a book with poem epigraphs for every chapter, meaning that a chapter title and the following poem will make up a sort of “title page” for each chapter. Obviously, all the poems are of different lengths, so I can’t use a single section layout to keep all their formatting organized. Futzing around with my frontmatter in the past has proven a bit tedious for this same reason: hard-returns are great, but when the vertical length of a section layout is in flux, it causes complications.

Is a vertical centering option anywhere on the roadmap for future features? It seems there’s a lot of inquiry about it. Once again, thanks for your hard work!

Josh

I don’t think you’ll find an easy way to do this within Scrivener, as I haven’t found a way to create vertical alignment.

The workaround I would suggest is to put your epigraph in a table with one column and one row. Unfortunately the table formatting in Scrivener is basically non-existent.

However, if you output to Word, this will output your table. From there, you can select the table, select Table Properties, then on the Row tab, select Centered as the vertical alignment.

Word has a nice macro recorder that you can use to automate this task. To enable macros in Word (they’re hidden by default):

  1. Click File at the far left of the menu bar, then click Options at the bottom left of the screen.
  2. On the Options dialog box, select Customize Ribbon.
  3. In the right pane of the chooser, you’ll see check boxes for all of the available top level menu buttons. Check to select Developer, then click OK.

To record a macro (a series of commands that you can assign to a button for playback):

  1. In your document, click the Developer menu.
  2. On the ribbon, click Record Macro. You’ll see a little icon like a cassette tape. Word will now record all your keystrokes.
  3. On your keyboard, press Ctrl-H to open the Find/Replace dialog box.
  4. Click the Go To tab.
  5. In the Go To What list, scroll down and select Table.
  6. Click the Next button, then click Close.
  7. Mouse over the top left corner of the table until a box with a + appears.
  8. Right click on that box and select Table Properties from the shortcut menu.
  9. On the Table Properties dialog box, click the Cell tab, then under Vertical alignment, click Center, then click OK.
  10. You have now completed the macro. Click to open the Developer ribbon, then click Stop Recording.
    To run your macro:
  11. Click Visual Basic on the far left of the Developer ribbon. This opens a new window with the source code of your newly created macro.
  12. Notice that there are playback controls just below the menu bar in this window. Click Play to execute your macro. Repeat until all your tables are formatted.

Note:
Take care with this macro if you have other tables within your document whose formatting you do not want to affect. In that case, you’ll need to “undo” the formatting on those, then move the cursor out of the table before clicking the Play button again.

When you’re done, save the document. You can then drag the .DOCX file into Calibre, then convert it to your preferred ebook format.

This barely scratches the surface of Word’s macro capabilities. If you’re inclined to dig deeper into simple programming, you can add logic to your macro to repeat the commands until it reaches the end of the file.

You can also copy your macro to Word’s document template “Normal.dotm” so it’s available in all documents associated with that template.

2 Likes

This is a really clever workaround, thanks!

1 Like