我是 tcolorbox 包的新手。使用下面的代码,我尝试向左侧第三个框添加空间,以便用我的图表填充空白。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=.25in]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\begin{document}
\begin{tcolorbox}[colback=white,enhanced,title=\textbf{One-Sided Limits},
attach boxed title to top center=
{yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=blue!75}]
Consider the function $f(x)$ whose graph is shown below.
\begin{tcbraster}[raster equal height=rows]
\begin{tcolorbox}[blankest]
\begin{tcbraster}[raster columns=1]
\begin{tcolorbox} What is $\displaystyle{\lim_{x\to 2}f(x)}$? \end{tcolorbox}
\begin{tcolorbox} What is $\displaystyle{\lim_{x\to -1}f(x)}$?\end{tcolorbox}
\begin{tcolorbox} What problem do you run into if you try to find $\displaystyle{\lim_{x\to 1} f(x)}$ \end{tcolorbox}
\end{tcbraster}
\end{tcolorbox}
\begin{tcolorbox}
\begin{tikzpicture}
\begin{axis}
[width=3in,
grid style={blue!75},
axis x line = center,
axis y line = center,
xmin = -2, xmax = 3,
ymin = -3, ymax = 3,
xtick = {-2,-1,...,3},
ytick = {-3,-2,...,3},
xlabel={$x$},
ylabel={$y$},
xlabel style={above right},
ylabel style={above right},
axis line style={latex-latex},
]
\addplot[thick,color=blue,domain=-2.2:1] {-x^2+3};
\addplot[thick,color=blue,domain=1:4] {-x+2};
\addplot[color=blue,mark=*,only marks] coordinates {(1,1)};
\addplot[color=blue,mark=*,fill=white,only marks] coordinates {(1,2)};
\end{axis}
\end{tikzpicture}
\end{tcolorbox}
\end{tcbraster}
\end{tcolorbox}
\end{document}
答案1
像这样?
我必须承认我不确定是否理解它,但我从文档第 317 页的示例中复制了space to
和的用法。add to natural height
tcolorbox
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=.25in]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\begin{document}
\begin{tcolorbox}[%
colback=white, enhanced, title=\textbf{One-Sided Limits},
attach boxed title to top center = {yshift=-3mm,yshifttext=-1mm},
boxed title style={size=small,colback=blue!75}]
Consider the function $f(x)$ whose graph is shown below.
\begin{tcbitemize}[raster equal height=rows]
\tcbitem[blankest, space to=\myspace]
\begin{tcbitemize}[raster columns=1, raster rows=3]
\tcbitem What is $\displaystyle{\lim_{x\to 2}f(x)}$?
\tcbitem What is $\displaystyle{\lim_{x\to -1}f(x)}$?
\tcbitem[add to natural height=\myspace] What problem do you run into if you try to find $\displaystyle{\lim_{x\to 1} f(x)}$
\end{tcbitemize}
\tcbitem[halign=center] %
\begin{tikzpicture}
\begin{axis}
[width=3in, grid style={blue!75},
axis x line = center, axis y line = center,
xmin = -2, xmax = 3, ymin = -3, ymax = 3,
xtick = {-2,-1,...,3}, ytick = {-3,-2,...,3},
xlabel={$x$}, ylabel={$y$},
xlabel style={above right}, ylabel style={above right},
axis line style={latex-latex},
]
\addplot[thick,color=blue,domain=-2.2:1] {-x^2+3};
\addplot[thick,color=blue,domain=1:4] {-x+2};
\addplot[color=blue,mark=*,only marks] coordinates {(1,1)};
\addplot[color=blue,mark=*,fill=white,only marks] coordinates {(1,2)};
\end{axis}
\end{tikzpicture}
\end{tcbitemize}
\end{tcolorbox}
\end{document}