TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a manual for a class, and I never liked add images as files in my tex, so I'm drawning the logo with this code:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\definecolor{xdxdff}{rgb}{0.5,0.5,1.}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\definecolor{cqcqcq}{rgb}{0.75,0.75,0.75}
\begin{tikzpicture}
\clip(-4.42,-1.90) rectangle (8.03,4.69);
\draw [color=red,fill=red,fill opacity=1.0] (-0.67,1.06) circle (2.41cm);
\draw [color=white,fill=white,fill opacity=1.0] (-0.66,1.71) circle (1.92cm);
\draw [shift={(-0.05,2.21)},color=red]  plot[domain=2.01:4.03,variable=\t]({1.*1.40*cos(\t r)+0.*1.40*sin(\t r)},{0.*1.40*cos(\t r)+1.*1.40*sin(\t r)});
\draw [shift={(-1.60,0.27)},color=red]  plot[domain=-0.48:0.92,variable=\t]({1.*1.08*cos(\t r)+0.*1.08*sin(\t r)},{0.*1.08*cos(\t r)+1.*1.08*sin(\t r)});
\draw [shift={(-1.26,1.06)},color=red]  plot[domain=-1.12:0.68,variable=\t]({1.*1.43*cos(\t r)+0.*1.43*sin(\t r)},{0.*1.43*cos(\t r)+1.*1.43*sin(\t r)});
\draw [shift={(0.42,3.0)},color=red] plot[domain=2.72:4.22,variable=\t]({1.*1.18*cos(\t r)+0.*1.18*sin(\t r)},{0.*1.18*cos(\t r)+1.*1.18*sin(\t r)});
\end{tikzpicture}
\end{document}

which gives me this image enter image description here

How can I color red the thing in middle?

share|improve this question
    
I'm trying with more coordinates, is there any simple way to get the coordinates? – Luis Felipe Jan 6 at 18:19
2  
Plotting seems an overkill: try with a couple of arc actions! – Bordaigorl Jan 6 at 18:20
    
I'm bad with 'arc' cause I can't find correct angles or this is something like trying until get it? – Luis Felipe Jan 6 at 18:21
    
I would draw the shape on paper and deconstruct it in few geometric shapes (e.g. four arcs here) and try to manually estimate the coordinates/angles (better if with values that make geometric sense). Another option is drawing the arcs with inkscape and then exporting to tikz. – Bordaigorl Jan 6 at 18:32
    
@Bordaigorl I've improved the question, thanks – Luis Felipe Jan 6 at 18:53
up vote 3 down vote accepted

I think the part in the middle is easier to draw using the curve to construction than .. controls ... At least, for me, though I have only recently started to have any clue about the latter so it might just be my lack of experience.

Anyway, this is very close although it is not an absolutely perfect match. (But the faint red line tracing the top of the circle is a viewer artefact, I think, and not an imperfection in construction. But the bit in the middle is not an entirely perfect match.)

\documentclass[tikz,border=5pt,multi]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
  \clip (-.67,1.06) circle (24.1mm);
  \path [fill=red, even odd rule] (-.67,1.06) coordinate (c1) circle (24.1mm) ++(.01,.65) coordinate (c2) circle (19.2mm);
  \draw [draw=red, fill=red] (c2) +(.05,-19.2mm) [out=25, in=-45] to (-.15,1.95) [out=150, in=-125] to ($(c1) + (.05,24.1mm)$) coordinate (a) [out=-155, in=90] to (-1.45,2.2) [out=-90, in=135] to ++(.51,-1.05) [out=-45, in=70] to cycle;
\end{tikzpicture}
\end{document}

thing

EDIT

Simply changing the sixth line as suggested in Luis Felipe's comment to

  \path [fill=red, even odd rule] (-.67,1.08) coordinate (c1) circle (24.1mm) ++(.01,.65) coordinate (c2) circle (19.2mm);

eliminates the faint trace of red line but at the cost of cutting off the tip of the inner part of the logo:

cut off tip

However, if we set the coordinate used for the inner part before making the adjustment, perhaps we can get the best of both worlds:

  \path [fill=red, even odd rule] (-.67,1.06) coordinate (c1) ++(0,0.02) circle (24.1mm) ++(.01,.65) coordinate (c2) circle (19.2mm);

best of both?

