
Me gustaría agregar el "|" símbolo o línea vertical, al encabezado del capítulo para que se vea así:
Aquí está el código original:
\documentclass[svgnames]{book}
\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=LightSkyBlue] (0,0) rectangle
(\paperwidth,3cm);
\node[anchor=east,xshift=.9\paperwidth,rectangle,
rounded corners=20pt,inner sep=11pt,
fill=MidnightBlue]
{\color{white}\chapterlabel#1};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}
\begin{document}
\tableofcontents
\chapter{Decision Trees}
Text
\chapter{Main}
\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference
\end{thebibliography}
\end{document}
Respuesta1
\chapterlabel #1
es el lugar para insertar la línea vertical. \chapterlabel
está vacío para los capítulos no numerados o contiene el número del capítulo incluido un espacio final.
Se puede agregar una línea vertical mediante \vrule
. El ancho se puede configurar mediante la palabra clave width
: \vrule width 1pt
. La altura y la profundidad dependen de la altura y la profundidad de la línea y pueden variar según los capítulos. Una regla constante está disponible como $|$
. Esta última versión en negrita se utiliza en el siguiente ejemplo:
\documentclass[svgnames]{book}
\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}
\titleformat{\chapter}
{\gdef\chapterlabel{}
\normalfont\sffamily\Huge\bfseries\scshape}
{\gdef\chapterlabel{\thechapter\ }}{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=LightSkyBlue] (0,0) rectangle
(\paperwidth,3cm);
\node[anchor=east,xshift=.9\paperwidth,rectangle,
rounded corners=20pt,inner sep=11pt,
fill=MidnightBlue]
{\color{white}%
\ifx\chapterlabel\empty
\else
\chapterlabel $\boldsymbol{|}$ %
\fi
#1};
\end{tikzpicture}
};
\end{tikzpicture}
}
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}
\begin{document}
\tableofcontents
\chapter{Decision Trees}
Text
\chapter{Main}
\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference
\end{thebibliography}
\end{document}
Página 3:
Página 7: