我正在考虑制作一个新的块(或者不一定是投影机块),它将有一个灯的形状,只是为了说明一个新的想法。
这盏灯里面可能会有文字,解释这个想法。
有没有办法在 tikz 中做到这一点?
还有其他可以用来在 beamer 中阐明想法的想法吗?
答案1
我将您的图像保存为idea.png
(任何灯泡图像都可以),然后在其上插入文本,使用指定的想法的大小来确定垂直和水平偏移量以及插入的宽度\parbox
。
\documentclass{article}
\usepackage{graphicx,stackengine}
\usepackage[margin=1cm]{geometry}
\newlength\ideawidth
\def\defaultideawidth{3in}
\newcommand\idea[2][\defaultideawidth]{%
\setlength\ideawidth{#1}%
\stackinset{c}{-.02\ideawidth}{c}{.08\ideawidth}{\parbox{.3\ideawidth}{#2}}{%
\includegraphics[width=\ideawidth]{idea}}
}
\begin{document}
\idea[1.7in]{This is my idea!}
\idea[4in]{\LARGE This is also my idea!}
\idea[4in]{\small This is an idea that takes a lot of words to explain and so
I must use a smaller font!}
\end{document}
这样做beamer
没有问题,但可能需要更改一些默认值和偏移量,以匹配默认的无衬线字体:
\documentclass{beamer}
\usepackage{stackengine}
\newlength\ideawidth
\def\defaultideawidth{3in}
\newcommand\idea[2][\defaultideawidth]{%
\setlength\ideawidth{#1}%
\stackinset{c}{-.02\ideawidth}{c}{.06\ideawidth}{\parbox{.3\ideawidth}{#2}}{%
\includegraphics[width=\ideawidth]{idea}}
}
\begin{document}
\begin{frame}
\idea[1.7in]{\small This is my idea!}
\idea[2.2in]{This is also my idea!}
\end{frame}
\begin{frame}
\idea[3.5in]{\small This is an idea that takes a lot of words to explain and so
I must use a smaller font!}
\end{frame}
\end{document}
答案2
两种可能性tcolorbox
阿拉比默盒子:
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{ideabox}[2][]{colback=yellow!15!white, colframe=red!75!black,
fonttitle=\bfseries, beamer, watermark graphics=Lamp.png,
watermark opacity=.5, title=#2, #1}
\newtcolorbox{anotherideabox}[2][]{colback=yellow!15!white, colframe=red!75!black,
fonttitle=\bfseries, beamer, title=#2, #1,
sidebyside, righthand ratio=.3}
\begin{document}
\begin{frame}{Some ideas with \texttt{tcolorbox}}
\begin{ideabox}{Lamp as watermark}
\lipsum[2]
\end{ideabox}
\end{frame}
\begin{frame}{Some ideas with \texttt{tcolorbox}}
\begin{anotherideabox}{Lamp in \texttt{tcblower}}
\lipsum[2]
\tcblower
\includegraphics[width=\linewidth]{Lamp.png}
\end{anotherideabox}
\end{frame}
\end{document}
答案3
有點不同...
\PassOptionsToPackage{rgb,x11names,svgnames}{xcolor}
\documentclass[tikz,multi,varwidth,border=5pt]{standalone}
\usetikzlibrary{shapes.symbols}
\begin{document}
\begin{tikzpicture}[baseline=(n.north)]
\node (n) [starburst, fill=DarkViolet, draw=cyan, line width=2pt, font=\bfseries\sffamily, text=cyan, align=center] {NOW\\in LATIN!!};
\end{tikzpicture}
\begin{tikzpicture}[baseline=(n.center)]
\node (n) [starburst, fill=Gold, draw=WildStrawberry, line width=2pt, font=\bfseries\Large\sffamily, text=WildStrawberry] {NEW!};
\end{tikzpicture}
\end{document}