minted in mdframed and tikz node, with new environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[UTF8, openany,twoside]{ctexbook} | |
\usepackage{minted} | |
\usepackage[tikz]{bclogo,rotating} | |
\usepackage{tikz} | |
\usepackage{mdframed} | |
\usepackage{geometry} | |
\usetikzlibrary{calc} | |
\DeclareGraphicsRule{.mps}{eps}{.mps}{} | |
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} | |
\usemintedstyle{tango} | |
\geometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm} | |
\newenvironment{attention}[1] | |
{\par\medskip\noindent | |
\begin{tikzpicture} | |
\node[inner sep = 0pt] (box) \bgroup% | |
\begin{minipage}[t]{.99\textwidth}% | |
\begin{minipage}{.3\textwidth} | |
\centering | |
\tikz[scale = 5]\node[scale = 3, rotate = 30]{\bclampe}; | |
\end{minipage}% | |
\begin{minipage}{.65\textwidth} | |
\textbf{#1}\par\smallskip | |
\surroundwithmdframed | |
[topline=false, bottomline=false, leftline=false, rightline=false, | |
backgroundcolor=lbcolor] | |
{minted}}% former part | |
{% | |
\end{minipage}\hfill | |
\end{minipage}% | |
\egroup; | |
\draw[black,line width=3pt] | |
( $ (box.north east) + (-5pt,3pt) $ ) -- ( $ (box.north east) + (0,3pt) $ ) -- ( $ (box.south east) + (0,-3pt) $ ) -- + (-5pt,0); | |
\draw[black,line width=3pt] | |
( $ (box.north west) + (5pt,3pt) $ ) -- ( $ (box.north west) + (0,3pt) $ ) -- ( $ (box.south west) + (0,-3pt) $ ) -- + (5pt,0); | |
\end{tikzpicture} | |
\par\medskip} | |
\newminted{bash}{fontsize=\footnotesize,linenos=false,breaklines=true} | |
\begin{document} | |
\begin{attention}{Attention} | |
\begin{bashcode} | |
export FS=$(virt-filesystem -a centos7.raw) | |
guestmount -a centos7.raw -m $FS /mnt | |
sed -i 's/xfs/ext4/g' /mnt/etc/fstab | |
guestumount /mnt | |
\end{bashcode} | |
\end{attention} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank for this snippet.
http://bbs.ctex.org/forum.php?mod=viewthread&tid=153146&extra=page%3D1