1

How do get the top box value in 1-3 and 3(1/2) in mdframed. Please refer screenshot below:

![enter image description here][1]

my MWE is:

\documentclass{article}
\usepackage[tikz]{mdframed}
\usepackage{lipsum}
\definecolor{greentitle}{cmyk}{.3,.02,.4,0}
\makeatletter
\newenvironment{understanding}[1][]%
  {\begin{mdframed}[
   bottomline=false,
   leftline=false,
   linecolor=greentitle,
   backgroundcolor=white,
   roundcorner=0pt,
   linewidth=1pt,
   innerrightmargin=25pt,
   singleextra={
     \fill[greentitle] (P) rectangle ([xshift=-13pt]P|-O);
     \node[overlay,anchor=south east,rotate=90,font=\color{white}\scshape] at (P) {\fontsize{10}    {12}\selectfont{UNDERSTANDING}};
    },
  ]
 }
 {\end{mdframed}}
\makeatother
\begin{document}
\begin{understanding}
\lipsum[2-3]
\end{understanding}
\end{document}

Please suggest good basic tikz basic user guide.

3
  • Why don't you try tcolorbox? It has more features and easy to use.
    – user11232
    Commented Nov 23, 2014 at 5:00
  • @HarishKumar: tcolorbox is also can i use. could you please provide me the sample code and good documentation for studying tcolorbox. I'm totally newbie of mdframed[tikz] and tcolorbox.
    – Balaji
    Commented Nov 23, 2014 at 5:05
  • For manual texdoc tcolorbox from terminal/command prompt. Yes I can give a sample but after some time though.
    – user11232
    Commented Nov 23, 2014 at 5:08

1 Answer 1

5

You can add additional nodes in singleextra

\documentclass{article}
\usepackage[tikz]{mdframed}
\usepackage{lipsum}
\definecolor{greentitle}{cmyk}{.3,.02,.4,0}
\makeatletter
\newenvironment{understanding}[1][]%
  {\begin{mdframed}[
   bottomline=false,
   leftline=false,
   rightline=false,
   linecolor=greentitle,
   backgroundcolor=white,
   roundcorner=0pt,
   linewidth=1pt,
   innerrightmargin=25pt,
   singleextra={
     \fill[greentitle] ([yshift=3ex]P) rectangle ([xshift=-13pt]P|-O);
     \node[overlay,anchor=south east,rotate=90,text=white,font=\scshape] at (P) {\fontsize{10}    {12}\selectfont{UNDERSTANDING}};
     \node[overlay,fill=gray!30,minimum width=0.75in,text depth = 0pt,text height=1.4ex,anchor=south east,text=white] at ([xshift=-13pt]P) {3(1/2)};
     \node[overlay,fill=gray,minimum width=0.75in,anchor=south east,text depth = 0pt,text height=1.4ex,text=white] at ([xshift=-13pt-0.75in]P) {1--3};
    },
  ]
 }
 {\end{mdframed}}
\makeatother
\begin{document}
\begin{understanding}
\lipsum[2-3]
\end{understanding}
\end{document}

enter image description here

As promised, here is a tcolorbox version which should get you started.

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\definecolor{greentitle}{cmyk}{.3,.02,.4,0}
\makeatletter
\newtcolorbox[auto counter]{understanding}[2][]{
  enhanced jigsaw,
  left=0pt,
  boxrule=0pt,
  toprule=1pt,
  arc=0pt,
  after=\par\noindent\vspace{2em},
  colback= white ,
  colframe=greentitle,
  overlay={
     \node[anchor=south west,text width=1.5in,fill=greentitle,text=white]
       (a) at ([xshift=-1pt]frame.north west) {\strut \Large\sffamily Exercise~\thetcbcounter: \space
        \normalsize#2};
     \draw[line width=2pt,rounded corners=1ex,white] (a.south west) |- (a.north east) -- (a.south east);
     \node[anchor=south east,text width=0.5in,text depth=0pt,text height=1.55ex,outer sep=0pt,align=center,fill=gray!30,text=white]
       (b) at (frame.north east) {3(1/2)};
     \node[anchor=east,text width=0.5in,text depth=0pt,text height=1.55ex,outer sep=0pt,align=center,fill=gray,text=white]
       (c) at (b.west) {1--3};
     \node[anchor=north east,text width=\tcb@height+1.55ex,outer sep=0pt,align=right,fill=greentitle,rotate=90,text=white,font=\sffamily\Large]
       (d) at ([yshift=3.1ex]frame.north east) {Understanding\hspace{1.6ex}\null};
    },
  #1}
\makeatother
\begin{document}
\begin{understanding}{Revision}
\lipsum[2-3]
\end{understanding}
\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .