-1

May I ask how I could draw attached figure with LaTex?

Sincerely Ehsanenter image description here

  • 11
    Welcome to TeX.SX! You may ask, but as it stands this is a do-it-for-me question. Please add your attempts here (as minimal compilable code example) and clarify at which specific point you need help. – TeXnician Jul 30 '18 at 14:59
  • 3
    See minimal working example (MWE) for what needs to go into such a document. – BambOo Jul 30 '18 at 15:15
  • Dear, Your are right. I have to prepare a minimal code and after somehow attempts ask question. However I really didn't work much with Latex and it is almost impossible for me to do that, especially graphic codes. BTW I apologize for asking help in this way. Thank you for your help. – Ehsan Taghizadeh Aug 2 '18 at 8:40
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – samcarter_is_at_topanswers.xyz Aug 8 '18 at 14:19
5

This is a pretty mess but maybe someone can clean it up a little bit. (E.g. declare the used node style as a „real“ node style [\node[NAME] …] and so on.)

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,calc}
\begin{document}
    \begin{tikzpicture}[>=angle 45,every node/.style={font=\LARGE}]
        \draw (0,0) rectangle (7,9);
        \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,6.5) {};
            \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
            \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
        \begin{scope}[yshift=-5cm]
            \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,7.5) {};
                \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
        \end{scope}
            \begin{scope}[xshift=7cm,yshift=-5cm]
                \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,7.5) {};
                    \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                    \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
            \end{scope}
            \begin{scope}[xshift=7cm]
                \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,6.5) {};
                    \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                    \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
            \end{scope}
            \node[left] at (0,9) {$T$};
                \draw[->] (0,9.5) --+ (0,1) node[below left,xshift=-5,yshift=3] {$t$};
            \node at (3.5,4.5) {$\Omega\times I$};
            \node[below=5] at (3.5,0) {$\Omega\times 0$};
            \node[above=5] at (3.5,9) {$\Omega\times T$};
                \node[left=5] at (0,0) {0};
            \draw[->] (7.5,0) --+ (1,0) node[below right,yshift=-3,xshift=-3] {$x$};
                \draw (0,7.5) -- (9,9) node[above=10] {$\partial\,\Omega\times I$} -- (7,7.5);
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            \begin{scope}[shift={(15,0)}]
                    \draw (0,0) rectangle (7,9);
                        \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,6.5) {};
                            \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                            \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
                    \begin{scope}[yshift=-5cm]
                        \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,7.5) {};
                            \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                            \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
                    \end{scope}
                    \begin{scope}[xshift=7cm,yshift=-5cm]
                        \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,7.5) {};
                            \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                            \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
                    \end{scope}
                    \begin{scope}[xshift=7cm]
                        \node[fill=white,inner xsep=.6cm,inner ysep=.3cm] (a) at (0,6.5) {};
                            \draw (a.north west) to[bend left=40] ($(a.north west)!.5!(a.north east)$) to[bend right=40] (a.north east);
                            \draw (a.south west) to[bend left=40] ($(a.south west)!.5!(a.south east)$) to[bend right=40] (a.south east);
                    \end{scope}
                \draw (0,5.5) -- (7,5.5);
                \draw (0,4.5) -- (7,4.5);
                \draw (0,3.5) -- (7,3.5);
                    \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-2);
                    \draw[xshift=.5cm] (14/3,5.5) --+ (0,-2);
                    \draw (3.5,5.5) --+ (0,-2);
                \draw (0,8) -- (7,8);
                    \begin{scope}[yshift=3.5cm]
                        \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-1);
                        \draw[xshift=.5cm] (14/3,5.5) --+ (0,-1);
                        \draw (3.5,5.5) --+ (0,-1);
                    \end{scope}
                \draw (0,1) -- (7,1);
                    \begin{scope}[yshift=-4.5cm]
                        \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-1);
                        \draw[xshift=.5cm] (14/3,5.5) --+ (0,-1);
                        \draw (3.5,5.5) --+ (0,-1);
                    \end{scope}
                \draw[->] (0,9.5) --+ (0,1) node[below left,xshift=-5,yshift=3] {$t$};
                \draw[->] (7.5,0) --+ (1,0) node[below right,yshift=-3,xshift=-3] {$x$};
                    \node[left=30] at (0,0) {$t_0$};
                    \node[left=30] at (0,1) {$t_1$};
                        \node[left=30] at (0,3.5) {$t_n$};
                        \node[left=30] at (0,4.5) {$t_{n+1}$};
                        \node[left=30] at (0,5.5) {$t_{n+2}$};
                            \node[left=30] at (0,8) {$t_{N-1}$};
                            \node[left=30] at (0,9) {$t_N = T$};
            \end{scope}
    \end{tikzpicture}
