如何才能在每个章节/部分/小节标题前添加一个符号?

如何才能在每个章节/部分/小节标题前添加一个符号?

我怎样才能在每个章节、节和小节的标题前添加一个符号?如果可能的话,我希望在左边空白处添加这个符号。符号并不重要。

这是我的 MWE:

    \documentclass[fancy,12pt,a4paper,oneside,table]{memoir}
    \usepackage{lipsum}
    \usepackage{xcolor}
    
    \definecolor{sectioncolour}{RGB}{247,131,53}
    \definecolor{chaptercolour}{RGB}{23,85,142}
    \definecolor{subsectioncolour}{RGB}{5,130,34}
    
    \renewcommand{\chapnamefont}{\normalfont\large\sffamily\scshape\center\color{chaptercolour}}
    \renewcommand{\chapnumfont}{\Huge\bfseries\sffamily\color{chaptercolour}}
    \renewcommand{\chaptitlefont}{\normalfont\Huge\bfseries\sffamily\center\color{chaptercolour}}
    \setsecheadstyle{\Large\bfseries\sffamily\color{sectioncolour}}
    \setsubsecheadstyle{\large\bfseries\sffamily\color{subsectioncolour}}
    
    \begin{document}
        \chapter{Guide Intro}
        \lipsum[1]
        \section{Operations}
        \lipsum[2]
        \section{General view}
        \lipsum[3]
        \subsection{General view}
        \lipsum[4]
        
        \chapter{Guide: Detailed content}
        \lipsum[4]
    
        \chapter{Future}
        \lipsum[5]
    \end{document}

答案1

按照您的要求,这会在章节和分节标题前的左边距放置一个符号。

% symdivprob.tex  SE 639496  (Symbol before divisions)

\documentclass[fancy,12pt,a4paper,oneside,table]{memoir}
    \usepackage{lipsum}
    \usepackage{xcolor}
    
    \definecolor{sectioncolour}{RGB}{247,131,53}
    \definecolor{chaptercolour}{RGB}{23,85,142}
    \definecolor{subsectioncolour}{RGB}{5,130,34}
    
%%%% PW symbol stuff
    \newcommand{\symdiv}{$\clubsuit$}
    \newcommand{\lsymdiv}{\llap \symdiv}
    \let\saveprintchaptitle\printchaptertitle
    \renewcommand{\printchaptertitle}[1]{\llap\symdiv #1}
    
    \renewcommand{\chapnamefont}{\normalfont\large\sffamily\scshape\center\color{chaptercolour}}
    \renewcommand{\chapnumfont}{\Huge\bfseries\sffamily\color{chaptercolour}}
    \renewcommand{\chaptitlefont}{\normalfont\Huge\bfseries\sffamily\center\color{chaptercolour}}
    \setsecheadstyle{\Large\bfseries\sffamily\color{sectioncolour}\lsymdiv}
    \setsubsecheadstyle{\large\bfseries\sffamily\color{subsectioncolour}\lsymdiv}
    \begin{document}
    \chapter{Guide Intro}
        \lipsum[2]
        \section{Operations}
        %        \lipsum[2]
        Just a little bit of text. Just a little bit of text.
        Just a little bit of text. Just a little bit of text.
        Just a little bit of text. Just a little bit of text. 
        \subsection{General view}
        Just a little bit more of text. Just a little bit more of text.
        Just a little bit more of text. Just a little bit more of text.
        Just a little bit more of text. Just a little bit more of text. 

    \end{document}

在此处输入图片描述

相关内容