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. enter image description here

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. enter image description here

  • 2
    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, 2012 at 1:19
  • @Yori - Worked great, thank you for all your help
    – Raama
    Apr 27, 2012 at 11:48

2 Answers 2


You can use TikZ to accomplish:




  \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 \\


  \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)$);

  • 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, 2012 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, 2012 at 20:45
  • @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, 2012 at 0:21
  • @Raama: That is correct. If you do want to upload an image as part of a comment, upload it first as part of your regular question. This will give you an Imgur link. Then use that link in your comment and remove it from your post (or just cancel the edit to your post). Comments are meant to be non-rich and short, but that's a way to do it. Using that approach ensures that the image link doesn't expire, since Imgur's StackExchange account provides that longevity (see New Image Upload Support entry on Stack Overflow's blog).
    – Werner
    Apr 29, 2012 at 0:35

Some overlapping braces allow for this:

enter image description here

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\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}}
  \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}}

\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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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