Tengo una pregunta sobre cómo acceder al valor matemático de count en \foreach
, usaré ese valor para hacer algunos cálculos en el siguiente código. Pero no funcionó.
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-2.5,-3) rectangle (2.5,2.5);
% defining coordinates
\coordinate (origin) at (0,0);
\coordinate (1) at (0,2);
\coordinate (2) at ($(origin)!1!120:(1)$);
\coordinate (3) at ($(origin)!1!120:(2)$);
\coordinate (1_) at ($(origin)!0.8!-5:(1)$);
\coordinate (2_) at ($(origin)!0.8!-5:(2)$);
\coordinate (3_) at ($(origin)!0.8!-5:(3)$);
\coordinate (_1) at ($(origin)!0.8!5:(1)$);
\coordinate (_2) at ($(origin)!0.8!5:(2)$);
\coordinate (_3) at ($(origin)!0.8!5:(3)$);
% draw the circle
\draw [color=black, line width=0.5pt](origin) circle (2 cm);
%draw symmetry elements
\foreach \coordname in {1,2,3}
\draw [line width=0.5pt, color=black] (\coordname)-- ($(origin)!1!180:(\coordname)$);
\foreach \coordname [count=\i] in {1,2,3}{
\draw[color=black,font=\large] (\coordname) node {\rotatebox{120}{rota}};}
\draw[color=black,font=\large] (origin) node {rota};
% draw plane group notaton
\draw[color=black] (0,-2.5) node {$222$};
\end{tikzpicture}
\end{document}
Necesito que el texto rota
siga la dirección de la curva del círculo dependiendo de la posición del texto.
Luego agrego algo de código:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-2.5,-3) rectangle (2.5,2.5);
% defining coordinates
\coordinate (origin) at (0,0);
\coordinate (1) at (0,2);
\coordinate (2) at ($(origin)!1!120:(1)$);
\coordinate (3) at ($(origin)!1!120:(2)$);
\coordinate (1_) at ($(origin)!0.8!-5:(1)$);
\coordinate (2_) at ($(origin)!0.8!-5:(2)$);
\coordinate (3_) at ($(origin)!0.8!-5:(3)$);
\coordinate (_1) at ($(origin)!0.8!5:(1)$);
\coordinate (_2) at ($(origin)!0.8!5:(2)$);
\coordinate (_3) at ($(origin)!0.8!5:(3)$);
% draw the circle
\draw [color=black, line width=0.5pt](origin) circle (2 cm);
%draw symmetry elements
\foreach \coordname in {1,2,3}
\draw [line width=0.5pt, color=black] (\coordname)-- ($(origin)!1!180:(\coordname)$);
\foreach \coordname [count=\i] in {1,2,3}{
\pgfmathsetmacro{\n}{\numbers[\i]}; % add
\draw[color=black,font=\large] (\coordname) node {\rotatebox{-120+30*\n}{rota}};} %some modification
\draw[color=black,font=\large] (origin) node {rota};
% draw plane group notaton
\draw[color=black] (0,-2.5) node {$222$};
\end{tikzpicture}
\end{document}
No funcionó. ¿Alguien tiene alguna idea sobre lo que está mal aquí? Gracias
Respuesta1
Entonces, en su ejemplo, tiene \numbers[\i]
y no estoy del todo seguro a qué se refiere. Eliminé partes del código que no funcionaban e intenté ver lo que estabas buscando y esto es lo que se me ocurrió:
\documentclass[tikz,convert]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\coordinate (origin) at (0,0);
% draw the circle
\draw [color=black, line width=0.5pt] (origin) circle (2 cm);
% draw symmetry elements
\foreach \coordname [count=\i] in {1,2,...,6} {
\draw [rotate around={60*\i:(origin)}]
(origin) -- +(2, 0)
node [rotate=60*\i, pos=1, right] {rota};
\coordinate (c\coordname) at ($(origin) + (60*\i:2)$);
}
\draw (c1) -- (c2) -- (c3) -- (c4) -- (c5) -- (c6) -- cycle;
\end{tikzpicture}
\end{document}
y la salida:
Espero que sea un punto de partida útil para usted. No dude en comentar si tiene alguna pregunta sobre cómo funcionan algunas partes de esto.
Respuesta2
Subo mi solución a esta pregunta.
\documentclass[margin=10pt]{standalone}
\DeclareFontFamily{U}{cry}{\hyphenchar\font=-1}
\DeclareFontShape{U}{cry}{m}{n}{ <-> cryst}{}
\newcommand{\cry}[1]{{\usefont{U}{cry}{m}{n} \symbol{#1}}}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-2.5,-3) rectangle (2.5,2.5);
% defining coordinates
\coordinate (origin) at (0,0);
\coordinate (1) at (0,2);
\coordinate (2) at ($(origin)!1!120:(1)$);
\coordinate (3) at ($(origin)!1!120:(2)$);
% draw the circle
\draw [color=black, line width=0.5pt](origin) circle (2 cm);
%draw symmetry elements
\foreach \coordname in {1,2,3}
\draw [line width=0.5pt, color=black] (\coordname)-- ($(origin)!1!180:(\coordname)$);
\foreach \coordname [count=\i] in {1,2,3}{
\draw[color=black,font=\large] (\coordname) node [rotate=-210+120*\i] {\cry{2}};
\draw[color=black,font=\large] ($(origin)!-1!(\coordname)$) node [rotate=-210+120*\i] {\cry{2}};
}
\draw[color=black,font=\large] (origin) node {\cry{3}};
% draw plane group notaton
\draw[color=black] (0,-2.5) node {$32$};
\end{tikzpicture}
\end{document}