# Centering List of X and Following with Text

With the tocloft package, I can add text under the title of a "List of Z" at the beginning of a latex document:

\renewcommand{\cftafterZtitle}{\par\noindent \textnormal{Z} \hfill \textnormal{PAGE}}


Using the following I can center the title "List of Z":

\renewcommand{\cftZtitlefont}{\hfill\bfseries}
\renewcommand{\cftafterZtitle}{\hfill}


But when I try to combine the two commands, it moves the text to the right margin instead of the center:

\renewcommand{\cftloftitlefont}{\hfill\bfseries}
\renewcommand{\cftafterloftitle}{\hfill\par\noindent \textnormal{Z} \hfill \textnormal{PAGE}}


Does anyone know how to both center the title "List of Z" and have text below the title?

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Jul 17 '14 at 1:59
• Don't know the package but usually centring is done with things like \centering or \begin{center} rather than \hfill which does not usually make a good solution. – cfr Jul 17 '14 at 2:00

You can add an empty \hbox after the second \hfill (See egreg's answer to What is \null and when do we need to use it?):

\documentclass{article}
\usepackage{tocloft}

\renewcommand{\cftloftitlefont}{\hfill\bfseries}
\renewcommand{\cftafterloftitle}{\hfill\null\par\noindent\textnormal{Z}\hfill \textnormal{PAGE}}

\begin{document}

\listoffigures

\noindent X\hrulefill Y% for coparison only

\end{document}


Another option is to use \hfil instead:

\renewcommand{\cftloftitlefont}{\hfil\bfseries}
\renewcommand{\cftafterloftitle}{\hfil\par\textnormal{Z}\hfill \textnormal{PAGE}}