4

tikz community,

after hours of seeking a solution to draw the zodiac sign leo I realize that I cannot deal with finding control points to get a wished curve. I tried bend-to and others, no result. I have fixed approx coordinates to show the idea of the wished line. Can anyone help? I do not add a photo because of copyrights, but I think there is no difficulty to get an image of this sign beyond artistic freedom. If possible I want to do it in tikz.

The mwe ist somewhat rediculous. As I have said, I cannot realize it.

    \documentclass[]{article}
    \usepackage{tikz}
    \usetikzlibrary{
                   }
    \usepackage[paperheight=160mm,paperwidth=180mm,top=5mm,bottom=5mm,left=5mm,right=5mm,showframe]{geometry}
    \tikzset{%
      >=latex, % option for nice arrows
      inner sep=0pt,%
      outer sep=2pt,%
      mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=2pt,fill=black,circle}%
    }
    \begin{document}
    % leo
    \begin{tikzpicture}
    \draw[step=0.5cm,help lines] (-2,-2) grid (3,4);
    \foreach \x in {-2,-1.5,...,3}
    \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\x$};
    \foreach \y in {-2,-1.5,...,4}
    \draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\y$};
    %
    \draw[line width=4mm, line cap=round] (0,0) arc [start angle=0, end angle=360, radius=6mm];
    %
    \filldraw [gray] (0,0) circle [radius=2pt]; %
    \filldraw          [red]       (1,0) circle [radius=2pt];
    \filldraw          [blue]       (2,1) circle [radius=2pt];
    \filldraw          [green]       (2,0) circle [radius=2pt];
    %
\draw[line width=4mm, line cap=round] (0,0.5) 
                                      to[bend left=100] (0,3)
                                      to[bend left=100] (1,0);
\end{tikzpicture}
%
\begin{tikzpicture}
     \coordinate [mark coordinate] (l1) at (0.5,0);
     \coordinate [mark coordinate] (l2) at (1.0,0.5);
     \coordinate [mark coordinate] (l3) at (0.5,1);
     \coordinate [mark coordinate] (l4) at (0.0,0.5);
     \draw (l1) -- (l2) -- (l3) -- (l4)  --(l1);
     % line leaves the "circle" between l2 and l3
     \coordinate [mark coordinate] (gb0) at (0.75,0.75);
     % building a great bow. no circle
     \coordinate [mark coordinate] (gb1) at (0.5,2.0);
     \draw (gb0) -- (gb1);
     \coordinate [mark coordinate] (gb2) at (1.5,2.5);
     \coordinate [mark coordinate] (gb3) at (2.0,2.0);
     \coordinate [mark coordinate] (gb4) at (1.55,-0.25);
     \draw (gb1) -- (gb2) -- (gb3) -- (gb4);
     % last bow to the right
     \coordinate [mark coordinate] (lb1) at (1.75,-0.45);
     \coordinate [mark coordinate] (lb2) at (2.0,-0.25);
     \draw (gb4) -- (lb1) -- (lb2);
\end{tikzpicture}
\end{document}

gizeh
  • 491

4 Answers4

6

Several fonts have astronomical symbols. In general you can consult the Comprehensive LaTeX Symbol List, which, even though it is quite long, is easily searchable. You'll find the characters of interest in Tables 325–331.

With \usepackage{starfont} the command \Leo produces:

enter image description here

With wasysym the command is \leo:

enter image description here

marvosym has \Leo:

enter image description here

The package utfsym has \usym{264C}:

enter image description here

Sandy G
  • 42,558
  • Thank you for your hints, good source, but I need a self-made one or a way to manipulate the symbols. – gizeh Sep 12 '21 at 17:06
4

A quick start point could be:

\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[line width=2mm]
  \draw (0,0) circle (1);
  \draw (30:1) to[out=120,in=270] (0.5,2) to[out=90,in=180] (1.5,3) to[out=0,in=90] (2.5,2) to [out=270,in=180] (2.5,-2) arc (270:315:1);
\end{tikzpicture}
\end{document}

enter image description here

Juan Castaño
  • 28,426
  • Many, many variables. Changing one all is disturbed. I hope a more handy solution would be better. But nevertheless thank you. – gizeh Sep 11 '21 at 15:48
  • 1
    This could be done as a pic, and then no more problem when you try and change placement and/or size. – SebGlav Sep 11 '21 at 16:45
4

The finished.

Example 4: From http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

in Table 330, the statement All utfsym symbols are implemented with TikZ graphics, not with a font, so, if your symbol is not a font, then of course texpath will not be able to describe it. It means that texpath does not work for the utfsym package or similar packages!

From CarLaTeX's comment.

