# How to create sets and name it

I have a requirement to create a document similar to the attached image. I am working with Sanskrit alaphabets and there is a name for each set as shown in the image. In english there is no set other than broad division of Vowels and consonants. I could have posted image with Sanskrit text but lot of people here do not have that font.

I would really appreciate your help. one way I thought of was, to create nodes around each letter in Tikz but not sure if there is any easy method out there.

PS: I could not think of a good question title

I am adding output based on @Yori's solution. Everything work great except I did not get straight lines. I guess the issue is with Devanagari fonts. I highlighted the issue with red circle, the line is not horizontal its slanted. Sorry I could not attach image to my comment to I am modifying here. if you feel I should start a new question I can do that as well.

-
That's because the right-most character is higher than the other characters, so the node containing it is bigger, and hence its north point is higher. To fix this, I think you can replace nodes={font=\bfseries} by nodes={font=\bfseries, minimum height=24pt}. This makes sure the height of each node is at least 24 points. You have to play a bit with the 24pt to see what works best for you. I hope the horizontal alignment will be ok. (For debugging purposes you can add draw=black, so that you can see the nodes containing the characters.) –  Yori Apr 27 '12 at 1:19
@Yori - Worked great, thank you for all your help –  Raama Apr 27 '12 at 11:48

You can use TikZ to accomplish:

Code:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc,matrix}

\begin{document}
\begin{tikzpicture}
\matrix (m)
[matrix of nodes, nodes={font=\bfseries}] {
A & B & C & D & E & F & G & H & I & J & K & L & M &
N & O & P & Q & R & S & T & U & V & W & X & Y & Z \\
};

\def\h{8pt}

\draw [thick] (m-1-1.north) -- +(0, \h) --
node [anchor=south] {First set}
($(m-1-5.north)+(0,\h)$) -- ($(m-1-5.north)$);

\draw [thick] (m-1-9.north) -- +(0, \h) --
node [anchor=south] {Second set}
($(m-1-13.north)+(0,\h)$) -- ($(m-1-13.north)$);

\draw [thick] (m-1-18.north) -- +(0, \h) --
node [anchor=south] {Third set}
($(m-1-22.north)+(0,\h)$) -- ($(m-1-22.north)$);

\draw [thick] (m-1-1.south) -- +(0, -\h) --
node [fill=white] {Complete set of characters}
($(m-1-26.south)-(0,\h)$) -- ($(m-1-26.south)$);

\end{tikzpicture}
\end{document}

-
how can I attach an output image to ask a question, related to the solution you offered? do I start a new question for that? –  Raama Apr 26 '12 at 19:24
@Raama: If the answer fully answers your original question, then yes you should post a new follow-up question. If it doesn't then you should edit your question to clarify what you want. –  Caramdir Apr 26 '12 at 20:45
–  Werner Apr 26 '12 at 20:58
@Werner - I wanted to upload image to comment so that I will be related to this question. However I think there is no way I can upload an image to the comment. I can only edit the question and add an image. –  Raama Apr 29 '12 at 0:21

Some overlapping braces allow for this:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\newcommand{\mystrut}{\rule[-.3\baselineskip]{0pt}{\baselineskip}}
\newcommand{\firstset}{\text{\mystrut A\ B\ C\ D\ E}}
\newcommand{\secondset}{\text{\mystrut I\ J\ K\ L\ M}}
\newcommand{\thirdset}{\text{\mystrut R\ S\ T\ U\ V}}
\newcommand{\completeset}{\text{\mystrut A\ B\ C\ D\ E\ F\ G\ H\ I\ J\ K\ L\ M\ N\ O\ P\ Q\ R\ S\ T\ U\ V\ W\ X\ Y\ Z}}
\begin{align*}
\underbrace{
\rlap{$\overbrace{\phantom{\firstset}}^{\text{First set}}$}\firstset\
\text{F\ G\ H}\
\rlap{$\overbrace{\phantom{\secondset}}^{\text{Second set}}$}\secondset\
\text{N\ O\ P\ Q}\
\rlap{$\overbrace{\phantom{\thirdset}}^{\text{Third set}}$}\thirdset\
\text{W\ X\ Y\ Z}
}_{\text{Complete set}}
\end{align*}
\end{document}


\rlap provides a zero-width box with a right overlap. I've added a \mystrut to each of the sets to raise/lower the \overbrace/\underbrace away from the characters.

amsmath provides the \text{...} macro and align environment for convenience, although it is not really necessary in this instance.

-
you are awesome, works great. Thank you –  Raama Apr 26 '12 at 18:23