修改节、小节和小小节样式

修改节、小节和小小节样式

我想创建这种风格:

在此处输入图片描述

我希望每次使用命令时都执行此操作sectionsubsection并且sub​​subsection

我已经有了图形的代码,但我不知道如何在写入每个命令时自动完成所有这些,或者如何使格式不动。

有人可以帮我做到这一点吗?

\documentclass[oneside,spanish,10pt, letterpaper]{memoir}
\usepackage[applemac]{inputenc}
\usepackage{tikz}
\usepackage{anysize}
\marginsize{3cm}{2cm}{2cm}{2cm}
\usepackage[siunitx,european,americanresistors]{circuitikz}
\definecolor{logo}{HTML}{6C17A1}
\definecolor{logo2}{HTML}{FFFF10}
\usepackage{color} 
\def\sectionfont{\sffamily\LARGE}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
%%%Section
\fill[logo](4,-1) rectangle (0,-2);
\draw[color = logo2] (0.5,-1.7) to[R,o-o,label=\mbox{$R_1=\SI{1.1}{\ohm}$}] (2.5,-1.7);
\node[inner sep=0pt,outer sep=0pt,text=white,scale=1,font=\sectionfont]  at (3.2,-1.5)    {1.1};
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1,font=\sectionfont]  at (5.5,-1.5)   {Some text};

%%%sub section
\fill[logo](1.2,-3) rectangle (1.7,-4);
\fill[logo](1.2,-3.95) rectangle (14,-4);
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1,font=\sectionfont]  at (.5,-3.5)  {1.1.1};
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1.2,font=\sffamily]  at (2.8,-3.5){Some text};
\node[inner sep=0pt,outer sep=0pt,text=logo2,scale=1,font=\sectionfont]  at (1.45,-3.5){$\oint$};
\draw[color = logo] (13.99,-4) node [ground] {};

%%%subsub section
\fill[logo](1.7,-5) rectangle (2.2,-6);
\fill[logo](1.7,-5.95) rectangle (12,-6);
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1,font=\sectionfont]  at (.9,-5.5){1.1.1.1};
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1.2,font=\itshape]  at (3.5,-5.5){Some text};
\node[inner sep=0pt,outer sep=0pt,text=logo2,scale=1,font=\sectionfont]  at (1.95,-5.5){$\psi$};
\draw[color = logo] (11.99,-6) node [ground] {};
\end{tikzpicture}
\end{document}

答案1

使用本机命令的可能解决方案memoir

\documentclass[oneside,spanish,10pt, letterpaper]{memoir}
\usepackage[applemac]{inputenc}
\usepackage{tikz}
\usepackage{anysize}
\marginsize{3cm}{2cm}{2cm}{2cm}
\usepackage[siunitx,european,americanresistors]{circuitikz}
\definecolor{logo}{HTML}{6C17A1}
\definecolor{logo2}{HTML}{FFFF10}
\usepackage{color} 
\def\sectionfont{\sffamily\LARGE}

\setcounter{secnumdepth}{4}% to number subsubsections

% SECTIONS
\makeatletter
\setsecheadstyle{\tikz{\fill[logo](4,-1) rectangle (0,-2);
\draw[color = logo2] (0.5,-1.7) to[R,o-o,label=\mbox{$R_1=\SI{1.1}{\ohm}$}] (2.5,-1.7);
\node[inner sep=0pt,outer sep=0pt,text=white,scale=1,font=\sectionfont]  at (3.2,-1.5)    {\thesection};}\vskip-6ex\sectionfont\color{logo}}

\def\@seccntformat#1{\hskip10em}
\makeatother

\setbeforesecskip{-1\onelineskip}
\setaftersecskip{2\onelineskip}

% SUBSECTIONS
\setsubsecheadstyle{\tikz{\fill[logo](1.2,-3) rectangle (1.7,-4);
\fill[logo](1.2,-3.95) rectangle (14,-4);
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1,font=\sectionfont]  at (.5,-3.5)  {\thesubsection};
\node[inner sep=0pt,outer sep=0pt,text=logo2,scale=1,font=\sectionfont]  at (1.45,-3.5){$\oint$};
\draw[color = logo] (13.99,-4) node [ground] {};}\vskip-9ex\hskip-4em\sffamily\color{logo}
}

\setbeforesubsecskip{-1\onelineskip}
\setaftersubsecskip{3\onelineskip}

% SUBSUBSECTIONS
\setsubsubsecheadstyle{\tikz{\fill[logo](1.7,-5) rectangle (2.2,-6);
\fill[logo](1.7,-5.95) rectangle (12,-6);
\node[inner sep=0pt,outer sep=0pt,text=logo,scale=1,font=\sectionfont]  at (.9,-5.5){\thesubsubsection};
\node[inner sep=0pt,outer sep=0pt,text=logo2,scale=1,font=\sectionfont]  at (1.95,-5.5){$\psi$};
\draw[color = logo] (11.99,-6) node [ground] {};}\vskip-9ex\hskip-3em\sffamily\color{logo}
}

\setbeforesubsubsecskip{-1\onelineskip}
\setaftersubsubsecskip{3\onelineskip}

\usepackage{lipsum}


\begin{document}
\chapter{A chapter title}
\lipsum[1]
\section{Some text}
\lipsum[2]
\subsection{Some text}
\lipsum[3-5]
\subsubsection{Some text}
\lipsum[6]

\chapter{Another chapter title}
\section{Some text}
\subsection{Some text}
\subsubsection{Some text}

\end{document}

结果:

在此处输入图片描述

相关内容