# numbered ornament as section title

I am trying to recreate a kind of numbered ornament in my section labels. The section number comes from a specific font, then is transformed (rotated) and then placed within an image.

For example, section number 23 would have this image of a tag and string with the number 23 inside it. And then on the line beneath, the section title.

My MWE is completely lame since I don't know where to begin on this question, but some kind of MWE is required, so:

\documentclass[11pt,oneside]{article}
\begin{document}
\section{Title of First Section}%this would have a tag with number 1 inside.
\section{Title of Second Section}%this would have a tag with number 2 inside inside.
\end{document}

• Look at titlesec and TikZ maybe? You can use overlay for a TikZ picture if required or just put the number into a node on top of a node containing the image. – cfr Dec 31 '15 at 17:26
• Can you tell us the font name, if possible? That way I can modify the example to use it. – Alenanno Dec 31 '15 at 17:58
• sorry, this is from a physical book, I don't know the font. – Tim Dec 31 '15 at 20:14

# Update — using a .png

As requested, this is an update using an image, here a .png because it supports the alpha channel and helps make the image smaller. I have cropped the image you supplied, and then made the remaining background transparent.

The image is then imported and scaled down. Scaling it is preferable because scaling a bigger image holds greater quality than using an image with already the desired dimensions.

I have added an extra node, besides the one holding the image, to place the actual number. In order to see the new result, replace the \fancynumber command with the following code:

\newcommand\fancynumber{%
\tikz[baseline=(a)] {
\node (a) at (0,0) {\includegraphics[scale=.35]{card}};
\node[%
rotate=-32,
font=\bfseries\sffamily\Large,
] at ($(a.center)!.3!(a.east)$) {\thesection};
}%
}


Remember that if you place the png in the same folder as your .tex file, you don't need to specify the path or the extensions, therefore \includegraphics[scale=.35]{card}. And here's the result:

## Code

\documentclass[11pt,oneside]{article}
\usepackage{titlesec}
\usepackage{tikz}

\tikzset{
}

\newcommand\fancynumber{%
\tikz[baseline=(a.north east)] {
\node [draw,
minimum width=1cm,
minimum height=6mm,
shape=signal,
fill=white,
rotate=-30,
signal to=west,
font=\bfseries\sffamily\large,
rounded corners=.5mm] (a) at (0,0) {\thesection};
\draw[fill=gray!25] ($(a.west)!.2!(a.east)+(0,-.5pt)$) circle (2pt);
\path ($(a.west)!.2!(a.east)$) edge[line cap=round,line width=1mm, out=200,in=-15, looseness=1.5] ++(-.5,.5) coordinate (b);
\begin{scope}[on background layer]
\path ($(a.west)!.2!(a.east)$) edge[line cap=round,line width=1mm, out=100,in=5, looseness=1.5] ++(-.5,.5);
\end{scope}
}%
}

\renewcommand*{\thesection}{\arabic{section}}
\titleformat{\section}{\large}{\fancynumber}{.2cm}{}

\begin{document}
%\chapter{My first chapter}
\section{First section}
\section{Second section}
\setcounter{section}{24}
\section{25th section}
\end{document}

• fantastic! It works so well. Can you please add a %comment line in your code to show how I might use an image file instead of drawing the path of the ornament? – Tim Dec 31 '15 at 20:23
• @Tim You mean the "rope" thing? :D Well, it might require some work to position it, but keep in mind that even if you do that, it won't scale well. In other words, zooming in will make it pixelate. That is, if this is going to be read on an electronic device. But if you don't care about this, or if you're going to print it and you have such an image, you could link it for me. – Alenanno Dec 31 '15 at 20:30
• yes, the rope thing. I understand the pixelate problem, but I want to be able to generalise your solution for any nice image I find suitable for the text [because I have no drawing talent, I will be using images from other places]. Can you use the Imgur image above—just as a model—and make an approximate guess about position / rotation which I would need to adjust when I used different images? – Tim Dec 31 '15 at 20:49
• setting question as un-answered because although this answer does what it does very well, it is too restrictive: I need arbitrary images rather than specific drawings. – Tim Jan 2 '16 at 13:27
• @Tim Uhm not sure what you mean by that. Are you saying you want the "card" to be an actual image and "place" the number there, rotated? If that's what you mean, please provide the appropriate image, and I'll tell you how to use it. – Alenanno Jan 2 '16 at 13:34