Like this?
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\def\angf{40} %First angle
\def\angs{125} %Second angle
\def\hypo{15} %Hypotenus
\coordinate (O) at (0,0);
\draw[name path=line 1] (O) --++ (\angf:\hypo) coordinate (A);
\path[name path=line 2] (O) --++ (0:2\hypo);
\path[name path=line 3] (A) --++ (-\angs:2\hypo);
\path [name intersections={of=line 2 and line 3,by=E}];
\pgfresetboundingbox
\draw (O)--(E)--(A);
\end{tikzpicture}
\end{document}
There is an issue with using the nested=true
key on the blochsphere
environment. In a normal blochsphere environment, the initialisation is done before the tikzpicture is started. With a nested one, the initialisation is done after the tikzpicture is started. For most of the relevant code, that doesn't matter. However, one part does need to be in place before the tikzpicture is started and that is the layers. So you need to have the following lines in your preamble:
\pgfdeclarelayer{back}%
\pgfdeclarelayer{front}%
\pgfsetlayers{back,main,front}%
Once this is in place, a blochsphere environment can be used directly inside a tikzpicture environment. It does not need to be inside a node (and, indeed, should not be used inside a node). But it can be included inside a scope, and that scope can be repositioned to change the location of the blochsphere. It may be that simple translations are sufficient, as in the following code, but if you want a more sophisticated positioning syntax then consider the development version of the tikzmark
which allows you to define "anchors" on a scope in a similar fashion to nodes.
Full code follows. There were a few other minor issues which I've fixed in the code.
\documentclass{article}
%\url{https://tex.stackexchange.com/q/653567/86}
\usepackage{tikz}
\usepackage{blochsphere}
% These lines are needed when using the `nested=true` option
\pgfdeclarelayer{back}%
\pgfdeclarelayer{front}%
\pgfsetlayers{back,main,front}%
\begin{document}
\begin{tikzpicture}
\begin{scope}
\begin{blochsphere}[radius=1.5 cm,tilt=15,rotation=-20,nested=true]
% The next line is automatically included when not nesting
% but needs to be here when nesting
\drawBall
\drawBallGrid[style={draw,opacity=0.3}]{30}{30}
% These two commands only take 3 arguments (including the optional style)
\drawGreatCircle[style={dashed}]{-60}{0}%{0}
\drawGreatCircle[style={dashed}]{60}{0}%{0}
\drawRotationLeft[scale=1.3,style={red}]{-60}{0}{0}{15}
\drawRotationRight[scale=1.3,style={red}]{60}{0}{0}{15}
\node at (-0.8,1.9) {\textcolor{red}{\tiny $J_{12}(t)$}};
\node at (1.1,1.8) {\textcolor{red}{\tiny $J_{23}(t)$}};
% There were a few extra ;s in these lines
\labelLatLon{up}{90}{0}
\labelLatLon{down}{-90}{90}
\node[above] at (up) {{\tiny $\left|1\right>$ }};
\node[below] at (down) {{\tiny $\left|0\right>$}};
\labelLatLon[labelmark=false]{d}{15}{90}
\node at (d) {\color{gray}\fontsize{0.15cm}{1em}\selectfont $60^\circ$};
\labelLatLon[labelmark=false]{d2}{5}{78}
\end{blochsphere}
\end{scope}
\begin{scope}[shift={(4,0)}]
\begin{blochsphere}[radius=1.5 cm,tilt=15,rotation=-20,nested=true]
\drawBall
\drawBallGrid[style={draw,opacity=0.3}]{30}{30}
\drawGreatCircle[style={dashed}]{-60}{0}%{0}
\drawGreatCircle[style={dashed}]{60}{0}%{0}
\drawRotationLeft[scale=1.3,style={red}]{-60}{0}{0}{15}
\drawRotationRight[scale=1.3,style={red}]{60}{0}{0}{15}
\node at (-0.8,1.9) {\textcolor{red}{\tiny $J_{12}(t)$}};
\node at (1.1,1.8) {\textcolor{red}{\tiny $J_{23}(t)$}};
\labelLatLon{up}{90}{0}
\labelLatLon{down}{-90}{90}
\node[above] at (up) {{\tiny $\left|1\right>$ }};
\node[below] at (down) {{\tiny $\left|0\right>$}};
\labelLatLon[labelmark=false]{d}{15}{90}
\node at (d) {\color{gray}\fontsize{0.15cm}{1em}\selectfont $60^\circ$};
\labelLatLon[labelmark=false]{d2}{5}{78}
\end{blochsphere}
\end{scope}
\end{tikzpicture}
\end{document}
Best Answer