\documentclass[tikz,border=5pt,multi]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
  \clip (-.67,1.06) circle (24.1mm);
  % tweak based on Luis Felipe's comment: ref: http://tex.stackexchange.com/questions/286335/problem-giving-color-to-a-logo/286392?noredirect=1#comment692032_286392
  \path [fill=red, even odd rule] (-.67,1.06) coordinate (c1) ++(0,0.02) circle (24.1mm) ++(.01,.65) coordinate (c2) circle (19.2mm);
  \draw [draw=red, fill=red] (c2) +(.05,-19.2mm) [out=25, in=-45] to (-.15,1.95) [out=150, in=-125] to ($(c1) + (.05,24.1mm)$) coordinate (a) [out=-155, in=90] to (-1.45,2.2) [out=-90, in=135] to ++(.51,-1.05) [out=-45, in=70] to cycle;
\end{tikzpicture}
\end{document}
share|improve this answer
    
it is solved with \path [fill=red, even odd rule] (-.67,1.08) coordinate (c1) circle (24.1mm) ++(.01,.65) coordinate (c2) circle (19.2mm); in the sixth line – Luis Felipe Jan 7 at 1:12
    
I don't think that quite works but you're right that it eliminates the trace of red. Please see edit above for a further modification which avoids cutting off the tip of the inner part as well. – cfr Jan 7 at 1:55
    
you're right, now is better – Luis Felipe Jan 7 at 2:00

run with xelatex. The origin is the center of the big circle. \pscustom builds a closed path which can be filled.

\documentclass[pstricks]{standalone}
\usepackage{pstricks}
\begin{document}

\begin{pspicture}(-3,-3)(3,3)
\pscircle*[linecolor=red]{2.41}
\pscircle*[linecolor=white](0,0.65){1.92}
\pscustom[fillstyle=solid,fillcolor=red,linecolor=red]{%
  \psarc(0.65,1.15){1.4}{!2.01 RadtoDeg}{!4.0 RadtoDeg}
  \psarcn(-0.91,-0.79){1.08}{!0.93 RadtoDeg}{!-0.48 RadtoDeg}
  \psarc(-0.58,0){1.43}{!-1.12 RadtoDeg}{!0.68 RadtoDeg}
  \psarcn(1.1,1.94){1.18}{!4.2 RadtoDeg}{!2.72 RadtoDeg}
}
\end{pspicture}

\end{document}

enter image description here

If you want to use pdflatex:

\documentclass{book}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\begin{document}
[...] 

and run pdflatex --shell-escape file.tex

share|improve this answer
    
I need to run this in Latex because i'm going to use this image in the header of every page. Is possible run it in latex? – Luis Felipe Jan 6 at 19:40
    
What do you mean with latex? The old program latex or pdflatex? If you mean pdflatex then you can switch to xelatex and will have additionally the advantage of using OpenType or TrueType fonts. It is also possible to run pdflatex but then you have to load package auto-pst-pdf – Herbert Jan 6 at 19:43
    
I want to run it with pdflatex in a \documentstyle{book} document. What command must I add for doing it? because it works changing pdflatex for xelatex in compile options but I always work with pdflatex – Luis Felipe Jan 6 at 19:54
    
see my edited answer. You need only the optional argument --shell-escape when running with pdflatex. Which Editor are you using? – Herbert Jan 6 at 19:58
    
I'm using TexStudio as editor. what to do here? I need open the console for every compilation? – Luis Felipe Jan 6 at 20:00

Here is a simple solution. You may adjust the parameters (\anglei, \angleii, \angleiii, and \len) to change the flame.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[line width=0,draw=blue]
  \fill[red] (0,0) circle (2.41);
  \begin{scope}[overlay]
    \fill[white] (0,.65) circle (1.92);
  \end{scope}
  \def\anglei{-65}
  \def\angleii{45}
  \def\angleiii{160}
  \def\len{1.5}
  \fill[red]
  (0,.65) ++(0,-1.92)
  arc[start angle=\anglei,end angle=\angleii,radius=\len]
  arc[start angle=\angleii+180,end angle=\angleiii,radius=\len]
  %
  arc[start angle=\anglei+180,end angle=\angleii+180,radius=\len]
  arc[start angle=\angleii+360,end angle=\angleiii+180,radius=\len]
  ;
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
setting \len as 1.3 looks nice. Thanks – Luis Felipe Jan 7 at 2:06

Not quite right, but anyway...

\documentclass[tikz,border=5]{standalone}
\begin{document}
\tikz[line join=round]\filldraw [red] (0,0) 
  arc (270:180-30:cos 45 / cos 30) arc (180-45:360+45:1)
  arc (30:-90:cos 45 / cos 30) -- cycle
  .. controls ++(30:1) and ++(210:3/2) .. (0,1.5)
  .. controls ++(210:1) and ++(30:3/2) .. cycle;
\end{document}

enter image description here

share|improve this answer
    
the middle thing is too hard without a lot of points for control curve – Luis Felipe Jan 6 at 20:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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