# Creating boxes for layout

I came across this file which is done in LaTeX, and I would like to learn how to do it. As you can see I have tried, but I am not great with mini-page, or fbox commands. I am wondering if there is a better way. Any help is appreciated.

I would like to have all the boxes aligned (flush together)


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=.5in]{geometry}
\usepackage{tcolorbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\fbox{\begin{minipage}[t][.5cm]{0,4\textwidth}
The Squeeze Theorem
\end{minipage}}
\fbox{\begin{minipage}[t][.5cm]{0,6\textwidth}
Name:
\end{minipage}}

\vspace{.25in}
\fbox{\begin{minipage}[t][6cm]{0,9\textwidth}
On the grid below, graph $f(x)=x^2,g(x)=x^2\cos\Big(\dfrac{1}{3}\Big)$, and $h(x)=-x^2$.  You may use a calculator, but make sure it is in radian mode.
\includegraphics[width=2in]{graph1.png}
\fbox{\begin{minipage}[t][4cm]{0,3\textwidth}What is $\displaystyle{\lim{x\to 0}\cos\Big(\dfrac{1}{x^3}\Big)}$?
\end{minipage}}
\end{minipage}}

\vspace{1in}

\fbox{\begin{minipage}[t][4cm]{0,9\textwidth}
Suppose that $x-3\leq f(x)\leq x^2+3x-2$ for all $x$. What is $\displaystyle{\lim_{x\to -1}f(x)}$?
\end{minipage}}

\vspace{.25in}

\fbox{\begin{minipage}[t][4cm]{0,9\textwidth}
Use the Squeeze theorem to evaluate $\displaystyle{\lim_{x\to 0}x^4\sin\Big(\dfrac{1}{x^2+1}\big)}$
\end{minipage}}

\end{document}


• Not sure what you mean by "aligned". Is that no horizontal space between boxes like "The Squeze..." and "Name", or no vertical space between boxes, or both? May 27, 2021 at 19:10
• The vertical lines run all the way up and down all aligned. That is what I was talking about. May 27, 2021 at 23:42

After several attempts, I think I cam up with a clean way to do this. The original is created using tikz.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=.5in]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}

\newcommand{\bennett}{\begin{tikzpicture}
\begin{axis}[width=3.5in,thick,
grid style={blue!75},
axis x line = center,
axis y line = center,
xmin = -5,   xmax = 5,
ymin = -3,  ymax = 3,
xtick = {-5,-4,...,5},
ytick = {-3,-2,...,3},
grid = both,
xlabel={$x$},
ylabel={$y$},
xlabel style={above right},
ylabel style={above right},
axis line style={latex-latex},
]
\end{axis}
\end{tikzpicture}}

\begin{document}
\begin{tcbraster}[raster columns=2,raster equal height,nobeforeafter,raster column skip=1cm,colback=white]
\begin{tcolorbox}
The Squeeze Theorem
\end{tcolorbox}
\begin{tcolorbox}
Name:
\end{tcolorbox}
\end{tcbraster}

\begin{tcolorbox}
[text height=9cm,text width=18cm,colback=white]

On the grid below, graph $f(x)=x^2,g(x)=x^2\cos\Big(\dfrac{1}{3}x\Big)$, and $h(x)=-x^2$.  You may use a calculator, but make sure it is in radian mode.
\begin{tcbitemize}[raster columns=2,raster equal height,
colback=white,fonttitle=\bfseries]

\tcbitem

\begin{tikzpicture}
\begin{axis}[width=3.5in,thick,
grid style={blue!75},
axis x line = center,
axis y line = center,
xmin = -5,   xmax = 5,
ymin = -3,  ymax = 3,
xtick = {-5,-4,...,5},
ytick = {-3,-2,...,3},
grid = both,
xlabel={$x$},
ylabel={$y$},
xlabel style={above right},
ylabel style={above right},
axis line style={latex-latex},
]
\end{axis}
\end{tikzpicture}

\tcbitem    What is $\displaystyle{\lim_{x\to 0}\cos\Big(\dfrac{1}{x^3}\Big)}$?
\end{tcbitemize}
\end{tcolorbox}

\vspace{.5in}
\begin{tcolorbox}[text height=7cm,colback=white]
Use the Squeeze theorem to evaluate $\displaystyle{\lim_{x\to 0}x^4\sin\Big(\dfrac{1}{x^2+1}\Big)}$
\end{tcolorbox}

\begin{tcolorbox}[colback=white,text height = 7cm]

Suppose that $x-3\leq f(x)\leq x^2+3x-2$ for all $x$. What is $\displaystyle{\lim_{x\to -1}f(x)}$?
\end{tcolorbox}

\end{document}



% boxprob.tex  SE 598847

\documentclass[draft]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=.5in]{geometry}
\usepackage{tcolorbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

%\fbox{\begin{minipage}[t][.5cm]{0,4\textwidth}
\fbox{\begin{minipage}[t][.5cm]{0.3\textwidth}
The Squeeze Theorem
\end{minipage}}
\hfil
%\fbox{\begin{minipage}[t][.5cm]{0,6\textwidth}
\fbox{\begin{minipage}[t][.5cm]{0.5\textwidth}
Name:
\end{minipage}}

\vspace{.25in}
\fbox{\begin{minipage}[t][6cm]{0,9\textwidth}
On the grid below, graph $f(x)=x^2,g(x)=x^2\cos\Big(\dfrac{1}{3}\Big)$, and $h(x)=-x^2$.  You may use a calculator, but make sure it is in radian mode.

\includegraphics[width=2in]{graph1.png}
\fbox{\raisebox{10.5\baselineskip}{\begin{minipage}[t][10\baselineskip]{0,3\textwidth}What is $\displaystyle{\lim{x\to 0}\cos\Big(\dfrac{1}{x^3}\Big)}$?
%    \fbox{\begin{minipage}[b][4cm]{0,3\textwidth}What is $\displaystyle{\lim{x\to 0}\cos\Big(\dfrac{1}{x^3}\Big)}$?
\end{minipage}}
}
\end{minipage}}

\vspace{1in}

\fbox{\begin{minipage}[t][4cm]{0,9\textwidth}
Suppose that $x-3\leq f(x)\leq x^2+3x-2$ for all $x$. What is $\displaystyle{\lim_{x\to -1}f(x)}$?
\end{minipage}}

\vspace{.25in}

\fbox{\begin{minipage}[t][4cm]{0,9\textwidth}
Use the Squeeze theorem to evaluate $\displaystyle{\lim_{x\to 0}x^4\sin\Big(\dfrac{1}{x^2+1}\big)}$
\end{minipage}}

\end{document}


I'm still not sure what you mean about the "vertical lines run all the way up and down aligned". Do you want all the boxes to have the same width? The graph you show has lots of vertical lines, what are they to be "aligned" with?

You will have to adjust your various length commands to get what you are after.

• Yes, all the boxes have the same width May 28, 2021 at 19:57