\end{document}

A slightly shorter version can be obtained by using pics:

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,calc}
\tikzset{pics/.cd,
  broken line/.style={
    code={
      \fill [white] (-1,-0.25) rectangle (1,0.25);
      \draw (-0.5,-0.25) to[bend left=40] (0,-0.25) to[bend right=40] (0.5,-0.25);
      \draw (-0.5,0.25) to[bend left=40] (0,0.25) to[bend right=40] (0.5,0.25);
    }
  },
}
\begin{document}
    \begin{tikzpicture}[>=angle 45,every node/.style={font=\LARGE}]
        \draw (0,0) rectangle (7,9);
        \foreach \Coord in {(0,6.5),(0,2.5),(7,6.5),(7,2.5)}
        {\path \Coord pic{broken line};}
            \node[left] at (0,9) {$T$};
            \draw[->] (0,9.5) --+ (0,1) node[below left,xshift=-5,yshift=3] {$t$};
            \node at (3.5,4.5) {$\Omega\times I$};
            \node[below=5] at (3.5,0) {$\Omega\times 0$};
            \node[above=5] at (3.5,9) {$\Omega\times T$};
            \node[left=5] at (0,0) {0};
            \draw[->] (7.5,0) --+ (1,0) node[below right,yshift=-3,xshift=-3] {$x$};
            \draw (0,7.5) -- (9,9) node[above=10] {$\partial\,\Omega\times I$} -- (7,7.5);
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            \begin{scope}[shift={(15,0)}]
                    \draw (0,0) rectangle (7,9);
        \foreach \Coord in {(0,6.5),(0,2.5),(7,6.5),(7,2.5)}
        {\path \Coord pic{broken line};}
                \draw (0,5.5) -- (7,5.5);
                \draw (0,4.5) -- (7,4.5);
                \draw (0,3.5) -- (7,3.5);
                    \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-2);
                    \draw[xshift=.5cm] (14/3,5.5) --+ (0,-2);
                    \draw (3.5,5.5) --+ (0,-2);
                \draw (0,8) -- (7,8);
                    \begin{scope}[yshift=3.5cm]
                        \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-1);
                        \draw[xshift=.5cm] (14/3,5.5) --+ (0,-1);
                        \draw (3.5,5.5) --+ (0,-1);
                    \end{scope}
                \draw (0,1) -- (7,1);
                    \begin{scope}[yshift=-4.5cm]
                        \draw[xshift=-.5cm] (7/3,5.5) --+ (0,-1);
                        \draw[xshift=.5cm] (14/3,5.5) --+ (0,-1);
                        \draw (3.5,5.5) --+ (0,-1);
                    \end{scope}
                \draw[->] (0,9.5) --+ (0,1) node[below left,xshift=-5,yshift=3] {$t$};
                \draw[->] (7.5,0) --+ (1,0) node[below right,yshift=-3,xshift=-3] {$x$};
                    \node[left=30] at (0,0) {$t_0$};
                    \node[left=30] at (0,1) {$t_1$};
                        \node[left=30] at (0,3.5) {$t_n$};
                        \node[left=30] at (0,4.5) {$t_{n+1}$};
                        \node[left=30] at (0,5.5) {$t_{n+2}$};
                            \node[left=30] at (0,8) {$t_{N-1}$};
                            \node[left=30] at (0,9) {$t_N = T$};
            \end{scope}
    \end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||
  • 2
    I tried to simplify your nice code a bit. Of course, if you don't like it I'll be happy to revert the changes. BTW, Alan Munn, who is always right (unless he disagrees with cfr), suggest so add a picture. So after I added a screen shot I also upvoted your nice answer. ;-) – user121799 Jul 30 '18 at 19:54
  • @marmot: This was exactly that what I was looking for! Thank you! – current_user Jul 31 '18 at 15:07
  • 1
    @Ehsan_Taghizadeh: Yeah, just mark the answer as the best one … – current_user Aug 3 '18 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.