问题:
我正在尝试找到一种自定义枚举项目的方法。基本上,我想保留标准版本,但也想将某些项目更改为彩色框。
最小工作示例:
\documentclass[14pt]{beamer}
\begin{document}
\setbeamertemplate{enumerate item}{%
\usebeamercolor[bg]{item projected}%
\raisebox{1.5pt}{\colorbox{bg}{\color{fg}\footnotesize\insertenumlabel}}%
}
\begin{frame}
\begin{enumerate}
\item Enum
\item Enum
\item Enum
\end{enumerate}
\end{frame}
\end{document}
输出:
期望输出:
基本上,我希望能够更改特定枚举框的颜色。项目后面的文本应始终垂直居中。
更新 1:
\documentclass{article}
\usepackage{xcolor}
\usepackage[shortlabels]{enumitem}
\newcommand{\specialitem}[3][white]{%
\item[%
\colorbox{#2}{\textcolor{#1}{\makebox(14,14){#3}}}%
]
}
\definecolor{editorOrange}{cmyk}{0, 0.8, 1, 0}
\definecolor{editorBlue}{cmyk}{1, 0.6, 0, 0}
\definecolor{editorGreen}{cmyk}{0.66, 0, 0.87, 0}
\definecolor{editorPink}{cmyk}{0, 1, 0, 0}
\begin{document}
\setlist[enumerate,1]{leftmargin=9mm}
\begin{enumerate}
\specialitem{editorPink}{H} \textcolor{editorPink}{Hyper} lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut auctor metus ac fermentum rutrum. Phasellus convallis scelerisque nulla, eu sollicitudin diam rutrum id. Curabitur dapibus dapibus nisl ac tempus. Praesent viverra tortor a mollis efficitur. Donec vehicula risus nec varius ornare. Suspendisse facilisis ante eu ex ultricies viverra.
\specialitem{editorBlue}{T} \textcolor{editorBlue}{Text} lorem ipsum dolor sit amet, consectetur adipiscing elit.
\specialitem{editorOrange}{M} \textcolor{editorOrange}{Markup} lorem ipsum dolor sit amet, consectetur adipiscing elit.lorem ipsum dolor sit amet, consectetur adipiscing elit.lorem ipsum dolor sit amet, consectetur adipiscing elit.
\specialitem{editorGreen}{L} \textcolor{editorGreen}{Language} lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{enumerate}
\end{document}
更新 1(输出):
答案1
在 内手动设置项目itemize
。下面我将其定义\specialitem[<text colour>]{<colour>}{<content>}
为\item
:
\documentclass{beamer}
\setbeamertemplate{enumerate item}{%
\usebeamercolor[bg]{item projected}%
\raisebox{1.5pt}{\colorbox{bg}{\color{fg}\footnotesize\insertenumlabel}}%
}
\newcommand{\specialitem}[3][white]{%
\item[%
\colorbox{#2}{\textcolor{#1}{\makebox[1em]{#3}}}%
]
}
\begin{document}
\begin{frame}
\begin{enumerate}
\item Enum
\item Enum
\item Enum
\end{enumerate}
\begin{itemize}
\specialitem{red!80}{H} \textcolor{red!80}{Here} is an item
\specialitem{blue!60!white}{T} \textcolor{blue!60!white}{This} is another item
\specialitem{orange!80!white}{M} \textcolor{orange!80!white}{Maybe} another item
\specialitem{green!70!white}{L} \textcolor{green!70!white}{Let} me show you another item
\end{itemize}
\end{frame}