我一直在尝试在图形、其标题和标题名称周围放置单独的框架。请参见下图:
我已经设法在图像本身和标题周围创建了一个框架:
但是我怎样才能将标题名称(例如图 1)放在单独的框中?
到目前为止我的代码如下所示:
\documentclass[t,8pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{caption}
\usepackage{tcolorbox}
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[
innerlinewidth=0.1mm,
roundcorner=4pt,
linecolor=black,
innerleftmargin=6pt,
innerrightmargin=6pt,
innertopmargin=6pt,
innerbottommargin=6pt]{mybox}
% Framed figure
\newcommand{\framedFigure}[2]{%
\vspace{-2mm}
\begin{figure}
\begin{mybox}
\centering
#1
\end{mybox}
\vspace{-3.5mm}
\begin{tcolorbox}[
boxrule=0.2mm,boxsep=-3.5mm,lowerbox=ignored,colback=lightgray,
colframe=black
]
\caption{#2}
\end{tcolorbox}
\vspace{-3mm}
\end{figure}
}
\begin{document}
\begin{frame}{}
\framedFigure{
\begin{tikzpicture}[scale=1.3]
\node[draw=black,circle,fill=lightgray] (A) at (0,0){\textbf{A}};
\node[draw=black,circle,fill=lightgray] (B) at (3,0){\textbf{B}};
\draw[->,dashed] (A) -- node[above]{$k$} (B);
\end{tikzpicture}
}{$k$-$folgt$ Relation für die kritischen Abschnitte A und B}
\end{frame}
\end{document}
任何帮助都将不胜感激。提前致谢。:) Daniel
答案1
\documentclass[t,8pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[
innerlinewidth=0.1mm,
roundcorner=4pt,
linecolor=black,
innerleftmargin=6pt,
innerrightmargin=6pt,
innertopmargin=6pt,
innerbottommargin=6pt]{mybox}
\setbeamertemplate{caption}{%
\begin{tcolorbox}[colback=lightgray,colframe=black,width=.25\linewidth]
\insertcaptionname~%
\insertcaptionnumber%
\usebeamertemplate{caption label separator}%
\end{tcolorbox}%
\space%
\begin{tcolorbox}[colback=lightgray,colframe=black,width=.74\linewidth]
\insertcaption%
\end{tcolorbox}%
}
\begin{document}
\begin{frame}{}
\begin{figure}
\begin{mybox}
\centering
\begin{tikzpicture}[scale=1.3]
\node[draw=black,circle,fill=lightgray] (A) at (0,0){\textbf{A}};
\node[draw=black,circle,fill=lightgray] (B) at (3,0){\textbf{B}};
\draw[->,dashed] (A) -- node[above]{$k$} (B);
\end{tikzpicture}
\end{mybox}
\caption{$k$-$folgt$ Relation für die kritischen Abschnitte A und B}
\end{figure}
\end{frame}
\end{document}