我有一个用蓝色构建的框tcolorbox
,我想在这个框中插入一个图形。但是,图形使用的空间是白色的。我怎样才能消除这个空白空间,并使我的图形所在的背景均匀?这是我的输出:
代码如下:
代码如下:
\documentclass[10pt,a4paper]{report}
\usepackage[portuguese]{babel}
\usepackage[utf8]{inputenc}
\usepackage[top=1cm,bottom=1.5cm,right=1cm,left=1cm]{geometry}
\usepackage{amsmath,amsfonts,amssymb,mathrsfs,tikz,fancyhdr,array}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{pgfplots}
\usepackage{tikz,tkz-euclide}
\newtcolorbox[auto counter]{exer}{breakable,enhanced,before skip=5mm,after skip=5mm,title={Exercício \thetcbcounter},attach boxed title to top left={yshift=-3mm},colbacktitle=blue!25,boxsep=3mm,boxrule=1.5pt,colframe=blue,colback=blue!5,coltitle=black}
\begin{document}
\begin{exer}
(***)Prove, usando coordenadas cilíndricas \textit{modificada}, que o volume de um cone elíptico de semi-eixos $a$ e $b$ e altura $h$ é
$$V=\frac{\pi}{3}abh.$$
\includegraphics{cilin.png}
\end{exer}
\end{document}
答案1
我认为使用外部工具更容易。
对于零工,我使用免费的在线服务。
使用 ImageMagick (您只需要convert.exe
,背景颜色是 - 在这种情况下ffffff
- )
从命令行运行:
convert cillinder.png -fuzz 4% -transparent "#ffffff" cillinder-transparent4.png
\documentclass[10pt,a4paper]{report}
\usepackage[portuguese]{babel}
\usepackage[utf8]{inputenc}
\usepackage[top=1cm,bottom=1.5cm,right=1cm,left=1cm]{geometry}
\usepackage{amsmath,amsfonts,amssymb,mathrsfs,tikz,fancyhdr,array}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{pgfplots}
\usepackage{tikz,tkz-euclide}
\newtcolorbox[auto counter]{exer}{breakable,enhanced,before skip=5mm,after skip=5mm,title={Exercício \thetcbcounter},attach boxed title to top left={yshift=-3mm},colbacktitle=blue!25,boxsep=3mm,boxrule=1.5pt,colframe=blue,colback=blue!5,coltitle=black}
\begin{document}
\begin{exer}
(***)Prove, usando coordenadas cilíndricas \textit{modificada}, que o volume de um cone elíptico de semi-eixos $a$ e $b$ e altura $h$ é
$$V=\frac{\pi}{3}abh.$$
\includegraphics[scale=3]{cillinder.png}
\end{exer}
\begin{exer}
(***)Prove, usando coordenadas cilíndricas \textit{modificada}, que o volume de um cone elíptico de semi-eixos $a$ e $b$ e altura $h$ é
$$V=\frac{\pi}{3}abh.$$
\includegraphics[scale=3]{cillinder-transparent4}
\end{exer}
\end{document}
答案2
这是一个解决方法。它不能解决任何图片的相同问题,但用 Ti 绘制这个图片并不难钾Z。
如您所见,绘制图形的代码非常简短。轴和一条近似曲线分为两部分(背面和正面)。样式(阴影、等距等)的线条比绘图本身的线条还多。
\documentclass[10pt,a4paper]{report}
\usepackage [portuguese] {babel}
\usepackage [top=1cm,
bottom=1.5cm,
right=1cm,
left=1cm] {geometry}
\usepackage {graphics}
\usepackage {tikz}
\usepackage [most] {tcolorbox}
\newtcolorbox[auto counter]{exer}{breakable,enhanced,before skip=5mm,after skip=5mm,title={Exercício \thetcbcounter},attach boxed title to top left={yshift=-3mm},colbacktitle=blue!25,boxsep=3mm,boxrule=1.5pt,colframe=blue,colback=blue!5,coltitle=black}
% TikZ styles
%%%%%%%%%%%%%%
% shadings
\pgfdeclarehorizontalshading{backblue}{100pt}
{%
color(0pt)=(blue!40);
color(60pt)=(white);
color(100pt)=(blue!20)
}
\pgfdeclarehorizontalshading{frontblue}{100pt}
{%
color(0pt)=(blue!40);
color(40pt)=(white);
color(100pt)=(blue!60)
}
%%%%%%%%%%%%%%
% isometric perspective (axes dimensions)
\pgfmathsetmacro\xx{1/sqrt(2)}
\pgfmathsetmacro\xy{1/sqrt(6)}
\pgfmathsetmacro\zz{sqrt(2/3)}
%%%%%%%%%%%%%%
% other styles
\tikzset
{%
isometric/.style={x={(-\xx cm,-\xy cm)},y={(\xx cm,-\xy cm)},z={(0 cm,\zz cm)}},
front/.style={blue,thick,shading=frontblue,fill opacity=0.8},
back/.style={blue,thick,shading=backblue}
}
\begin{document}
\begin{exer}
(***)Prove, usando coordenadas cilíndricas \textit{modificada}, que o volume de um cone elíptico de semi-eixos $a$ e $b$ e altura $h$ é
\[V=\frac{\pi}{3}abh.\]
\begin{tikzpicture}[isometric]
\def\r{-20} % rotation angle
% cylinder, back
\draw[back] (315:1) arc (315:135:1) --
plot[samples=46,domain=135:315] ({cos(\x)},{sin(\x)},{2+0.5*sin(3*\x-\r)}) -- cycle;
% axes
\draw[thick,-stealth] (0,0,0) -- (2,0,0) node [left] {$x$};
\draw[thick,-stealth] (0,0,0) -- (0,2,0) node [right] {$y$};
\draw[thick,-stealth] (0,0,0) -- (0,0,3.5) node [right] {$z$};
% cylinder, front
\draw[front] (135:1) arc (135:-45:1) --
plot[samples=46,domain=-45:135] ({cos(\x)},{sin(\x)},{2+0.5*sin(3*\x-\r)}) -- cycle;
\end{tikzpicture}
\end{exer}
\end{document}