If you know Asymptote, you will find that it has several amazing commands!

The command is path[] texpath(Label L) (the path array that TEX would fill to draw the Label L.). You can test many other LaTeX symbols.

usepackage("wasysym");
size(350,0);

path[] g=texpath("\leo"); write(g.length); // Outputs: 2

filldraw(g[0],cyan+green,red+dashed+.8bp); filldraw(g[1],gray,blue+1.5bp);

write(cyclic(g[0])); // Outputs: true write(cyclic(g[1])); // Outputs: true

arrow("the red and dashed path ",relpoint(g[0],0.78),dir(90)); arrow("the blue path which has the linewidth is 1.5bp",relpoint(g[1],0),dir(-90));

enter image description here

or with \cancer

usepackage("wasysym");
size(350,0);

path[] g=texpath("\cancer"); write(g.length); // Outputs: 4

filldraw(g[1],gray,blue+1.5bp); filldraw(g[0],cyan+green,red+dashed+.8bp); filldraw(g[3],gray,blue+1.5bp); filldraw(g[2],cyan+green,red+dashed+.8bp);

write(cyclic(g[0])); // Outputs: true write(cyclic(g[1])); // Outputs: true write(cyclic(g[2])); // Outputs: true write(cyclic(g[3])); // Outputs: true

enter image description here

You can handle the curves manually!

RUN Asymptote codes in Notepad++ on MSWindows system.

Step 1: Install Notepad++.

