2

How to draw this kind of complicated figure with LaTeX? Could I have sources? enter image description here

closed as unclear what you're asking by Martin Schröder, user13907, Werner, user31729, Jesse May 1 '15 at 16:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 14
    Yes, it is possible. – ChrisS May 1 '15 at 11:57
  • 6
    Ah, straightedge and compass stuff :) Generally, 'do it for me' questions aren't received well and are at the mercy of our procrastination team. This example, while it looks complicated, is just a simple extension of the TikZ tutorial available in its manual. You would do well to read it :) After that, if you still have questions, posting what you have and where you need to go will be much better received :) – Sean Allred May 1 '15 at 12:03
  • 8
    The site doesn't work by posting an image and asking for a solution, it works best if you show your code and then ask a specific tex question. Start with the tikz manual (texdoc tikz ) and a simpler diagram, such as a circle. If you get stuck, show the code and the error you get and ask a specific coding question, then build up to your final diagram. – David Carlisle May 1 '15 at 12:04
  • 1
    I think that @SeanAllred means the Euclid tutorial (p59). That will help you break the diagram down into simpler steps and show you how to achieve them. The first tutorial about Karl's diagram also seems relevant here. – cfr May 1 '15 at 12:27
  • The asymptote programming language is also very capable of drawing this sort of diagram. I personally prefer asymptote over tikz because its language is very similar to c++. See asymptote.sourceforge.net/gallery for example figures and code. – James May 1 '15 at 13:18
22

Here's the diagram. I haven't labeled points. I might get to that later. But otherwise all the difficult stuff has been done.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}

  \coordinate (Q) at (0,0);

  %% we start drawing from the inside and work our way out      
  %% There are two parameters to control                        
  %% the number of major arcs drawn                             
  %% the length of the initial segment                          
  %% from Q to A1 (which is the inner most point here)          
  \def\maxMajorArcCount{4}
  \def\initialLength{1in}
  \foreach \myn in {1,2,...,\maxMajorArcCount}
  {
    %% set lengths for each iternation            
    %% the use of `\xdef` is to help remember     
    %% the length of `\majorRadius` to draw the   
    %% final major arc.                           
    \pgfmathparse{\initialLength*sqrt(3)^(\myn-1)}
    \xdef\majorRadius{\pgfmathresult pt}%%
    \pgfmathparse{\majorRadius*sqrt(3)/3}
    \xdef\minorRadius{\pgfmathresult pt}%%

    \coordinate (A\myn) at (\majorRadius,0);

    %% fill the region with gray
    \ifnum\myn<\maxMajorArcCount\relax
      \draw[fill=gray,opacity=.60]
          (A\myn) arc (0:60:\majorRadius)
                  --  ++(0:\majorRadius);
    \fi

    %% draw the major Radius
    \draw (A\myn) arc (0:60:\majorRadius);

    %% draw the triangle and circumscribing circle.
    \ifnum\myn<\maxMajorArcCount\relax
      \draw (A\myn) -- ++ (60:\majorRadius)
                    -- ++ (180:\majorRadius)
                    -- cycle;
      \draw (A\myn) arc (-90:270:\minorRadius);
    \fi
  }

  %% draw outside angle
  \draw (Q) -- ++ (0:\majorRadius);
  \draw (Q) -- ++ (60:\majorRadius);

\end{tikzpicture}

\end{document}

enter image description here

  • 7
    Please stop feeding vampires. – Martin Schröder May 1 '15 at 16:05
  • 1
    @MartinSchröder Although the practice is ubiquitous, is it not? – cfr May 1 '15 at 22:35
  • 7
    @MartinSchröder I do not know whether the OP is in fact a vampire. But I do know that I have suffered no loss of blood and show no signs of bites. And, apparently, I am immune from vampirism because the light of the sun does not cause me any bodily harm. Nevertheless, I appreciate the concern for my own safety. – A.Ellett May 2 '15 at 15:11
13

And here's an effort from the campaign for more Metapost...

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
pair A[], B[], C[];
A0 = 200 right; 
for i=1 upto 4:
    B[i-1] = A[i-1] rotated 60;
    C[i]   = A[i-1] rotated 30;
    ypart B[i] = ypart C[i]; 
    B[i] = whatever[origin,B0];
endfor
draw origin -- A0 .. C1 .. B0 -- cycle;
for i=1 upto 3: 
  fill A[i]--C[i]--B[i]..C[i+1]..cycle withcolor .8[blue,white];
  draw A[i]--C[i]--B[i]..C[i+1]..cycle;
endfor
for i=1 upto 3: 
  draw A[i]--B[i];
  draw A[i]..B[i]..C[i]..cycle;
endfor 
label.bot(btex $A$ etex, A0);
label.bot(btex $A_1$ etex, A1);
label.bot(btex $A_2$ etex, A2);
label.lft(btex $B$ etex, B0);
label.lft(btex $B_1$ etex, B1);
label.lft(btex $B_2$ etex, B2);
label.rt(btex $C_1$ etex, C1);
label.rt(btex $C_2$ etex, C2);
label.llft(btex $O$ etex, origin);
label(btex $\ldots$ etex rotated 30, 12 right rotated 30);
endfig;
end

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