Place box around text and equation

I would like to get an output where I there is a box around the equation and text like this:

I tried \mbox and \fbox but couldn't get it to work correctly. Thanks for your help!

CODE

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usetikzlibrary{tikzmark, quotes, decorations.pathmorphing, shapes, arrows.meta, positioning, calc}
\usepackage{pgfplots}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\usepackage{booktabs}
\usepackage{float}
\usepackage{graphicx}

%======================================================================================
%   FOR TEXTBOX
%======================================================================================
\usepackage[pscoord]{eso-pic}
\newcommand{\placetextbox}[3]{% \placetextbox{<horizontal pos>}{<vertical pos>}{<stuff>}
\setbox0=\hbox{#3}% Put <stuff> in a box
{\put(\LenToUnit{#1\paperwidth},\LenToUnit{#2\paperheight}){\makebox[0pt][c]{\begin{tabular}{l}#3\end{tabular}}}}
}%

\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
title=#2,colback=white}

%-------------------ROOT LOCUS-----------------------------------
\begin{minipage}{0.4\textwidth}
\begin{mybox}{Root Locus Method - Analysis and Design}

Let: $G(s)=\frac{N_{1}}{D_{1}}$ and $H(s)=\frac{N_{2}}{D_{2}}$, then $\frac{C(s)}{R(s)}=\frac{K\frac{N_{1}(s)}{D_{1}(s)}}{1 + K\frac{N_{1}(s)}{D_{1}(s)}}=\frac{KN_{1}(s)D_{2}(s)}{D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)}$

\placetextbox{0.35}{.965}{
\scriptsize{
Closed-Loop T.F.}}
\vspace*{0.3cm}

The poles of the Closed-Loop T.F. are the roots of $D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)$
\end{mybox}
\end{minipage}
\end{multicols*}

\end{document}


Edit 1 Based on KJO suggestion, using the solutions posted to his directed website, I tried \tcbhighmath and this was the outcome:

Not what I was going for. Thanks!

Here is a proposal based on the newest version of tikzmark and these nice tricks. The way you place the text may eventually lead to problems because the text is set via an overlay, i.e. it may run over the boundaries of the tcolorbox. On the other hand, \overset allows you to set the text over the fraction. Then all one needs to do is to pack the things that need to go in the box into \tikzmarknodes, and then draw the box via overlays. To have a blurred shadow I employed Paul Gaborit's nice tricks.

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,fit,backgrounds}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\usepackage{booktabs}
\usepackage{ifthen}

% wanna have a look at it? this will allow you to replace the following lines by sth much nicer ;-)
\parindent0pt
\parskip2pt

% from https://tex.stackexchange.com/a/80207/121799
\tikzset{
laser beam action/.style={
line width=\pgflinewidth+.2pt,draw opacity=.1,draw=#1,
},
laser beam recurs/.code 2 args={%
\pgfmathtruncatemacro{\level}{#1-1}%
\ifthenelse{\equal{\level}{0}}%
{\tikzset{preaction={laser beam action=#2}}}%
{\tikzset{preaction={laser beam action=#2,laser beam recurs={\level}{#2}}}}
},
laser beam/.style={preaction={laser beam recurs={10}{#1}},draw opacity=1,draw=#1},
}
\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
title=#2,colback=white}

%-------------------ROOT LOCUS-----------------------------------
\begin{minipage}{0.4\textwidth}
\begin{mybox}{Root Locus Method - Analysis and Design}

Let: $G(s)=\frac{N_{1}}{D_{1}}$
and $H(s)=\frac{N_{2}}{D_{2}}$,
then $\frac{C(s)}{R(s)}= \frac{K\frac{N_{1}(s)}{D_{1}(s)}}{1 + K\frac{N_{1}(s)}{D_{1}(s)}}= \overset{\raisebox{3pt}{\scriptsize\tikzmarknode{text}{\text{Closed-Loop T.F.}}}}{% \tikzmarknode{frac}{\frac{KN_{1}(s)D_{2}(s)}{D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)}}}$
\tikz[overlay,remember picture]{
\node[green!60!black,draw,thick,inner sep=1pt,fit=(text) (frac)](box){};
\begin{scope}[on background layer]
\draw[thin,laser beam=gray!50] ([xshift=2pt,yshift=-1.5pt]box.north west) rectangle
([xshift=2pt,yshift=-1.5pt]box.south east);
\end{scope}}

The poles of the Closed-Loop T.F. are the roots of $D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)$
\end{mybox}
\end{minipage}
\end{multicols*}

\end{document}


• Yea! Your the marmot, I know I should not give thanks but you saved me trying out my hairbrained suggestions :-) – KJO Oct 28 '18 at 3:50