This is a follow-up question to: Different titleformat style for different numberless chapters
I have something like the following macro:
\titleformat{\chapter}
{\normalfont\Huge\color{blue}}
{}
{0pt}
{%
\begin{minipage}{.4\textwidth}
#1
\end{minipage}
}
The #1 comes from the [explicit] option of the titlesec package. If I try to put the previous code inside another macro, like this:
\newcommand{\mycustomchapter}{
\titleformat{\chapter}
%...
}
compilations fails complaining about the argument.
Is it possible to hide the \titleformat macro in another macro when the explicit option is in place?
MWE
\documentclass{book}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\newcommand{\mycustomchapter}{
\titleformat{\chapter}
{\normalfont\Huge\color{blue}}
{}
{0pt}
{%
\begin{minipage}{.4\textwidth}
#1
\end{minipage}
}
}
\begin{document}
\mycustomchapter
\chapter{My chapter}
Bla bla bla
\end{document}

##1instead of#1– egreg Apr 12 '15 at 09:47