LaTeX forum ⇒ Page LayoutCreating Boxes with text Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
coachbennett1981
Posts: 252
Joined: Fri Feb 05, 2010 10:15 pm

Creating Boxes with text

Postby coachbennett1981 » Thu May 27, 2021 7:32 pm

Hi Everyone,

I am found this really nice example layout and I am trying to learn it on my own. The author said he uses LaTeX and I am trying to learn it. My code is below. I am attaching a picture of what I want the page to look like. Any help is appreciated. I am a novice for minipages/fbox and I am not sure if tcolorbox would be better. I have also included my graphic in case.

Thank you,
Nick


\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}}
\qquad
\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}

Attachments
Screen Shot 2021-05-27 at 12.01.31 PM.png
Screen Shot 2021-05-27 at 12.01.31 PM.png (101.63 KiB) Viewed 833 times
graph1.png
graph1.png (70.46 KiB) Viewed 833 times

coachbennett1981
Posts: 252
Joined: Fri Feb 05, 2010 10:15 pm

Postby coachbennett1981 » Sun May 30, 2021 9:09 pm

I think I found a nice solution using the tcolorbox package. I am new to it, but think I have the basics down. Here is my solution.

\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}


User avatar
Stefan Kottwitz
Site Admin
Posts: 9705
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon May 31, 2021 6:34 pm

Looks good, thank you for letting us know your solution!

Stefan
LaTeX.org admin

Bartman
Posts: 203
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Mon May 31, 2021 8:12 pm

If you already put the diagram in a command in the preamble, because it is likely to occur repeatedly, then you should also use it in the desired place.

You can combine the setting of the background color of the boxes instead of setting it again for each box. See section 4.16 "Layered Boxes and Every Box Settings" to learn how.

The increment of the values to be generated in the list for the xtick and ytick options is 1 by default. So it is sufficient to add the start and end values.

coachbennett1981
Posts: 252
Joined: Fri Feb 05, 2010 10:15 pm

Postby coachbennett1981 » Wed Jun 02, 2021 2:57 am

I usually do, but when I am learning code I try to learn the new code by continuing to type it. It is tedious, but it helps


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 6 guests