# Box around continued fraction

Thanks for stopping by to help with my question. I'm trying to mimic what my professor did in our notes, putting a box around a specific portion of a continued fraction, shown below:

Here's the LaTex code I was trying to use for the continued fraction itself (sorry, I don't know how to format it so it looks nice like other questions I've seen on here):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
$$X:=\cfrac{1}{a+\cfrac{1}{a+\cfrac{1}{a+\cfrac{1}{a+\cfrac{1}{a+\cdots}}}}}$$
\end{document}


Any help you might be able to provide would be much appreciated!

Simply use \boxedn and don't use $$…$$, which is plain TeX code and produces bad spacing. Use [ … \] instead for unnumbered display formulae. Also with :=, the colon is not centred on the maths axis. Prefer \coloneqq instead, which is defined in mathtools, an extension of amsmath:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\begin{document}

$X\coloneqq\cfrac{1}{a+\boxed{\cfrac{1}{a+\cfrac{1}{a+\cfrac{1}{a+\cfrac{1}{a+ ⋯ }}}}}}$

\end{document}


• Thanks, @Bernard! I appreciate your help and assistance in formatting my question. – jbrow35 Oct 20 '16 at 0:48
• You're welcome. Always glad to help! – Bernard Oct 20 '16 at 0:53