1

I'm attempting to draw the following diagram in LaTeX, using Tikz: enter image description here How could I go about achieving an image like this?

I'm puzzled to deal with the artificial "√"(tick) and "×"(cross).

By the way ,Which PDF introducing \foreach do you recommend?

Thanks for your help!

New addition:

Thanks for all of you!

Now,I'm capable of drawing the following figure.(But how to deal with the position of checkmark and other figures?) enter image description here

As far as I am known, we should use foreach to draw other figures.

Code:

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds,shadows,fit,positioning}
\usetikzlibrary{calc}
\newcommand{\C}{\ding{51}}
\newcommand{\X}{\ding{55}}
\begin{document}
\begin{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[decoration={
    markings,
    mark=between positions 0.43 and 1 step 3.14cm with {\arrow{stealth};}}
]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\node at (1.5,1.5) {(\textcolor{red}{\C})}; % for checkmark
\node at (1.5,1.5) {(\textcolor{red}{\X})}; % for crossmark
\pgfmathcos{15}
\xdef\mya{\pgfmathresult}
\pgfmathsin{15}
\xdef\myb{\pgfmathresult}
\pgfmathcos{-75}
\xdef\myc{\pgfmathresult}
\pgfmathsin{-75}
\xdef\myd{\pgfmathresult}
\pgfmathadd{cos{15}}{cos{-75}}
\xdef\mye{\pgfmathresult}
\pgfmathadd{sin{15}}{sin{-75}}
\xdef\myf{\pgfmathresult}
\draw[blue,thick,postaction={decorate}] (0,0) circle (1cm);
\draw[orange,thick,postaction={decorate}] (\mye,\myf) circle (1cm);
\draw[fill] (\mya,\myb) circle (.05cm);
\draw[fill=white,draw=black] (\myc,\myd) circle (.05cm);
  \begin{pgfonlayer}{background}
    \node(cadre)[drop shadow,fit=(current bounding box),rounded corners,
    line width=1pt,fill=white,inner sep=2mm]{};
    \node[below=3mm of cadre,font=\itshape\footnotesize]
    {Subtractive color};
  \end{pgfonlayer}
\end{tikzpicture}
\end{document}
  • 4
    Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE). This isn't a "Please do my work for me" site! What do you have so far? Try to create first one single figure. – Bobyandbob Aug 2 '17 at 14:52
  • 1
    For the tick and cross you can for example have a look in the comprehensive symbol list and find appropriate characters. As for \foreach, that is defined by TikZ, so look at TikZ' manual. – Torbjørn T. Aug 2 '17 at 16:52
1

I'm not entirely sure if this is the correct output, so please have a close look. There are some comments in the code, ask if anything is unclear.

enter image description here

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{
  decorations.markings,
  backgrounds,
  shadows,
  fit,
  positioning,
}
\newcommand{\Checkmark}{\ding{51}}
\newcommand{\Cross}{\ding{55}}
\begin{document}
\begin{tikzpicture}
[
cwa/.style={ %clockwisearrows
    decoration={
       markings,
       mark=at position 0.43 with {\arrow{stealth}},
       mark=at position 0.93 with {\arrow{stealth}}
    },
    postaction=decorate},
ccwa/.style={ %counterclockwisearrows
    decoration={
       markings,
       mark=at position 0.4 with {\arrowreversed{stealth}},
       mark=at position 0.9 with {\arrowreversed{stealth}}
    },
    postaction=decorate},
bluecirc/.style={blue,thick},
orangecirc/.style={orange,thick},
declare function={ 
   Radius=0.5cm; % radius of circles
}
]

% set up some counter that is used to make the A,B,C,... labels
\newcounter{leftcnt}
\newcounter{rightcnt}

