0

I am still getting my head around drawing shapes in latex. So the question is on how to draw following rectangle. What I want to draw

Could any one demonstrate how to do so?

Thank you so much.

Will Kim
  • 2,032
  • So what code have you got so far? I take it that if you are trying to get to grips with it, you've tried something. It is a lot easier to help if we know where exactly you get stuck. (Not to mention which environment and/or packages you are using for drawing.) – cfr Oct 17 '15 at 03:14
  • My apologies. I was gonna get the code then learn the logic backwards. – Will Kim Oct 17 '15 at 03:17

2 Answers2

2

Here's one option using TikZ:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\filldraw[fill=cyan!60!black!30]
  (0,0) rectangle (4,-4);
\draw
  (0,-4) rectangle (6,-6)
  (4,0) rectangle (6,-6);
\draw[dotted]
  (4,0) to[bend right] node[fill=white] {$b$} (6,0);    
\draw[dotted]
  (0,0) to[bend left] node[fill=white] {$a$} (6,0);    
\draw[dotted]
  (0,-4) to[bend left] node[fill=white] {$b$} (0,-6);    
\draw[dotted]
  (0,0) to[bend right] node[fill=white] {$a$} (0,-6);    
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
1

A pstricks solution:

\documentclass[x11names, border=3pt]{standalone}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\pagestyle{empty}

\begin{document}

\psset{ linecolor =SteelBlue3, unit=1.5}
\begin{pspicture*}(-1,-1)(7,8)
\pnodes{A}(0,0)(0,6)(6,6)(6,0)
\pnodes{B}(0,2)(4,2)(6,2)(4,6)(4,0)
\psframe[linewidth=1.2pt](A0)(A2)
\psframe[fillstyle=solid, fillcolor=LightSteelBlue3!30!](B0)(B3)
\psline(B2)(B1)(B4)
\psset{linestyle=dotted, linewidth=1.2pt, linecolor=black, arcangle=20}
\ncarc{-}{A1}{A2}\ncput*{$a$}
\ncarc{-}{A0}{A1}\ncput*{$a$}
\ncarc{-}{A2}{B3}\ncput*{$b$}
\ncarc{-}{B0}{A0}\ncput*{$b$}
\end{pspicture*}

\end{document} 

enter image description here

Bernard
  • 271,350