2

This question already has an answer here:

I want to enclose my matrix by a box. I have followed the instructions in this link but couldnt get the borders correct. Here is how the frame looks like and the code.

enter image description here

\begin{frame}
\medskip\par\noindent
\begin{minipage}{0.4\linewidth}
\newcommand*{\WidestText}{
\begin{bmatrix}
1 & 2 & 3 \\[0.3em]\end{bmatrix}.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=\text{ERROR} 
}%
\tikzmark{left}
{\footnotesize
\[
\begin{bmatrix}
1 & 2 & 3 \\[0.3em]\end{bmatrix}.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=\text{ERROR} 
\]
}
{\footnotesize
\[\begin{bmatrix}
1 \\[0.3em]
2 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=
\begin{bmatrix}
4 \\[0.3em]
4 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
\]
}
\makebox[\widthof{\WidestText}][l]{  }\tikzmark{right}
\DrawBoxWide[thick, brown]
\end{minipage}
\end{frame}

marked as duplicate by Andrew Swann, user31729, Malipivo, Werner math-mode Apr 11 '15 at 16:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

An example with tcolorbox

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{amsmath, amssymb}

\begin{document}

\begin{tcolorbox}
\[
\begin{bmatrix}
1 & 2 & 3 \\[0.3em]\end{bmatrix}.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=\text{ERROR} 
\]

\[\begin{bmatrix}
1 \\[0.3em]
2 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=
\begin{bmatrix}
4 \\[0.3em]
4 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
\]
\end{tcolorbox}

\tcboxmath{
\begin{bmatrix}
1 & 2 & 3 \\[0.3em]\end{bmatrix}.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=\text{ERROR} 
}

\tcboxmath{
\begin{bmatrix}
1 \\[0.3em]
2 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
.*
\begin{bmatrix}
4 \\[0.3em]
2 \\[0.3em]
1 \\[0.3em]
\end{bmatrix}
=
\begin{bmatrix}
4 \\[0.3em]
4 \\[0.3em]
3 \\[0.3em]
\end{bmatrix}
}
\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.