我想按照以下代码将“我的文本”(垂直)与图片对齐:
\documentclass[10pt,xcolor={dvipsnames,table}]{beamer}
\mode<article> % only for the article version
{
\usepackage{fullpage}
\usepackage{hyperref}
}
\mode<presentation>
{
%\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
\setbeamercovered{transparent}
\usefonttheme{serif}
\usecolortheme{crane}
}
\setbeamercovered{dynamic}
\setbeamertemplate{items}[circle]
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning,fit,backgrounds,shapes.geometric}
\newcommand\drawnestedsets[4]{
% initial position
\def\position{#1}
% number of sets
\def\nbsets{#2}
% list of sets
\def\listofnestedsets{#3}
% reversed list of colors
\def\reversedlistofcolors{#4}
% position and draw labels of sets
\coordinate (circle-0) at (#1);
\coordinate (set-0) at (#1);
\foreach \set [count=\c] in \listofnestedsets {
\pgfmathtruncatemacro{\cminusone}{\c - 1}
% label of current set (below previous nested set)
\node[below=3pt of circle-\cminusone,inner sep=0]
(set-\c) {\set};
% current set (fit current label and previous set)
\node[circle,inner sep=0,fit=(circle-\cminusone)(set-\c)]
(circle-\c) {};
}
% draw and fill sets in reverse order
\begin{scope}[on background layer]
\foreach \col[count=\c] in \reversedlistofcolors {
\pgfmathtruncatemacro{\invc}{\nbsets-\c}
\pgfmathtruncatemacro{\invcplusone}{\invc+1}
\node[circle,draw,fill=\col,inner sep=0,
fit=(circle-\invc)(set-\invcplusone)] {};
}
\end{scope}
}
\begin{document}
\begin{frame}
\begin{tabular}{lr}
%\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\begin{minipage}{8.0cm}
My text
\end{minipage}
& %\resizebox{3.0cm}{0.5cm}{
\resizebox{3.0cm}{!}{
\begin{tikzpicture}
\drawnestedsets{0,-1}{4}{A,
B,C,D}{blue!50,red!50,yellow!50,orange}
\end{tikzpicture}}
%\hline
\end{tabular}
\end{frame}
\end{document}
欢迎任何帮助。
答案1
您可以使用baseline=...
键tikzpicture
调整垂直对齐方式:
\documentclass[10pt,xcolor={dvipsnames,table}]{beamer}
\mode<article> % only for the article version
{
\usepackage{fullpage}
\usepackage{hyperref}
}
\mode<presentation>
{
%\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
\setbeamercovered{transparent}
\usefonttheme{serif}
\usecolortheme{crane}
}
\setbeamercovered{dynamic}
\setbeamertemplate{items}[circle]
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning,fit,backgrounds,shapes.geometric}
\newcommand\drawnestedsets[4]{
% initial position
\def\position{#1}
% number of sets
\def\nbsets{#2}
% list of sets
\def\listofnestedsets{#3}
% reversed list of colors
\def\reversedlistofcolors{#4}
% position and draw labels of sets
\coordinate (circle-0) at (#1);
\coordinate (set-0) at (#1);
\foreach \set [count=\c] in \listofnestedsets {
\pgfmathtruncatemacro{\cminusone}{\c - 1}
% label of current set (below previous nested set)
\node[below=3pt of circle-\cminusone,inner sep=0]
(set-\c) {\set};
% current set (fit current label and previous set)
\node[circle,inner sep=0,fit=(circle-\cminusone)(set-\c)]
(circle-\c) {};
}
% draw and fill sets in reverse order
\begin{scope}[on background layer]
\foreach \col[count=\c] in \reversedlistofcolors {
\pgfmathtruncatemacro{\invc}{\nbsets-\c}
\pgfmathtruncatemacro{\invcplusone}{\invc+1}
\node[circle,draw,fill=\col,inner sep=0,
fit=(circle-\invc)(set-\invcplusone)] {};
}
\end{scope}
}
\begin{document}
\begin{frame}
\begin{tabular}{lr}
%\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\begin{minipage}{8.0cm}
My text
\end{minipage}
& %\resizebox{3.0cm}{0.5cm}{
\resizebox{3.0cm}{!}{
\begin{tikzpicture}[baseline=-2cm]
\drawnestedsets{0,-1}{4}{A,
B,C,D}{blue!50,red!50,yellow!50,orange}
\end{tikzpicture}}
%\hline
\end{tabular}
\end{frame}
\end{document}