# small box wrapped by large box

I want to create two boxes as in diagram, how to make it in latex

• Welcome to TeX-SX! As a new member, it is recommended to visit the Welcome and the Tour pages to be informed about our format and also to know about Minimal Example. Otherwise, more specifically about your question: I suggest you to create a minimal example reflecting your research on this topic. – R. N Jan 30 '20 at 12:32
• Have a look at this answer and also at the documentation of the mdframed-package in general – Nico Jan 30 '20 at 12:45

Here is a tcolorbox variant. The LaTeX code for the text inside is adapted from Nico' answer. While for this example it is not absolutely necessary to load tcolorbox (see Steven's answer), if you ever want to have somewhat more fancy boxes you can always use the same package to produce them.

\documentclass{article}
\usepackage{amsmath}
\usepackage[breakable,skins]{tcolorbox}
\newtcolorbox{mybox}[1]{before skip=1ex, after skip=1ex,top=2.5ex,width=18em,
breakable,
enhanced,coltitle=black,colback=white,sharp corners,
title={#1},
attach boxed title to top left={yshift=-\tcboxedtitleheight/2,xshift=\tcboxedtitleheight/2},
boxed title style={size=small,colback=white,sharp corners}}

\begin{document}
\begin{mybox}{$y=f(x)+a$}
\textbf{Adding} a number to the \textbf{whole function} translates the graph in the \textbf{y-direction}.
\begin{itemize}
\item If $a > 0$, the graph goes \textbf{upwards}
\item If $a < 0$, the graph goes \textbf{downwards}
\item This can be described by a \textbf{column vector}: $\begin{pmatrix}a\\ b\end{pmatrix}$.
\end{itemize}
\end{mybox}
\end{document}


\documentclass{article}
\usepackage{xcolor,stackengine}
\begin{document}
\stackinset{l}{8pt}{t}{-.7\baselineskip}{%
\fcolorbox{black}{white}{$y =- f(x) + a$}}
{\fbox{\begin{minipage}{1.9in}
\raggedright\bigskip
\textbf{Adding} a number to the \textbf{whole function} translates
the graph in the \textbf{\textit{y}-direction}.
\begin{itemize}
\item If $a>0$, the graph goes \textbf{upwards}.
\item If $a<0$, the graph goes \textbf{downward}.
\item This can be described by a \textbf{column vector} $\parenVectorstack{0 a}$.
\end{itemize}
\end{minipage}}}
\end{document}


• To make the lines thicker, increase the dimension \fboxrule. – Steven B. Segletes Jan 30 '20 at 15:05

A dirty hack based on the mdframed-package

\documentclass{article}
\usepackage{amsmath, varwidth, xparse}
\usepackage[framemethod=TikZ]{mdframed}

% This part of the code is based on https://tex.stackexchange.com/a/227903/82926
%% the following is common for all examples in mdframed manual
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}

%%% upto here
\newenvironment{theo}[1][]{%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle]
{};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle, draw=black, line width=1.5pt, fill=white]
{\strut #1};}}%
}%
\mdfsetup{innertopmargin=10pt,%
linewidth=1.5pt, topline=true,
frametitleaboveskip=\dimexpr-\ht\strutbox\relax}
\begin{mdframed}[]\relax%
}{\end{mdframed}}

% This part of the code is based on https://tex.stackexchange.com/a/39054/82926 to visualize column and row vectors
\ExplSyntaxOn
\NewDocumentCommand{\Rowvec}{ O{,} m }
{
\vector_main:nnnn { p } { & } { #1 } { #2 }
}
\NewDocumentCommand{\Colvec}{ O{,} m }
{
\vector_main:nnnn { p } { \\ } { #1 } { #2 }
}

\seq_new:N \l__vector_arg_seq
\cs_new_protected:Npn \vector_main:nnnn #1 #2 #3 #4
{
\seq_set_split:Nnn \l__vector_arg_seq { #3 } { #4 }
\begin{#1matrix}
\seq_use:Nnnn \l__vector_arg_seq { #2 } { #2 } { #2 }
\end{#1matrix}
}
\ExplSyntaxOff

\begin{document}
\begin{varwidth}{5.5cm}
\begin{theo}[$y=f(x)+a$]
\textbf{Adding} a number to the \textbf{whole function} translates the graph in the \textbf{y-direction}.
\begin{itemize}
\item If $a > 0$, the graph goes \textbf{upwards}
\item If $a < 0$, the graph goes \textbf{downwards}
\item This can be described by a \textbf{column vector}: $\Colvec{a,b}$.
\end{itemize}
\end{theo}
\end{varwidth}
\end{document}


I used the Colvec from this answer and most of the other code from this answer. The varwidth-environment could be implemented in the macro as well.

\begin{theo}[Title]