答案1
我将命令放到章节标题中以供演示。格式化文本的代码是tikzpicture
环境。它可以轻松移动到其他地方。
代码中标明了更改文本和颜色的位置。
\documentclass{book}
\usepackage{tikz}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\titleformat{\chapter}{}{}{1pt}
{%
\begin{tikzpicture}
% V---------------------------V <- Text goes here
\def\textoftitle{\chaptertitlename~\thechapter}
\node at ( 0.04,-0.04) {\contour{black!25!white}{\color{white}\Huge \textoftitle}};
\node at ( 0.03,-0.03) {\contour{black!50!white}{\color{white}\Huge \textoftitle}};
\node at ( 0.02,-0.02) {\contour{black!75!white}{\color{white}\Huge \textoftitle}};
\node at ( 0.01,-0.01) {\contour{black}{\color{white}\Huge \textoftitle}};
% VV Amount of yellow mixed with black (70% yellow + 30% black)
\node at ( 0.00, 0.00) {\contour{yellow!70!black}{\color{white}\Huge \textoftitle}};
\end{tikzpicture}
}%
\begin{document}
\chapter{Chap}
\end{document}