0

I want to draw a figure in latex like this: enter image description here

Would any one give me some tips? Thanks!

5

You could use tikz-cd:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[column sep=-2pt,
every arrow/.append style={dash}]
A&\le &B&\le &C&\le &D\arrow{dlll}[description]{\le}\\
&&&E\arrow{ulll}[description]{\le}\\
\end{tikzcd}
\end{document}

Edit: and if you want curved lines, just add bend left=25 to the arrow style:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
    \begin{tikzcd}[column sep=-2pt,
        every arrow/.append style={dash, bend left=25}]
        A&\le &B&\le &C&\le &D\arrow{dlll}[description]{\le}\\
        &&&E\arrow{ulll}[description]{\le}\\
    \end{tikzcd}
\end{document}

To get this:

enter image description here

2

Here is a slightly different circular approach:

Sample output

\documentclass{article}

\usepackage{amsmath,amssymb,graphicx,tikz}

\begin{document}

\begin{tikzpicture}
  \path (180:1cm) node {\( A \)}
  -- (120:1cm) node {\( B \)} node[sloped,pos=.5] {\( \leqslant \)}
  -- (60:1cm) node {\( C \)} node[sloped,pos=.5] {\( \leqslant \)}
  -- (0:1cm) node {\( D \)} node[sloped,pos=.5] {\( \leqslant \)}
  -- (-90:.7cm) node {\( E \)}  node[sloped,pos=.5] {\( \leqslant \)}
  -- cycle  node[sloped,pos=.5] {\( \leqslant \)};
\end{tikzpicture}

\end{document}
  • Haha, thanks for the fun circular approach. It is a nice example for presenting a circular relation :-) – Pepper M Sep 30 '17 at 15:53
2

A pstricks solution, using an ordinary displaymath environment and a psmatrix:

\documentclass[svgnames]{article}
\usepackage{pst-node}
\usepackage{auto-pst-pdf} % for pdflatex compilation

\begin{document}

\[ \begin{psmatrix}[rowsep=4ex]
        \rnode{A}{A} ≤ B \Rnode{le}{{} ≤ {}} C ≤ \rnode{D}{D} \\
        [name=E] E
        \psset{nodesep=0.3em, nrot=:U, linewidth=0.5pt, linecolor=Tomato, framesep=1pt}
        \nccurve[angleA=-80, angleB=160]{A}{E}\ncput*{ ≤ }
        \nccurve[angleA=20, angleB=-110]{E}{D}\ncput*{ ≤ }
    \end{psmatrix} \]

\end{document} 

enter image description here

  • Bernard, thanks! The inequalities between A, E, and D look very cool. – Pepper M Sep 30 '17 at 15:51
  • @PepperM: If you decide to use this solution with pdflatex, don't forget to add to the compiler the switch --enable-write18 (MiKTeX) or -shell-escape (TeXLive, MacTeX). – Bernard Sep 30 '17 at 16:12
  • Bernard, thanks for your help. I appreciate! – Pepper M Sep 30 '17 at 16:16
1

for fun, far more complicated than CarLaTeX answer :-) :

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{calc, chains,
                positioning}
\usepackage{amsmath}

\begin{document}
    \begin{tikzpicture}[
node distance = 5mm and 0mm,
  start chain = A going right,
  every node/.style = {inner sep=1mm, font=\large, on chain},
                        ]
% equation
\node   {$A$};      % A-1
\node   {$\leq$};
\node   {B};
\node   {$\leq$};   % A-4
\node   {$C$};
\node   {$\leq$};
\node   {$D$};      % A-7
%
\node[below=of $(A-2.south)!0.5!(A-3.south)$] {$\leq$}; % A-8
\node[below=of A-4] {$E$};                              % A-9
\node[below=of $(A-5.south)!0.5!(A-6.south)$] {$\leq$}; % A-10
% lines
\draw[thick, rounded corners, red]  
    (A-7) |- (A-10) (A-10) -- (A-9) (A-9) -- (A-8)  (A-8) -| (A-1);
    \end{tikzpicture}
\end{document}

enter image description here

  • Zarko, thanks for the fun solution. I have earned a lot from you guys ! – Pepper M Sep 30 '17 at 16:14
1

I would use TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[baseline=(A.base), inner sep=0pt, outer sep=0pt]
    \node (A) {$A$};
    \node (leq) [base right=0pt of A] {${}\leq B \leq C \leq {}$};
    \node (D) [base right=0pt of leq] {$D$};
    \begin{scope}[every node/.style={fill=white, inner sep=2pt}]
        \draw[draw=red, bend right=60, shorten >=5pt, shorten <=5pt] (A.south) to
            node [pos=.25] {$\leq$}
            node [pos=.50] {$E$}
            node [pos=.75] {$\leq$}
        (D.south);
    \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

You can change the size of the arc by changing the angle given to the bend right option.

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.