考虑以下两个文档:
(a):article
无法编译的类(密钥/tcb/thick
未知)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,arrows.meta,shapes}
\usepackage[most]{tcolorbox}
\newtcolorbox{tcbdummy}[1]{enhanced,#1}
\begin{document}
\begin{tcbdummy}{height=4.5cm,overlay={
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h1)+(-3cm,-1.5cm) |- ++ (-1.75cm,-.75cm) node[anchor=west,fill=blue!25,text=black] (heading) {Kapitelüberschrift};}
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h3)+(-.75cm,-1.8cm) -- ++ (0cm,-1.8cm) node[anchor=west,fill=blue!25,text=black] (subheading) {Abschnittsüberschrift};}
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h2)+(-4cm,-2cm) -- ++ (-4.5cm,-4cm) node[anchor=north,fill=blue!25,text=black] (text) {Textkörper};
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h4)+(-1.75cm,-2cm) -- (text);
}}
{\Large\bfseries Texte zum Testen\tikzmark{ex1-h1}}\vskip.75\baselineskip
Hier kommt normaler Text.\tikzmark{ex1-h2}\\[.3cm]
{\large\itshape Lorem ipsum\tikzmark{ex1-h3}}\vskip.5\baselineskip
Und noch mehr Text\tikzmark{ex1-h4}
\end{tcbdummy}
\end{document}
(b):beamer
可以编译的类
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,arrows.meta,shapes}
\usepackage[most]{tcolorbox}
\newtcolorbox{tcbdummy}[1]{enhanced,#1}
\begin{document}
\begin{frame}{Test}{Quack}
\begin{tcbdummy}{height=4.5cm,overlay={
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h1)+(-3cm,-1.5cm) |- ++ (-1.75cm,-.75cm) node[anchor=west,fill=blue!25,text=black] (heading) {Kapitelüberschrift};
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h3)+(-.75cm,-1.8cm) -- ++ (0cm,-1.8cm) node[anchor=west,fill=blue!25,text=black] (subheading) {Abschnittsüberschrift};
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h2)+(-4cm,-2cm) -- ++ (-4.5cm,-4cm) node[anchor=north,fill=blue!25,text=black] (text) {Textkörper};
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h4)+(-1.75cm,-2cm) -- (text);
}}
{\Large\bfseries Texte zum Testen\tikzmark{ex1-h1}}\vskip.75\baselineskip
Hier kommt normaler Text.\tikzmark{ex1-h2}\\[.3cm]
{\large\itshape Lorem ipsum\tikzmark{ex1-h3}}\vskip.5\baselineskip
Und noch mehr Text\tikzmark{ex1-h4}
\end{tcbdummy}
\end{frame}
\end{document}
我想将 beamer 图形移植到 article,但不起作用。功能上有什么不同?
答案1
区别只是多了两个右括号。如果你删除它们,一切都会正常 :)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,arrows.meta,shapes}
\usepackage[most]{tcolorbox}
\newtcolorbox{tcbdummy}[1]{enhanced,#1}
\begin{document}
\begin{tcbdummy}{height=4.5cm,overlay={
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h1)+(-3cm,-1.5cm) |- ++ (-1.75cm,-.75cm) node[anchor=west,fill=blue!25,text=black] (heading) {Kapitelüberschrift};% no closing brace
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h3)+(-.75cm,-1.8cm) -- ++ (0cm,-1.8cm) node[anchor=west,fill=blue!25,text=black] (subheading) {Abschnittsüberschrift};% no closing brace
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h2)+(-4cm,-2cm) -- ++ (-4.5cm,-4cm) node[anchor=north,fill=blue!25,text=black] (text) {Textkörper};
\draw[blue,thick,Stealth-,rounded corners] (pic cs:ex1-h4)+(-1.75cm,-2cm) -- (text);
}}
{\Large\bfseries Texte zum Testen\tikzmark{ex1-h1}}\vskip.75\baselineskip
Hier kommt normaler Text.\tikzmark{ex1-h2}\\[.3cm]
{\large\itshape Lorem ipsum\tikzmark{ex1-h3}}\vskip.5\baselineskip
Und noch mehr Text\tikzmark{ex1-h4}
\end{tcbdummy}
\end{document}