假设我们在以下环境中有一个 tcolorbox:
\documentclass[17pt]{beamer}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfkeys}
%
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{multirow}
%
\usepackage{tikz}
\usepackage{tcolorbox}
%
\usepackage{listings}
%
%
\begin{document}
\begin{frame}[fragile]
\begin{tcolorbox}[title=boxtitle,width=250pt, move downward= 10pt]
\begin{lstlisting}[language=TeX]
code...
\end{lstlisting}
Some text
\begin{lstlisting}[language=Java]
more code...
\end{lstlisting}
\end{tcolorbox}
\end{frame}
\end{document}
我怎样才能将tcolorbox
I buildt 移动到我想要的位置(在框架中)?我尝试过通过以下方式移动它,[move downwards*= 9pt]
但这给了我一个例外:
Package pgfkeys Error: I do not know the key '/tcb/enhanced' and I am going to ignore it. Perhaps you misspelled it. ...h=280pt, boxrule= 2pt, move downward= 10pt]
另外,我看到了一篇关于嵌入tcolorbox
“节点”或“tlrbox”内部的帖子,但我不太明白这是如何做到的。
答案1
您始终可以将节点包含tcolorbox
在内部TikZ
并将其放置在某个位置上current page
(您需要两次编译才能将框置于所需的位置)。
move downward
在 中没有定义为选项tcolorbox
,因此出现错误是正常的。
\documentclass[17pt]{beamer}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfkeys}
%
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{multirow}
%
\usepackage{tikz}
\usepackage{tcolorbox}
%
\usepackage{listings}
%
%
\begin{document}
\begin{frame}[fragile]{test}
\tikz[remember picture, overlay]%
\node[inner sep=0pt] at (current page.center) {%
\begin{tcolorbox}[title=boxtitle,width=250pt]%, move downward= 10pt]
\begin{lstlisting}[language=TeX]
code...
\end{lstlisting}
Some text
\begin{lstlisting}[language=Java]
more code...
\end{lstlisting}
\end{tcolorbox}};
\end{frame}
\begin{frame}[fragile]{test}
\tikz[remember picture, overlay]%
\node[inner sep=0pt, anchor=south east] at (current page.south east) {%
\begin{tcolorbox}[title=boxtitle,width=250pt]%, move downward= 10pt]
\begin{lstlisting}[language=TeX]
code...
\end{lstlisting}
Some text
\begin{lstlisting}[language=Java]
more code...
\end{lstlisting}
\end{tcolorbox}};
\end{frame}
\end{document}