문제

안녕하세요, 다음의 효과를 다시 만드는 라텍스에서 환경을 만들려고합니다.

\colorbox{bg}{\ttfamily{\color[RGB]{222,222,222}
Hello
Whats up
}
}
.

나는 말할 수 있고 싶다.

\begin{bashcommands}
Hello
Whats Up
\end{bashcommands}
.

도움이 되었습니까?

해결책

이것은 나를 위해 작동합니다 :

\makeatletter\newenvironment{bc_box}{%
   \begin{lrbox}{\@tempboxa}\begin{minipage}{\columnwidth}}{\end{minipage}\end{lrbox}%
   \colorbox{bg}{\usebox{\@tempboxa}}
}\makeatother

\newenvironment{bashcommands}{
    \begin{bc_box}\ttfamily\color[RGB]{222,222,222}
}{                                    
    \end{bc_box}
}
.

다른 팁

Donald Arseneau의 Framed.sty , 당신여러 페이지를 확장 해야하는 경우 멋지게 작동 할 수 있습니다.

\newenvironment{bashcommands}{%
  \definecolor{shadecolor}{named}{bg}%
  \begin{shaded}\ttfamily\color[RGB]{222,222,222}%
}{%
  \end{shaded}%
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top