代码之家  ›  专栏  ›  技术社区  ›  Varun Madiath

在乳胶中创造环境

  •  2
  • Varun Madiath  · 技术社区  · 16 年前

    嗨,我正在尝试用乳胶创造一个环境,重现以下效果。

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

    我想说出来。

    \begin{bashcommands}
    Hello
    Whats Up
    \end{bashcommands}
    
    3 回复  |  直到 16 年前
        1
  •  4
  •   Amir Rachum    16 年前

    这对我很有用:

    \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}
    }
    

    See this, as well.

        3
  •  0
  •   grddev    16 年前

    使用 Donald Arseneau's framed.sty ,您可以这样做,如果需要跨越多个页面,也可以很好地工作。

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