3

I tried two of the solutions given on this forum. Neither of them really center the text. I put one below. It's off by quite a bit. I'd like it centered measuring from the textblock(?...the rectangle where the normal text is written) to the middle of the letter height (the capital letter is fine).

%\documentclass[a4paper, 11pt, oneside]{book} % A4 paper size, default 11pt font size and oneside for equal margins

%PACKAGES
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{fancyhdr}
\usepackage[paperwidth=6in, paperheight=9in, showframe]{geometry}

\fancypagestyle{clearstyle}{\fancyhead{}\fancyfoot{}}

\begin{document}
\begin{center}
\vspace*{\stretch{1}}
{\Huge \textbf{\textit{Too Low}}\par}
\vspace*{\stretch{1}}
\end{center}

\clearpage 
\end{document}

3 Answers3

4

Just use this (albeit, in my opinion, the golden ratio would be finer).:

\begin{center}
\null\vspace*{\stretch{1}}
{\Huge \textbf{\textit{Too Low}}\par}
\vspace*{\stretch{1}}\null
\end{center}

\clearpage

enter image description here

Here is a code with values for stretch approximating the golden ratio (for the text area):

\begin{center}
\null\vspace*{\stretch{1}}
{\Huge \textbf{\textit{Too Low}}\par}
\vspace*{\stretch{1.72}\null
\end{center}

enter image description here

Bernard
  • 271,350
2

You may use textpos to place your text absolutely in the middle of a grid- However, when the text is centred in the middle of the page, it will optically look as too low.

I have not compensated for the height of the textbox, so probably, the text should place approximately 2 mm higher.

enter image description here

\documentclass[a4paper, 11pt, oneside]{book}

\usepackage{libertine}
\usepackage[absolute]{textpos}
\TPGrid[-7mm,0mm]{210}{290}

\begin{document}
\begin{textblock}{54}(78,145)
{\Huge \textbf{\textit{Too Low gg}}\par}
\end{textblock}
\end{document}
Sveinung
  • 20,355
1

Below I use eso-pic's \AtTextCenter to place an object at the centre of the text block. Since the object is text, which is placed on the baseline, dropping (or raising it with a negative distance) it exactly halfway helps to centre it vertically on the page.

enter image description here

\documentclass{book}

%PACKAGES
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{eso-pic}
\usepackage[paperwidth=6in, paperheight=9in, showframe]{geometry}

\begin{document}

\pagestyle{empty}

\mbox{}% Just to put something on the page
\AddToShipoutPicture*{%
  \AtTextCenter{%
    \makebox[0pt]{\raisebox{\dimexpr-.5\height+.5\depth}{\fbox{\Huge\bfseries Lazy fox}}}%
  }%
}

%\clearpage% Ship out page

\end{document}

You can, of course, remove the \fbox and other elements that don't fit with your usage.

Werner
  • 603,163