![在 tcolorbox 中对齐文本和 tikzpicture](https://linux22.com/image/441542/%E5%9C%A8%20tcolorbox%20%E4%B8%AD%E5%AF%B9%E9%BD%90%E6%96%87%E6%9C%AC%E5%92%8C%20tikzpicture.png)
我想知道我是否可以在我的例子中插入一些图画并在它们周围添加一些文字,就像这样:
我尝试了两种不同的方法,但都没有奏效。第一种方法是使用“wrapfigure”,第二种方法是将文本插入“\node”中:
结果:
梅威瑟:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish,activeacute]{babel}
\usepackage{amssymb}
\usepackage[none]{hyphenat}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}
\newtcbtheorem[number within=section]{exx}{EXAMPLE}{
fonttitle=\bfseries, fontupper=\normalsize,
theorem style=standard,
enhanced,frame hidden,
boxrule=0pt,
left=0.2cm,right=0.2cm,top=0.2cm, toptitle=0.1cm+1pt,bottomtitle=-0.1cm+0.5em,
bottomrule=1pt,
colback=white,coltitle=red!75!black,
title style=white,
titlerule=1pt, titlerule style=red!75!black,
borderline south={1pt}{0pt}{red!75!black}
}{exx}
\usepackage{wrapfig}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{tikz}
\usetikzlibrary{calc, math, positioning, arrows.meta}
\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{\shorthandoff{>}\shorthandoff{<}}{}{}
\begin{document}
\begin{exx}{$\mathbb{R}^3$ curve}{}
\begin{wrapfigure}{R}{7cm}
\begin{tikzpicture}[> ={Straight Barb[line width=1pt, length=1mm]}]
\begin{axis}[view={-20}{-15}, axis lines=center,axis on top,
xlabel=$y$,ylabel=$x$,zlabel=$z$,
xtick=\empty,ytick=\empty,ztick=\empty,
no marks,
xmin=-1.5,xmax=2,ymin=-1,ymax=1.5,zmin=0,zmax=23]
\addplot3+ [->, blue, domain=0:5*pi/9,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [->, blue, domain=5*pi/9:12.8,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [blue, domain=12.8:6*pi,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,0){};
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,6*pi){};
\end{axis}
\end{tikzpicture}
\end{wrapfigure}
We have $\gamma(t)=(\cos t,\sin t, t)$ with $t\in[0,2k\pi]$ and $k\in\mathbb{N}$, blablablabla blabla blablabla blablabla.\\
When $k=3$, we obtain the following blabla bla blablabla:
\end{exx}
\begin{exx}{$\mathbb{R}^3$ curve}{}
\begin{tikzpicture}[> ={Straight Barb[line width=1pt, length=1mm]}]
\begin{axis}[view={-20}{-15}, axis lines=center,axis on top,
xlabel=$y$,ylabel=$x$,zlabel=$z$,
xtick=\empty,ytick=\empty,ztick=\empty,
no marks,
xmin=-1.5,xmax=2,ymin=-1,ymax=1.5,zmin=0,zmax=23]
\addplot3+ [->, blue, domain=0:5*pi/9,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [->, blue, domain=5*pi/9:12.8,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [blue, domain=12.8:6*pi,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,0){};
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,6*pi){};
\node [left, align=flush left, xshift=2cm, yshift=0.3cm, text width=6cm] at (current bounding box.west) {We have $\gamma(t)=(\cos t,\sin t, t)$ with $t\in[0,2k\pi]$ and $k\in\mathbb{N}$, blablablabla blabla blablabla blablabla.\\
When $k=3$, we obtain the following blabla bla blablabla:};
\end{axis}
\end{tikzpicture}
\end{exx}
\end{document}
答案1
我只想并排使用tcolorbox
你的定理:
\documentclass{article}
\usepackage{amssymb}
\usepackage{tcolorbox}
\tcbuselibrary{theorems,skins}
\newtcbtheorem[number within=section]{exx}{EXAMPLE}{
fonttitle=\bfseries, fontupper=\normalsize,
theorem style=standard,
sidebyside, lower separated=false, sidebyside align=top seam,
enhanced, frame hidden,
boxrule=0pt,
left=0.2cm,right=0.2cm,top=0.2cm, toptitle=0.1cm+1pt,bottomtitle=-0.1cm+0.5em,
bottomrule=1pt,
colback=white,coltitle=red!75!black,
title style=white,
titlerule=1pt, titlerule style=red!75!black,
borderline south={1pt}{0pt}{red!75!black}
}{exx}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{exx}{$\mathbb{R}^3$ curve}{}
We have $\gamma(t)=(\cos t,\sin t, t)$ with $t\in[0,2k\pi]$ and
$k\in\mathbb{N}$, …
\medskip
When $k=3$, we obtain the following …
\tcblower
\begin{tikzpicture}[> ={Straight Barb[line width=1pt, length=1mm]}]
\begin{axis}[view={-20}{-15}, axis lines=center,axis on top,
xlabel=$y$,ylabel=$x$,zlabel=$z$,
xtick=\empty,ytick=\empty,ztick=\empty,
no marks,
xmin=-1.5,xmax=2,ymin=-1,ymax=1.5,zmin=0,zmax=23]
\addplot3+ [->, blue, domain=0:5*pi/9,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [->, blue, domain=5*pi/9:12.8,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\addplot3+ [blue, domain=12.8:6*pi,samples=100,samples y=0] ({sin(deg(x))},{cos(deg(x))},{x});
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,0){};
\node[draw=none,shape=circle,fill=blue, inner sep=1.3pt] at (0,1,6*pi){};
\end{axis}
\end{tikzpicture}
\end{exx}
\end{document}