I am centering a text:
\documentclass{memoir}
\renewcommand{\partpageend}{} %% can write after part title
\usepackage{graphicx}
\renewcommand{\beforepartskip}{% added <<<<<<<<<<<<<<<<<
\centering
\includegraphics[width=0.4\linewidth]{example-image}
\par\vfill
}
\begin{document}
\part{This is a title}
\begin{center}
\textbf{This text is being centered and that's what I want.}
\vfill
\end{center}
\newpage
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
This text should not be centered anymore.
\end{document}
But after \end{center}
everything else is still being centered.
Thank you in advance.
Best Answer
As has already been noted by @HeikoTheißen in a comment, the centering issue you're experiencing arises because the
\centering
command in the definition of\beforepartskip
is not in a (TeX) group and hence persists. The fact that the document also features, separately, acenter
environment, is immaterial.One way to fix this is to replace
with
Can you spot the extra instances of
{
and}
?