# Tikz matrix not working the same in a titleformat command [duplicate]

Consider the following code:

\documentclass[oneside, 10pt]{book}
\usepackage[
paperwidth=6in,
paperheight=9in,
tmargin=0.75in,
bmargin=0.75in,
lmargin=0.75in,
rmargin=0.75in
]{geometry}
\usepackage{calc}
\usepackage{tikz}
\usepackage{etoolbox}
\usepackage{transparent}
\usepackage[explicit]{titlesec}
\usepackage{tikzpagenodes}
\usepackage[table]{xcolor}
\usetikzlibrary{calc}
\usetikzlibrary{matrix}
\pagestyle{empty}

\titleformat{\part}[display]{\normalfont\filcenter}{
\thispagestyle{empty}
\tikz[remember picture, overlay] {
\matrix [column sep = 5mm] at (current page text area.center) {
\node[
inner sep = 0pt,
outer sep = 0pt,
font = \sffamily\fontsize{24}{24}\selectfont
] {Part};
&
\node [
circle,
fill = black,
font = \sffamily\fontsize{24}{24}\bf\selectfont\color{white},
outer sep = 0pt,
minimum size = 1.5cm
] {\thepart};
\\};
}
}{6em}{
}[]

\begin{document}

\tikz[remember picture, overlay]{
\matrix [column sep=5mm] at (current page text area.center) {
\node[
inner sep = 0pt,
outer sep = 0pt,
font = \sffamily\fontsize{24}{24}\selectfont
] {Part};
&
\node[
circle,
fill = black,
font = \sffamily\fontsize{24}{24}\bf\selectfont\color{white},
outer sep = 0pt,
minimum size = 1.5cm
]  (numb) {I};
\\
};
}

\part{}

\end{document}


The result is the following:

Why is the first page different than the second, and how to make the titleformat work the same way as the normal tikz command? In other words, how to center "Part I" in the page on a single line as it is done on the first page? And why does it currently fail?

## marked as duplicate by Torbjørn T. tikz-pgf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Oct 17 '17 at 18:55

• tex.stackexchange.com/questions/1111: add ampersand replacement=\& to the matrix options, and use \& instead of & in the matrix. – Torbjørn T. Oct 17 '17 at 18:51