Step 2: Install TeXLive (recommended by Asymptote's authors), Adobe Acrobat Reader DC, Asymptote (latest version), Ghostscript (stable version), ImageMagick (stable version).

Step 3: Add two following files:

asy.xml is belong to ..\Notepad++\autoCompletion

userDefineLang.xml is belong to ..\PC\AppData\Roaming\Notepad++

To update new commands, see following links:

https://code.google.com/archive/p/asy4cn/downloads (in Chinese) https://asy.marris.fr/forum/viewtopic.php?t=148 (in French)

Sorry, my native language is Vietnamese, I also know a little English.

These are my several pictures after installing successfully.

enter image description here enter image description here enter image description here

Run latexusage.tex in TeXstudio:

Like this, the file name is document.tex enter image description here

You run step by step as follows:

  1. Tools --> Commands --> PDFLaTeX, the output like this enter image description here
  2. Tools --> Commands --> Asymptote, the output like this enter image description here
  3. Tools --> Commands --> PDFLaTeX, done.

The completed file lies in C:\Users\PC\Downloads as in attached images. enter image description here

You can also choose http://asymptote.ualberta.ca/ to compile Asymptote code online.

You must compile any Asymptote codes successfully, then you can start with Asymptote.

You can try to install Notepad++ on Linux! If done, feel free to update this answer.

To make clear my opinion You can handle the curves manually!:

Example 1: Can I visualize the Bezier control points of a letter ... in TeX?

Example 2: Animated filling of a font character

Example 3:

// settings.render=8;
unitsize(1cm);

import texcolors; // for pens like CornflowerBlue, Goldenrod,Bittersweet, Melon

texpreamble("\usepackage{starfont}"); path[] h=texpath("\Leo");

// To know the number of paths of Label L in texpath write(h.length); // Outputs: 2

fill(h[1],pink+opacity(.5)); filldraw(h[0],CornflowerBlue,red+1.5bp); pair[] P;
for(int j=0;j<size(h[0]);++j){ P.push(point(h[0],j)); } pair interpoint=extension(P[0],P[2],P[1],P[3]); for (int j=0; j<P.length; ++j){ dot("$P["+(string) j+"]$",P[j],dir(j90)); }
filldraw(shift(interpoint)
scale(0.75)shift(-interpoint)h[0],CornflowerBlue+yellow,red+1.5bp);

real[] c=uniform(0,length(h[1]),5); write(c); // Outputs: {0,4,8,12,16,20} c.cyclic=true;

pen[] pp={YellowGreen+dashdotted+1bp,blue+dashed+1bp,dotted+1.5bp,Goldenrod+0.6bp,Bittersweet+0.7bp,Melon+0.8bp};

for (int i=0; i<c.length-1; ++i) draw(subpath(h[1],c[i],c[i+1]),pp[i],Arrow(size=10));

draw((0,0)--(5,0),Arrow); draw((5,0)--(-5,4),Arrow); dot("$(0,0)$",(0,0),dir(90)); dot("$(5,0)$",(5,0),dir(0)); dot("$(-5,4)$",(-5,4),dir(90));

pair[] interpoints=intersectionpoints(h[1],(0,0)--(5,0)--(-5,4),sqrtEpsilon); write(interpoints.length); // Outputs: 6

dot("$A$",interpoints[0]); dot("$B$",interpoints[1]); dot("$C$",interpoints[2]); dot("$D$",interpoints[3]); dot("$E$",interpoints[4]); dot("$F$",interpoints[5]);

enter image description here

  • Looks very great. Pkg Asymptote was found by latexpdf, but to use the code special handling is necessary, so a call to "asy" I have found in texdoc Asymptote. So I have to implement it all. Than a call syntax is necessary too... So I cannot use it. Perhaps later, later. – gizeh Sep 11 '21 at 16:40
  • +1 Very good. Bọn cơ hội? – Display Name Sep 11 '21 at 19:56
  • It would be great if you can give a mwe. In best case with the necessary commandlines and showing a case where and how you manipulate the curves manually. – gizeh Sep 12 '21 at 10:14
  • @gizeh Can you tell more details about what showing a case where and how you manipulate the curves manually is? – Nguyen Van Chi Sep 12 '21 at 10:23
  • @NguyenVanChi The Leo symbol as you drew it above is too symmetrical about the Y-axis. Because of this it may be confused with the North-Node symbol. – Trunk Sep 12 '21 at 11:42
  • @Trunk You should have a look the second symbol in Sandy G's answer above. – Nguyen Van Chi Sep 12 '21 at 11:49
  • @NguyenVanChi The command "path[] texpath(Label L)" seems to deliver many variables to use. A mwe that shows access to the available vars would be nice. In short: Only a copy-paste mwe, which is executable makes sense for me. You have mentioned yourself "You can handle the curves manually!". Show that would be nice. – gizeh Sep 12 '21 at 11:53
  • @NguyenVanChi At last, if necessary, and I think it is, some commandline instructions are necessary to run pdflatex with asymptote. The doc of asymptote is not very clear imho. So an executable mwe with the needed cmd lines would be best. – gizeh Sep 12 '21 at 11:58
  • @NguyenVanChi1998 I have and I don't think that that it a good (i.e. unambiguous) selection either - although the other symbols (#1, #3 and #4) in Sandy G's answer are okay. – Trunk Sep 12 '21 at 13:22
  • @gizeh See my updated answer. After you compiling Asymptote codes successfully, I will continue update a new example to make clear my opinion "You can handle the curves manually!". – Nguyen Van Chi Sep 12 '21 at 13:27
  • @NguyenVanChi1998 I'm running primarily on Linux. So I need the input for CLI as mentioned in "texdoc asymptote". Because there are unclarities imho. And, as usual here, a mwe. Sorry and thank you for your effort. – gizeh Sep 12 '21 at 16:57
  • 1
    @gizeh See my updated answer. – Nguyen Van Chi Sep 12 '21 at 23:15
  • @NguyenVanChi1998 Nice job. Maybe a smaller blue circle. – Trunk Sep 13 '21 at 09:39
  • 1
    @Trunk See my updated answer. – Nguyen Van Chi Sep 13 '21 at 11:03
  • @NguyenVanChi1998 Việt Nam muôn năm! – Trunk Sep 13 '21 at 11:13
  • @NguyenVanChi1998 What is needed is a tikz-example which visualizes the bezier points with coordinates. To get the glyphs is another problem. Thank you for the links (bezier curves). – gizeh Sep 13 '21 at 16:54
  • @gizeh Sorry, I am not an expert about TikZ. All my examples are in Asymptote. If TikZ can !? do this, I think you will get an answer from anyone, otherwise you will get nothing. – Nguyen Van Chi Sep 14 '21 at 01:02
1

Inspired from Asymptote's service representing a glyph's bezier control points(BCP) I was able to reproduce curves with approximately correct BCPs. Mathematically unfamiliar it was a great help to see Asymptote's delivery of BCPs. So a good answer seems to be: "Take a book of mathematics or train your use of control points.".

Unsolved is the point 25 at (0,0) of a foreach loop and the unability to fill the drawn area. Should I ask a new question?

mwe

    \documentclass[]{article}
    \usepackage{tikz}
    \usetikzlibrary{
                   }
    \usepackage{wasysym} % three pkgs with Leo signs
    \usepackage{marvosym}
    \usepackage{utfsym}
    \usepackage[paperheight=160mm,
                paperwidth=180mm,
                top=5mm,
                bottom=5mm,
                left=5mm,
                right=5mm,
                %showframe
               ]{geometry}
    \tikzset{%s
      inner sep=0pt,%
      outer sep=2pt,%
      mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=00pt,}%mark=x}%
    }
    \begin{document}
    wasysym \leo and marvosym \Leo and usym \usym{264C}
