![O título da seção colorida falha com a opção [leftmargin] do titlesec](https://rvso.com/image/390761/O%20t%C3%ADtulo%20da%20se%C3%A7%C3%A3o%20colorida%20falha%20com%20a%20op%C3%A7%C3%A3o%20%5Bleftmargin%5D%20do%20titlesec.png)
Quero o título da minha seção colorido. Está tudo bem quando eu uso \titleformat
o pacote titlesec
para configurá-lo.
Mas quando adiciono a opção argument [leftmargin]
, o texto do título não muda de cor. Há algo errado com meu código?
MWE:
\documentclass{article}
\usepackage{titlesec,xcolor}
\begin{document}
\titleformat{\section}
{\normalfont\bfseries\color{blue}}
{\thesection.}
{1em}
{}
\section{my colored section}
\titleformat{\section}[leftmargin]% only the optional argument "leftmargin" added
{\normalfont\bfseries\color{blue}}
{\thesection.}
{1em}
{}
\section{The Color Unchanged}
\end{document}
Responder1
Uma solução alternativa: coloque o comando color no segundo e no quarto argumentos.
\documentclass{article}
\usepackage{,xcolor, titlesec}
\begin{document}
\titleformat{\section}
{\normalfont\bfseries\color{blue}}
{\thesection.}
{1em}
{}
\section{my colored section}
\titleformat{\section}[leftmargin]% only the optional argument "leftmargin" added
{\normalfont\bfseries}
{\color{blue}\thesection.}
{1em}
{\color{blue}}
\section{The Color Unchanged}
\end{document}