# 2 boxed equations on one line(blue outline box and shadow)

I am currently trying to make 2 boxed equations to be on the same line. I use {mybox} to create the outline of the box and the color. Also to position the equation where i want it to be. The boxes have to have a 5% gray color inside them.

I have this code:

\documentclass[a4paper, 11pt]{report}
\usepackage{amsmath}
\usepackage{empheq}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\usepackage[top=15mm, bottom=15mm, left=35mm, right=20mm]{geometry}

\newmdenv[innerlinewidth=0.5pt, roundcorner=4pt,linecolor=blue,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=6pt,innerbottommargin=6pt,
leftmargin=179.5pt, rightmargin=179.5pt]{mybox1}

\newmdenv[innerlinewidth=0.5pt, roundcorner=4pt,linecolor=blue,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=6pt,innerbottommargin=6pt,
leftmargin=179.5pt, rightmargin=179.5pt]{mybox2}

\newmdenv[innerlinewidth=0.5pt, roundcorner=4pt,linecolor=blue,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=6pt,innerbottommargin=6pt,
leftmargin=179.5pt, rightmargin=179.5pt]{mybox3}

\newmdenv[innerlinewidth=0.5pt, roundcorner=4pt,linecolor=blue,innerleftmargin=6pt,
innerrightmargin=6pt,innertopmargin=6pt,innerbottommargin=6pt,
leftmargin=30.5pt, rightmargin=255pt]{mybox4}

\begin{document}

Simple linear regression relates one dependent variable to one independent variable in the form of a linear equation:

\begin{center}
$y = a + bx$
\end{center}
\end{mybox1}

To develop the linear equation, the intercept a and slope b must first be computed using the
following least squares formulas:

\begin{mybox2}
\begin{center}
$a = \bar{y} + b \bar{x}$
\end{center}
\end{mybox2}
and
\begin{mybox3}
\begin{center}
$b = \frac{\sum{x y - n \bar{x}\ \bar{y}}}{\sum{x^2 - n \bar{x}^2}}$
\end{center}
\end{mybox3}

Where:

\begin{mybox4}
\begin{center}
$\bar{x} = \frac{\sum{x}}{n} = mean\ of\ x\ data$
\end{center}
\end{mybox4}

We can use correlation to measure the strength of the relationship between the independent and dependent variables. The formula for the
correlation coefficient is:

\end{document}


I get this but I have to get this instead:

As you can see I have to align the equations horizontally, add shadow to the boxes and also make this green box. Thanks for the help in advance.

• Welcome to TeX.SX! Your example is not compilable at all -- it contains no documentclass, syntax errors and requires code not available to us – user31729 Nov 22 '15 at 15:57
• Thank you for telling me, I fixed the issues. Now it should work. – BlazeAxtrius Nov 22 '15 at 16:10

Here's a tcolorbox solution (instead of mdframed)

The \tcboxmath command can be used inside of an equation or as a standalone box, the configuration of colors etc. is quite simple with colframe and colback etc, either using tcbset or locally in the optional argument.

\documentclass{article}

\usepackage{mathtools}
\usepackage[most]{tcolorbox}

\begin{document}

Simple linear regression relates one dependent variable to one independent variable in the form of a linear equation:

$$\tcboxmath{y = a + bx}$$
To develop the linear equation, the intercept a and slope b must first be computed using the
following least squares formulas:

$$\tcboxmath{% a = \bar{y} + b \bar{x} } \text{ and } \tcboxmath{% b = \frac{\sum{x y - n \bar{x}\ \bar{y}}}{\sum{x^2 - n \bar{x}^2}} }$$

Where:

$$\tcboxmath[colframe=green]{% \bar{x} = \frac{\sum{x}}{n} = \text{mean\ of\ x\ data} }$$
We can use correlation to measure the strength of the relationship between the independent and dependent variables. The formula for the
correlation coefficient is:

\end{document}


• Thank you so much. Now I only need to figure out how to make the shadow. Worked perfectly – BlazeAxtrius Nov 22 '15 at 16:26
• @BlazeAxtrius: I forgot the shadows in the screen-shot, but the updated code has them – user31729 Nov 22 '15 at 16:27
• Yeap. Works like a charm. You are a god. :D – BlazeAxtrius Nov 22 '15 at 16:28