\begin{tikzpicture}[scale=1.0]
% a grid
\draw[step=.1cm,gray!50!white,very thin] (0,0) grid (8,10);
\draw[step=1cm,black!40!red, very thin,opacity=0.4] (0,0) grid (8,10);
\foreach \x/\xtext in {0,4,8}
   \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {\tiny$\xtext$};
\foreach \y/\ytext in {1,5,10}
   \draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {\tiny$\ytext$};
% end grid
% The sign maximized
\node[outer sep=0,
      anchor=south west,
      opacity=0.5
     ] at (0,0) {\Huge\color{red!50!white}\usymH{264C}{10cm}};
% All Points
\foreach \px/\py [count=\c] in {%
   0.000 /4.000,
   1.900 /5.920,     
   1.900 /5.363,
   0.560 /4.000,
   1.950 /2.627,  % p5
   3.230 /4.000,  % p6
   2.800 /5.350,  % p7
   1.956 /7.600,  % p8
   4.550 /10.00,  % p9         
   7.255 /7.500,  % p10
   6.125 /4.000,  % p11
   5.700 /0.825,  % p12
   7.380 /1.260,  % p13
   7.822 /0.792,  % p14
   6.200 /0.000,  % p15
   4.580 /1.350,  % p16
   5.770 /5.000,  % p17
   6.521 /7.500,  % p18
   4.550 /9.380,  % p19
   2.685 /7.600,  % p20
   3.550 /5.000,  % p21
   3.845 /4.000,  % p22
   1.950 /2.070,  % p23
   0.000 /4,000   % p24
  }{%
   \coordinate[mark coordinate,] (p\c) at (\px,\py);
   \node[label={[left]{\tiny \c}}] 
        at (p\c) {\tiny$\times$};% {};% 
}
% All Controlpoints 2 at a time
\foreach \cpx/\cpy/\cppx/\cppy [count=\c] in {%
   0     /5.15    /0.93 /5.925,   % cp1   cpp1
   2.15  /5.80    /2.15 /5.50,    % cp2   cpp2
   1.145 /5.363   /0.56 /4.80,    % cp3   cpp3
   0.51  /3.28    /1.17 /2.58,    % cp4   cpp4
   2.725 /2.625   /3.25 /3.35,    % cp5   cpp5
   3.175 /4.855   /2.82 /5.275,   % cp6   cpp6
   2.480 /5.800   /2.00 /6.550,   % cp7   cpp7
   1.956 /8.890   /2.92 /10.00,   % cp8   cpp8
   6.18  /10.0    /7.25 /8.890,   % cp9   cpp9
   7.25  /6.15    /6.78 /5.40,    % cp10  cpp10
   5.125 /1.80    /5.125/1.30,    % cp11  cpp11
   6.25  /0.48    /6.800/0.75,    % cp12  cpp12
   7.75  /1.45    /8.025/1.130,   % cp13  cpp13
   6.99  /0.030   /6.490/0.030,   % cp14  cpp14
   5.42  /0.000   /4.717/0.485,   % cp15  cpp15
   4.55  /2.290   /4.825/3.000,   % cp16  cpp16
   6.520 /6.500   /6.525/7.050,   % cp17  cpp17
   6.508 /8.600   /5.680/9.379,   % cp18  cpp18
   3.420 /9.379   /2.690/8.660,   % cp19  cpp19
   2.688 /7.000   /2.770/6.620,   % cp20  cpp20
   3.820 /4.350   /3.838/4.167,   % cp21  cpp21
   3.845 /2.840   /2.925/2.070,   % cp22  cpp22
   0.950 /2.070   /0.000/2.799    % cp23  cpp23
  }{% 
    \coordinate[mark coordinate,] (cp\c) at (\cpx,\cpy);
    \node[red,
          %label={[left]{\tiny cp\c}}
         ] at (cp\c) {\tiny{$\times$}};
    % CONTROLPOINT 2
    \coordinate[mark coordinate,] (cpp\c) at (\cppx,\cppy);
    \node[blue%
          %label={[left]{\tiny cpp\c}}
         ] at (cpp\c) {\tiny{$\times$}};
}
% All Beziercurves and helplines
\foreach \x [evaluate=\x as \xplus using \x+1] in {1,...,23}
   {
    \draw[blue!50!black,line width=0.05mm] (p\x) .. controls (cp\x) and (cpp\x) .. (p\xplus);
    \draw[blue!100!black,line width=0.015mm] (p\x)--(cp\x)--(cpp\x)--(p\xplus);
   }
\end{tikzpicture}
\end{document}

Visually set BCPs

gizeh
  • 491