% the count is 1,2,3,....
% the loop variables \ba and \oa (blue arrows, orange arrows)
% refer to the styles for (counter)-clockwise arrow tip markings defined above
\foreach [count=\i] \ba/\oa in {ccwa/cwa,ccwa/ccwa,cwa/ccwa,cwa/ccwa}
{
  % draw the panels on the left side
  \begin{scope}[
      % shift panels down
      % if you change the Radius, you need to change this as well
      yshift=-\i*2.5cm, 
      % give name to the bounding box of the stuff inside this scope
      local bounding box=left\i 
     ]
    \coordinate (c1) at (0,0);
    % Define center of the orange circle. "Radius" is defined above with declare function.
    % We can do calculations directly in the coordinate, but need {} when the expr contains commas or parenthesis, i.e.
    % ({ <x-expression> }, { <y-expression> })
    \coordinate (c2) at ({Radius*(cos(15)+cos(-75))},{Radius*(sin(15)+sin(-75))});
    % draw circles, with arrow styles as defined by the loop variables
    \draw[bluecirc,\ba] (c1) circle[radius=Radius];
    \draw[orangecirc,\oa] (c2) circle[radius=Radius];

    \draw[fill] ({Radius*cos(15)},{Radius*sin(15)}) circle[radius=0.05cm];
    \draw[fill=white,draw=black] ({Radius*cos(-75)},{Radius*sin(-75)}) circle[radius=0.05cm];
  \end{scope}

  % draw the panels on the right side
  % as above, but with an xshift added to move them to the right
  \begin{scope}[xshift=3cm,yshift=-\i*2.5cm,local bounding box=right\i]
    % the first part is the same as for the left panels
    \coordinate (c1) at (0,0);
    \coordinate (c2) at ({Radius*(cos(15)+cos(-75))},{Radius*(sin(15)+sin(-75))});
    \draw[bluecirc,\ba] (c1) circle[radius=Radius];
    \draw[orangecirc,\oa] (c2) circle[radius=Radius];

    \begin{scope}
      % we need a scope to limit the effect of the clipping
      \clip (c1) circle[radius=Radius];
      % draw a blue circle on on top of the orange one,
      % but because of the clipping, only the part inside the original blue circle
      % is visible
      \draw [bluecirc,\oa] (c2) circle[radius=Radius];
    \end{scope}
    \begin{scope}
      % as previous scope, but for the orange circle
      \clip (c2) circle[radius=Radius];
      \draw [orangecirc,\ba] (c1) circle[radius=Radius];
    \end{scope}

    % draw the black/white dots on top of the circle segments
    \draw[fill] ({Radius*cos(15)},{Radius*sin(15)}) circle[radius=0.05cm];
    \draw[fill=white,draw=black] ({Radius*cos(-75)},{Radius*sin(-75)}) circle[radius=0.05cm];
  \end{scope}

  % add checkmarks and cross
  \node [right=2mm,yshift=-5pt] at (left\i.north east) {(\textcolor{red}{\Checkmark})}; 
  \node [right=2mm,yshift=-5pt] at (right\i.north east) {(\textcolor{red}{\Cross})}; 
  % drop shadow and label
  \begin{scope}[on background layer]
      % set the counters appropriately, so that the first row has 1 and 2,
      % second row has 3 and 4, etc.
      \pgfmathsetcounter{leftcnt}{2*\i-1}
      \pgfmathsetcounter{rightcnt}{2*\i}

      \node(cadre\i)[drop shadow,fit=(left\i),rounded corners,
      line width=1pt,fill=white,inner sep=2mm]{};
      \node(cadreB\i)[drop shadow,fit=(right\i),rounded corners,
      line width=1pt,fill=white,inner sep=2mm]{};

      % \Alph prints the value of a counter as a capital letter,
      % i.e. 1 is A, 2 is B, etc.
      \node[below=1mm of cadre\i,font=\itshape\footnotesize]
      {fig. \Alph{leftcnt}};
      \node[below=1mm of cadreB\i,font=\itshape\footnotesize]
      {fig. \Alph{rightcnt}};
  \end{scope}
} % end of loop

\end{tikzpicture}
\end{document}
  • Thanks for you reply!Actually,I would prefer every checkmark and bracket to be right of the every figure like the first picture. – D.Matthew Aug 3 '17 at 13:21
  • @D.Matthew Right, missed that. Just move them to outside the scopes, and position them relative to the left\i/\right\i nodes (which are defined by the local bounding box). See updated code. – Torbjørn T. Aug 3 '17 at 13:33
5

A suggested solution is via Tikz.

enter image description here

enter image description here

The code is

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{decorations.markings}
\newcommand{\C}{\ding{51}}
\newcommand{\X}{\ding{55}}

\begin{document}
\begin{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[decoration={
    markings,
    mark=between positions .4 and 1.0 step 3cm with {\arrow{stealth};}}
]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\node at (1.5,1.5) {(\textcolor{red}{\C})}; % for checkmark
\node at (1.5,1.5) {(\textcolor{red}{\X})}; % for crossmark
\draw[blue,thick,postaction={decorate}] (-.5, .5) circle (1cm);
\draw[orange,thick,postaction={decorate}] ( .5,-.5) circle (1cm);
\draw[fill] (.5,.5) circle (.05cm);
\draw[fill=white,draw=black] (-.5,-.5) circle (.05cm);
\end{tikzpicture}
\end{document}
3

Slightly unnecessary TikZ tick and cross:

\documentclass[border=5]{standalone}
\usepackage{tikz}
\tikzset{%
    tick/.pic={
        \draw [x=1ex, y=1ex, line width=0.25ex,
               red, line cap=round, line join=round, looseness=0.444]
          (3/2,3) to [bend right]  (0,0) to [bend right] (-1,1);
    },
    cross/.pic={
        \draw [x=1ex, y=1ex, line width=0.25ex,
               red, line cap=round, line join=round, looseness=0.444]
          (1,2) to [bend right]  (-1,0) (1, 0)  to [bend right] (-1,2);
    }
}
\def\tikztick{\tikz[baseline=0.75ex]\pic{tick};}
\def\tikzcross{\tikz[baseline=0.5ex]\pic{cross};}

\begin{document}
(\tikzcross) (\tikztick)
\end{document}

enter image description here

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.