这个问题是建立解决方案这里。我想将背景颜色更改为蓝色或用户定义的颜色\definecolor{mybluei}{RGB}{0,173,239}
。但是当我尝试实现以下行时
\colorbox[mybluei]{0.95}{
我得到了错误! Package xcolor Error: Undefined color model 'mybluei'
请帮我更改背景颜色。谢谢。
以下是代码:
\begin{center}
\colorbox[gray]{0.95}{
\begin{minipage}{0.65\textwidth}
\SetAlgoLined
\SetNlSty{textbf}{}{:}
\begin{algorithm}[H]
\DontPrintSemicolon
This is line one\\
This is line two numbered\\
This should be numbered\\
This should also be numbered
\caption{Unnumbered lines}
\end{algorithm}
\end{minipage}}
\end{center}
答案1
\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{algorithm2e}
\definecolor{mybluei}{RGB}{0,173,239}
\begin{document}
\begin{center}
\colorbox{mybluei}{\color{red}
\begin{minipage}{0.85\textwidth}
\SetAlgoLined
\SetNlSty{textbf}{}{:}
\begin{algorithm}[H]
\DontPrintSemicolon
This is line one\\
This is line two numbered\\
This should be numbered\\
This should also be numbered\\
\vspace{1cm}
\caption{Unnumbered lines}
\end{algorithm}
\end{minipage}}
\end{center}
\end{document}