# Rule at the end of chapter: vertical and horizontal aligning

I want to place in the end of the chapter a short horizontally centered line, aligned vertically in the proportions of 2:3.

Everything works except of the horizontal alignment.

MWE:

\documentclass{book}

\usepackage{blindtext}

\usepackage[showframe]{geometry}

\begin{document}

\blindtext

\clearpage

\blindtext\blindtext\blindtext\blindtext

\vspace{\stretch{2}}

\begingroup\centering

\hrule width .25\textwidth height .5pt

\endgroup

\vspace*{\stretch{3}}

\clearpage

\blindtext\blindtext\blindtext

\blindtext\blindtext\blindtext

\blindtext\blindtext\blindtext

\end{document}


• Consider replacing the TeX macro \hrule by LaTeX \rule{width}{height}. See e.g. here. – campa Oct 9 '15 at 12:53
• @campa, yes, I tried but now vertical stretching doesn't work correctly with \rule. – web-stranger Oct 9 '15 at 13:12

a \rule is set at the bottom of a text line, so it is lower than you might think. thus, you need to raise it so that it is vertically centered on that (otherwise invisible) line.
this formulation of the \rule command (ending with \par to ensure that it is just one line) comes close. the [1ex] is the amount the rule is to be raised.
\rule[1ex]{.25\textwidth}{.5pt}\par