[Tex/LaTex] Decoration in the Chapter Title

chaptersdecorationspsvectorian

I am trying to use a decoration in the chapter title using the psvectorian package. The problem is that it doesn't work. What am I doing wrong?

MWE

\documentclass{book}

\usepackage[raggedright]{titlesec}

\titleformat{\chapter}[display]%
{%
    \LARGE \centering \bfseries%
}{Chapter\\[1cm] \thechapter}{1cm}{}[\psvectorian[scale=0.5]{82}]

\usepackage{fontspec}

\usepackage[english]{babel}

\usepackage{psvectorian}

\begin{document}

\chapter{Text}

\end{document}

Best Answer

The cause here is that \psvectorian does have an optional argument and is used inside another optional argument -- this does not work for commands defined with \newcommand etc.

Use [{\psvectorian[scale=0.5]{82}}] in order to protect the inner ] pair from being recognized as the closing of the outer [.

\documentclass{book}

\usepackage[raggedright]{titlesec}

\usepackage{auto-pst-pdf}

\titleformat{\chapter}[display]%
{%
  \LARGE \centering \bfseries%
}{Chapter\\[1cm] \thechapter}{1cm}{}[{\psvectorian[scale=0.5]{82}}]

\usepackage{fontspec}

\usepackage[english]{babel}

\usepackage{psvectorian}

\begin{document}

\chapter{Text}

\end{document}

enter image description here

Related Question