0

I want to create an equation with this circle and arrow on a single term by a single command. I want to obtain an equation similar to this:

I wrote this until now:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\makeatletter
\newcommand\mathcircled[1]{%
   \mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
   \tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};%
}
\makeatother
\begin{document}
   \[\lim_{x\to\infty} \frac{\sin x}{x}= \mathcircled{\frac{\sin x}{x}}=1\]
\end{document}

1
  • Welcome to TeX.SE!
    – Mensch
    Oct 5, 2021 at 11:00

1 Answer 1

1
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\makeatletter
\newcommand\mathcircled[1]{%
   \mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] {\node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$}; \draw[-{Triangle[open]}] (math.north east) -- +(0.3,0.3)}%
}
\makeatother
\begin{document}
   \[\lim_{x\to\infty} \frac{\sin x}{x}= \mathcircled{\frac{\sin x}{x}}=1\]
\end{document}

Circled math with arrow

Edit:

With a number:

\tikz[baseline=(math.base)] {\node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$}; \draw[-{Triangle[open]}] (math.north east) -- +(0.3,0.3) node[above right]{1}}%

Same math, but with a number above the arrow

4
  • +1 I was trying to access (math) via a tikzpicture after the \[...\] but faild. Any idea why one cannot globally access the (math) node?
    – daleif
    Oct 5, 2021 at 12:43
  • @daleif: I think you need the remember picture option for the first tikzpicture. Better would be to look into the tikzmark package. You also need overlay - p. 259 in the manual Oct 5, 2021 at 13:00
  • I added those, but nothing happend. Ahh, well I'll try again
    – daleif
    Oct 5, 2021 at 13:13
  • @daleif: Ahh - ok. The weird double newcommand definition, that I do not understand is messing with normal node access. The straight forward solution by Vincent and others do not have this problem: tex.stackexchange.com/a/617833/8650 Oct 6, 2021 at 2:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .