1.6.12

Ejemplos de uso del paquete titlesec


Ejemplos de uso del paquete titlesec.
Si uno usa la magia de TikZ, puede contraerse y está limitado solamente por su creatividad:
El código dice lo siguiente:
\documentclass{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[table,dvipsnames,svgnames]{xcolor}
\usepackage{blindtext}
\usepackage{fix-cm}
\usepackage{titlesec}
\usepackage{tikz} % Style 2, 3, 4
\usetikzlibrary{calc} % 2, 3, 4
\usetikzlibrary{decorations,decorations.shapes,shapes} % 3
% Style 1
%\renewcommand{\thechapter}{\Roman{chapter}}
\titleformat{\chapter}[display]
{\bfseries\Large}
{ %\Huge\textsc{\chaptertitlename}
\hfill\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}}
{-2ex}
{\filleft\fontsize{50}{70}\selectfont\scshape}
[\vspace{0ex}]
% Style 2
\titleformat{\chapter}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}};
\begin{tikzpicture}[overlay,remember picture]
\coordinate (leftborder) at ($(nr)-(100,0)$);
\coordinate (left) at ($(nr.west)-(1.5,0)$);
\draw[line width=2em] ($(nr.north east)+(0,1)$) -- ($(nr.north west)+(0,1)$) -- (left) -- (leftborder);
\end{tikzpicture}}
{-2ex}
{\filleft\fontsize{50}{70}\selectfont\scshape}
[\vspace{0ex}]
% Style 3
\titleformat{\chapter}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{lightgray}\textbf{\thechapter}};
\begin{tikzpicture}[overlay,remember picture]
\coordinate (leftborder) at ($(nr)-(100,0)$);
\coordinate (left) at ($(nr.west)-(1.5,0)$);
\draw[decoration={shape backgrounds,shape size=.5cm,shape=signal},signal from=west, signal to=east,decorate, draw=red!50!black, fill=red!50, decoration={shape sep=.5cm},line join=round] (leftborder) -- (left);
\end{tikzpicture}}
{-2ex}
{\filleft\fontsize{50}{70}\selectfont\scshape}
[\vspace{0ex}]
% Style 4
\titleformat{\chapter}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{blue!50!black}\textbf{\thechapter}~};
\begin{tikzpicture}[overlay,remember picture]
\coordinate (leftborder) at ($(nr)-(100,0)$);
\coordinate (leftborderhigh) at ($(nr.north west)-(100,0)$);
\coordinate (leftborderlow) at ($(nr.south west)-(100,0)$);
\coordinate (left) at ($(nr.west)-(1.5,0)$);
\fill[blue!20!white] (leftborderhigh) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder) -- cycle;
\fill[blue!20!white] (leftborderlow) -- ($(nr.south west)-(0,0.5)$) -- (left) -- (leftborder) -- cycle;
\draw[blue!50!black,line width=0.1em,line join=round] (left) -- ($(nr.south west)-(0,0.5)$) -- ($(nr.south east)-(0,0.5)$) -- ($(nr.north east)+(0,0.5)$) -- ($(nr.north west)+(0,0.5)$) -- (left) -- (leftborder);
\end{tikzpicture}}
{-2ex}
{\filleft\fontsize{50}{70}\selectfont\scshape}
[\vspace{0ex}]

% ==========================
% DOKUMENT
% ==========================
\begin{document}
\chapter{Einleitung}
\blindtext
\chapter{Hauptteil}
\blindtext
\chapter{Schluss}
\blindtext
\end{document}

%Style 5

\titleformat{\chapter}[display]
{\bfseries\Large}
{\hfill \tikz[remember picture] \node[] (nr) {\fontsize{120}{70}\selectfont\color{blue!50!black}\textbf{\thechapter}~};
\begin{tikzpicture}[overlay,remember picture]
\coordinate (leftborder) at ($(nr)-(100,0)$);
\coordinate (leftborderhigh) at ($(nr.north west)-(100,0)$);
\coordinate (leftborderlow) at ($(nr.south west)-(100,0)$);
\coordinate (left) at ($(nr.west)-(1.5,0)$);
\fill[top color=blue!1,bottom color=blue!20,draw=white] (leftborderhigh) — ($(nr.north west)+(0,0.5)$) — (left) — (leftborder) — cycle;
\fill[top color=blue!20,bottom color=blue!1,draw=white] (leftborderlow) — ($(nr.south west)-(0,0.5)$) — (left) — (leftborder) — cycle;
\draw[blue!50!black,line width=0.1em,line join=round] (left) — ($(nr.south west)-(0,0.5)$) — ($(nr.south east)-(0,0.5)$) — ($(nr.north east)+(0,0.5)$) — ($(nr.north west)+(0,0.5)$) — (left) — (leftborder);
\end{tikzpicture}}
{-1ex}
{\filleft\fontsize{50}{70}\selectfont\scshape}
[\vspace{0ex}]

No hay comentarios:

Publicar un comentario