Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to create this

enter image description here

I want this to draw every time I use the command for the section, subsection and sub ​​subsection

I already have the code for the graphics, but I do not know how to do all this is done automatically when each command is written, or how to make the format does not move.

anyone can help me to do this??

\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}
share|improve this question
    
I imagine you could accomplish this with the help of the sectsty package –  Matt Jul 1 at 23:54
    
Or perhaps with titlesec. –  Bernard Jul 2 at 0:06
    
Not to kill the mood of this fun question but I think it is not readable as a section decoration –  percusse Jul 2 at 15:01

1 Answer 1

up vote 3 down vote accepted

A possible solution using native commands of 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}

The result:

enter image description here

share|improve this answer
    
awesome, thanks Claudio Fiandrino –  user51976 Jul 3 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.