# TikZ Circle/Ellipse Around Text

I'm making a multiple choice question and answer. How do I make an appropriate shape (probably an ellipse, oval, or rectangle in this case) around the correct answer without messing with the text alignment?

\documentclass{article}

\usepackage{tikz}

\begin{document}

Two plus thirteen equals FIVE/NINETEEN/\tikz \node[draw,circle]{FIFTEEN}; /NINETY

\end{document}


The baseline for a TikZ picture is the bottom of the picture, but you can reset that baseline in the options to the call to \tikz

\documentclass{article}

\usepackage{tikz}

\begin{document}

Two plus thirteen equals FIVE/NINETEEN/\tikz[baseline=(word.base)] \node[draw,circle] (word) {FIFTEEN}; /NINETY

\end{document}


But this will nevertheless interfere with the interline spacing if there is a following line:

Unless you've got a lot of white space around what you're going to circle, I don't thinking circling is going to be the right choice. I would actually define a control sequence to handle this because then within the control sequence you can do a few things that AFAIK you can't do with \tikz....;.

\documentclass{article}

\usepackage{tikz}
\usepackage{lipsum}

\begin{tikzpicture}[baseline=(word.base)]
\node[inner sep=0pt]  (word) {#1};
\begin{pgfinterruptboundingbox}
\node[draw] at (word) {\phantom{#1}};
\end{pgfinterruptboundingbox}
\end{tikzpicture}}

\begin{document}


I suppose you might try something with an overlay, but in the above code, I basically prevent the bounding box from being enlarged over what was need for the word node.
• Thank you so much for this! I've started to use the code, but I don't really understand how it works. ATM, my main questions are: (1) What is the whole baseline=(word.base) part doing?, (2) What is a pgfinterruptboundingbox? – WeCanLearnAnything Dec 20 '15 at 1:19
• @WeCanLearnAnything Regarding baseline=(word.base). A picture has a baseline that by default lies on the bottom of edge of the bounding box. TikZ allows you to reset the baseline which is what this directive does. – A.Ellett Dec 20 '15 at 18:39
• @WeCanLearnAnything Regarding pgfinterruptboundingbox. The TikZ picture lies within a bounding box which determines its dimensions within the LaTeX document. With each stroked path and creation of nodes, TikZ further updates the bounding box's dimensions. pgfinterruptboundingbox tells TikZ not to update the bounding box dimensions and thus the picture can bleed out into the surrounding area. – A.Ellett Dec 20 '15 at 18:42