Itemize 環境の自動幅ボックス

Itemize 環境の自動幅ボックス

新しい環境は、その中のコンテンツの幅と同じ幅のブロックを取得するために、varwidth と tikz を使用して定義されます。項目化が関係しない限り、正常に動作します。MWE はここに示されています。

\documentclass[]{beamer}

\usepackage{tikz}
\usepackage{varwidth}
\tikzstyle{example-box} = [fill=yellow, rectangle]

\newenvironment{autowidthblock}{
\begin{tikzpicture}
\node [example-box] (box)
\bgroup 
\begin{varwidth}{\linewidth}

}{
\end{varwidth}
\egroup;
\end{tikzpicture}
}

\begin{document}

\begin{frame}
\begin{autowidthblock}
With normal sentences, the width is rightly fit
\end{autowidthblock}

\begin{autowidthblock}
\begin{itemize}
\item With itemize environment,
\item The width is not auto-set
\item Instead spans the entire textwidth
\end{itemize}
\end{autowidthblock}

\end{frame}

\end{document}

ここに画像の説明を入力してください 項目化/列挙の幅も自動にする方法を誰か提案してもらえますか? よろしくお願いします。

関連情報