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.

How can I draw oval circle around a string? For example, when I have "1,3,4,6", how can I put them in a circle?

enter image description here

share|improve this question
1  
Have you seen this post: tex.stackexchange.com/questions/103557/… –  dustin Aug 19 '13 at 21:04
    
1  
Here is another related question: Boxing a number and aligning it vertically along the baseline You can use every shape of TikZ of course. Your example resembles the rounded rectangle shape from the shapes.misc library. –  Qrrbrbirlbel Aug 19 '13 at 23:37

4 Answers 4

up vote 4 down vote accepted

The shapes.misc library offers the rounded rectangle shape. You can also use the shadows library to add shadows.

\documentclass[border=3pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes.misc,shadows}

\begin{document}

\begin{tikzpicture}[baseline=(char.base)]
\node(char)[draw,fill=white,
  shape=rounded rectangle,
  drop shadow={opacity=.5,shadow xshift=0pt},
  minimum width=1.8cm]
  {1,3,4,6};
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

I found this code works fine with me.

\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\newcommand{\mymk}[1]{%
  \tikz[baseline=(char.base)]\node[anchor=south west, draw,rectangle, rounded corners, inner sep=2pt, minimum size=7mm,
    text height=2mm](char){\ensuremath{#1}} ;}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

Hello, \mymk{1,2,3,4,5} world \circled{1}

enter image description here

Refer to How to draw a circle around text and Good way to make \textcircled numbers?.

share|improve this answer
    
it'd be great if you could reference your source –  cmhughes Aug 20 '13 at 3:44
    
@cmhughes: updated my answer. –  prosseek Aug 20 '13 at 4:01
    
You can control the "roundedness" of the corners by passing values to rounded corners. For example, rounded corners=10pt would produce a shape more closely resembling the one in your question. –  Kevin C Aug 20 '13 at 5:39

Just for comparison, here is a ConTeXt solution:

\defineframed
    [roundframed]
    [
      corner=round,
      location=low,
      loffset=0.1em,
      roffset=0.1em,
    ]

\starttext

Hello \roundframed{1,2,3,4} world.

\stoptext

which gives

enter image description here

share|improve this answer

Sorry, I don't have the ability to add comments on the TeX site yet. You can look at the thread dustin mentioned. Alternatively, you can use a box: $\boxed{1,3,4,6}$, which will appear:

enter image description here

share|improve this answer
    
You don't need to comment if you have solution to propose. Can you make your solution compilable though and add the output image? –  dustin Aug 19 '13 at 21:08
1  
Oh, that's true. Thanks! Edited. –  Ahaan S. Rungta Aug 19 '13 at 21:09
    
I think the poster wants a flat edges above and below the string and then rounded sides. –  dustin Aug 19 '13 at 21:18
    
Ah, then, I think your link would work better. Thanks for edit, by the way! I don't have the ability to post images yet. –  Ahaan S. Rungta Aug 19 '13 at 21:24
    
Just post links and someone will change it for you. –  dustin Aug 19 '13 at 21:25

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.