Input stack size=5000 error when using \include - latex

I am "including" a .tex file. I get the error "TeX capacity exceeded, sorry [input stack size=5000].#nomath ...e#font#warning etc."
The error is located by latex in the line that says
\pic[current plane, draw,fill=orange!50,fill opacity=.5, text
opacity=1,"\footnotesize $\phi$", angle
eccentricity=2.2]{angle=ketplus--origin--psiProjectedEquat}; %je
nachdem, ob der Psi Pfeil links oder rechts von der z-Achse ist, muss
man die Reihenfolge bei "angle=" umkehren }
I should point out that the file that is "included" works when compiled on its own (where the preamble isn't in the masterfile but in the file itself. It seems that the \usepackage[ngerman]{babel} in the masterfile causes the problem.
MWE:
"file.tex":
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,calc,math,angles,quotes}
\usepackage{blochsphere}
\usepackage{braket}
\usetikzlibrary{arrows.meta}
\begin{document}
\include{file1}
\end{document}
"file1.tex":
\def\rotationSphere{-10} %Drehung im Uhrzeigersinn aus der Standardposition "x-Achse aus Bildebene heraus, y-Achse nach rechts"; 89.9 statt 90 (sonst Division von 0 durch 0)
\def\tiltSphere{10} %0.01 statt 0 da bei 0 Fehler bei der im Paket hinterlegten Rechnung mit Sinus/Cosinus kommen
\def\radiusSphere{2cm}
\def\psiTheta{70} %Winkel Theta
\def\psiPhi{65} %Winkel Phi
%Farbeinstellung als Hinweis für sämtliche color= Befehle
%draw={rgb,255:red,199; green,199; blue,199}
\begin{blochsphere}
[ball=none,radius=\radiusSphere,opacity=1,rotation=\rotationSphere,tilt=\tiltSphere,color=white]
\newcommand\drawLatitudeCircleNew[2][]{
\begingroup
\pgfmathsetmacro\yshift{sin(#2)*\blochsphere#radius}
\pgfmathsetmacro\radius{\blochsphere#radius*cos(#2)}
\drawCircleNew[#1,shift={{0,0,\yshift}},radius=\radius]{0}{0}
\endgroup
}%
\newcommand\drawLongitudeCircleNew[2][]{
\begingroup
\drawCircleNew[#1]{90}{#2+90}
\endgroup
}
\newcommand\drawCircleNew[3][]{
\begingroup
%\setkeys{blochsphere}{#1}
\setDrawingPlane{#2}{#3}
\computeVisibility{#2}{#3}{agamma}{abeta}
\begingroup\edef\tmp{\endgroup%
\noexpand\draw[opacity=0.2,line width=0.8,current plane,on layer=front,\unexpanded\expandafter{\blochsphere#style}] \unexpanded\expandafter{(\agamma-\abeta-0.2:\blochsphere#radius+\the\pgflinewidth*0.5) arc (\agamma-\abeta-0.2:\agamma+\abeta+0.2:\blochsphere#radius+\the\pgflinewidth*0.5)};
\noexpand\draw[current plane,opacity=0.5,line width=0.8,on layer=front,\unexpanded\expandafter{\blochsphere#style}] \unexpanded\expandafter{(\agamma+\abeta:\blochsphere#radius+\the\pgflinewidth*0.5) arc (\agamma+\abeta:\agamma-\abeta+360:\blochsphere#radius+\the\pgflinewidth*0.5)};
} \tmp
\endgroup
}%hier Dicke, Form und Farbe von Longitude/Latitude Circle einstellen
\pgfdeclareradialshading[tikz#ball]{ball}{\pgfqpoint{-10bp}{10bp}}{
color(0bp)=(tikz#ball!90!white);
color(9bp)=(tikz#ball!90!white);
color(18bp)=(tikz#ball!90!white);
color(25bp)=(tikz#ball!90!black);
color(50bp)=(black)
}
\drawBall[ball=3d,radius=\radiusSphere,opacity=1,rotation=\rotationSphere,tilt=\tiltSphere,color=white]
%\drawBallGrid[style={opacity=.3}]{30}{30}
%Vertikale Ebene (als Kreis) zeichnen
%\drawLongitudeCircle[]{\rotationSphere}
\drawLongitudeCircleNew[style={opacity=0.3,line width=0.8}]{-90-0} %Schreibe bei Befehle, die Latitude und Longitude verwenden immer {90-phiTheta} und {-90-phi)}
%Horizontale Ebene (als Kreis) zeichnen
\drawLatitudeCircleNew[style={opacity=0.3,line width=0.8}]{90-90} %style={dashed} falls Linie gestrichelt haben will
%Punkte auf der Kugel definieren (für Achsen)
\labelLatLon[radius=\radiusSphere*1.3]{ket0}{90-0}{-90-0}; %Schreibe bei LatLon Befehl immer {90-phiTheta} und {-90-phi)} wegen Definition von LabelLatLon
\labelLatLon[radius=\radiusSphere]{ket1}{90-180}{-90-0};
\labelLatLon[radius=\radiusSphere]{ketminus}{90-90}{-90-0+180};
\labelLatLon[radius=\radiusSphere*2.2]{ketplus}{90-90}{-90-0};
\labelLatLon[radius=\radiusSphere*1.25]{ketpluspi2}{90-90}{-90-90};
\labelLatLon[radius=\radiusSphere]{ketplus3pi2}{90-90}{-90-90+180};
\labelLatLon{psi}{90-\psiTheta}{-90-\psiPhi};
%Achen zeichnen und markieren
%z-Achse
\draw[-latex,opacity=0.5,line width=0.8] (0,0,0) -- (ket0) node[below right,inner sep=.5mm,opacity=0.5] at (ket0) {\footnotesize $z$};
%Bemerkung: 0,0,0 karthesische Koordinaten; ket0 in 2D Koordinaten auf der Kugeloberfläche
%gepunkteter Teil der z-Achse
\draw[-latex,opacity=0.3,line width=0.8,-] (0,0,0) -- (ketplus3pi2) node[below right,inner sep=.5mm,opacity=0.5] at (ketplus3pi2) {};
%usw.
\draw[-latex,opacity=0.3,line width=0.8,-] (0,0,0) -- (ket1) node[below right,inner sep=.5mm,opacity=0.5] at (ket1) {};
\draw[-latex,opacity=0.3,line width=0.8,-] (0,0,0) -- (ketminus) node[below right,inner sep=.5mm,opacity=0.5] at (ket1) {};
\draw[-latex,opacity=0.5,line width=0.8] (0,0,0) -- (ketplus) node[above left,inner sep=.5mm,opacity=0.5] at (ketplus) {\footnotesize$x$};
\draw[-latex,opacity=0.5,line width=0.8] (0,0,0) -- (ketpluspi2) node[below left,inner sep=0.5mm,opacity=0.5] at (ketpluspi2) {\footnotesize $y$};
%|psi> zeichnen
\draw[-latex,color=orange,line width=2] (0,0,0) -- (psi) node[above]{\footnotesize $\ket{\psi}$};
\def\phitest{65}
\labelLatLon{test}{90-90}{-90-65};
\draw[-latex,color=orange,line width=2] (0,0,0) -- (test) node[above]{\footnotesize $\ket{test}$};
%Winkel zeichnen
\coordinate (origin) at (0,0,0);
{
%Projektion zeichnen - cosinus verwendet
\setDrawingPlane{0}{0}
\draw[current plane,dashed] (0,0,0) -- (180+\psiPhi:{cos(90-\psiTheta)*\radiusSphere}) coordinate (psiProjectedEquat) -- (psi); %Winkel:Länge Polarkoordinaten
%Winkel schattieren (phi)
\pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"\footnotesize $\phi$", angle eccentricity=2.2]{angle=ketplus--origin--psiProjectedEquat}; %je nachdem, ob der Psi Pfeil links oder rechts von der z-Achse ist, muss man die Reihenfolge bei "angle=" umkehren
}
{ \setLongitudinalDrawingPlane{-90-\psiPhi}
%Winkel schattieren (theta)
\pic[current plane, draw,fill=orange!50,fill opacity=.5, text opacity=1,"\footnotesize $\theta$", angle eccentricity=1.5]{angle=ket0--origin--psi}; %je nachdem, ob der Psi Pfeil links oder rechts von der z-Achse ist, muss man die Reihenfolge bei "angle=" umkehren
}
\end{blochsphere}

As you've noticed, the combination of your tikz picture and babel causes the problem. You can fix this by loading the babel tikz library:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,calc,math,angles,quotes}
\usepackage{blochsphere}
\usepackage{braket}
\usetikzlibrary{arrows.meta,babel}
\begin{document}
\include{file1}
\end{document}

Related

Latex beamer error: argument of \language#active#arg" has an extra }. \end{frame}

I'm trying to put together a presentation using latex beamer. I drew a triangle using the tikz package but I can't put the names on the angles. When executing the code, the following error appears: "Argument of \language#active#arg" has an extra }. \end{frame}"
The code is:
\documentclass[xcolor=dvipsnames,10pt,serif]{beamer} % serif, mathserif
\usepackage[english,brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae}
\setbeamertemplate{caption}[numbered]
\setlength\abovecaptionskip{-3pt}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption}{size=\scriptsize}
\usefonttheme[onlymath]{serif}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{mathrsfs}
\usepackage{icomma}
\usepackage{bm}
\usepackage{steinmetz}
\usepackage{tikz}
\usepackage{adjustbox}
\usepackage{subfigure}
\usepackage{ragged2e}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,quotes,babel}
\DeclareMathOperator{\sen}{sen}
\mode<presentation>
{
\usetheme{CambridgeUS}
}
\begin{document}
\begin{frame}{Frame Title}
\begin{figure}
\begin{tikzpicture}
\coordinate (C) at (-1.5,-1);
\coordinate (A) at (1.5,-1);
\coordinate (B) at (1.5,1);
\coordinate (D) at (1.5,-3);
\node [below] at (3,-1) {$\Re$};
\node [above] at (-1.5,2) {$\Im$};
%draw cartesian plane
\draw[stealth-stealth] (-1.5,-4) -- (-1.5,2) coordinate (y axis);
\draw[-stealth] (C) -- (3,-1) coordinate (x axis);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}] (C) --
node[font=\Large,sloped,above] {$S_{abc}$} (B);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](A) --
node[font=\Large,pos=0.7,right] {$Q_{abc}$} (B);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) --
node[font=\Large,pos=0.8,above] {$P_{abc}$} (A);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) --
node[font=\Large,sloped,below] {$S_{abc}$} (D);
\draw[very thick,{Stealth[length=3mm, width=1.5mm]}-](D)--
node[font=\Large,pos=0.3,right] {$-Q_{abc}$} (A) ;
\pic[thick,"$\theta$", draw=blue,-stealth, angle eccentricity=1.2, angle radius=1cm]
{angle=A--C--B};
\pic[thick,"$\theta$", draw=red, stealth-, angle eccentricity=1.2, angle radius=0.9cm]
{angle=D--C--A};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
Can anybody help me?
If you have fragile content in your frame, like certain tikz pictures, use the fragile frame option.
Some other comments:
the serif class option is obsolete. A warning in the log file will tell you to use the serif font theme instead, but as you already do this, there is really no reason to use this class option
if your tex distribution isn't terrible outdated, you no longer need \usepackage[utf8]{inputenc}
there are two \setbeamertemplate{caption}[numbered]
you don't need color and the ams* packages, beamer already loads them for you
\documentclass[xcolor=dvipsnames,10pt]{beamer} % serif, mathserif
\usepackage[english,brazil]{babel}
%\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae}
\setbeamertemplate{caption}[numbered]
\setlength\abovecaptionskip{-3pt}
%\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption}{size=\scriptsize}
\usefonttheme[onlymath]{serif}
%\usepackage{color}
%\usepackage{amsmath}
%\usepackage{amsfonts}
%\usepackage{amssymb}
%\usepackage{amstext}
\usepackage{mathrsfs}
\usepackage{icomma}
\usepackage{bm}
\usepackage{steinmetz}
\usepackage{tikz}
\usepackage{adjustbox}
\usepackage{subfigure}
\usepackage{ragged2e}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,quotes,babel}
\DeclareMathOperator{\sen}{sen}
\mode<presentation>
{
\usetheme{CambridgeUS}
}
\begin{document}
\begin{frame}[fragile]
\frametitle{Frame Title}
\begin{figure}
\begin{tikzpicture}
\coordinate (C) at (-1.5,-1);
\coordinate (A) at (1.5,-1);
\coordinate (B) at (1.5,1);
\coordinate (D) at (1.5,-3);
\node [below] at (3,-1) {$\Re$};
\node [above] at (-1.5,2) {$\Im$};
%draw cartesian plane
\draw[stealth-stealth] (-1.5,-4) -- (-1.5,2) coordinate (y axis);
\draw[-stealth] (C) -- (3,-1) coordinate (x axis);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}] (C) --
node[font=\Large,sloped,above] {$S_{abc}$} (B);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](A) --
node[font=\Large,pos=0.7,right] {$Q_{abc}$} (B);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) --
node[font=\Large,pos=0.8,above] {$P_{abc}$} (A);
\draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) --
node[font=\Large,sloped,below] {$S_{abc}$} (D);
\draw[very thick,{Stealth[length=3mm, width=1.5mm]}-](D)--
node[font=\Large,pos=0.3,right] {$-Q_{abc}$} (A) ;
\pic[thick,"$\theta$", draw=blue,-stealth, angle eccentricity=1.2, angle radius=1cm]
{angle=A--C--B};
\pic[thick,"$\theta$", draw=red, stealth-, angle eccentricity=1.2, angle radius=0.9cm]
{angle=D--C--A};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}

Place boundary of two adjacent nodes on top of each other

If I place two nodes adjacent to each other the resulting boundary between the nodes is doubled making it more thick than other boundarys. Is it possible to place them on top of each other in order to keep the original thickness?
Here my code and below some example pictures:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\tikzstyle{node} = [draw, rectangle, minimum width=1cm]
\node [node] (n_one) {node 1};
\node [node, right = 0cm of n_one.north east, anchor = north west] (n_two) {node 2};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
You can shift the right node by one line width:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\tikzstyle{node} = [draw, rectangle, minimum width=1cm]
\node [blue,node] (n_one) {node 1};
\node [red,node, right = -\the\pgflinewidth of n_one.north east, anchor = north west] (n_two) {node 2};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
Or you could draw only a single node:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.multipart}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}
\node[
rectangle split,
rectangle split parts=2,
draw,
rectangle split horizontal,
rectangle split part align={center, top, bottom}
] at (0,0) {node 1\nodepart{two}node 2};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}

How to draw a horizontal arrow between 2 nodes in LaTex?

I am new to latex. My issue is that I would like the arrow from the "perceived" to the "distress" node to be horizontal. As you can see in the picture attached below, the arrow is not completely horizontal. Thanks in advance.
[1]: https://i.stack.imgur.com/gq17O.png
\documentclass[jou]{apa7}
\usepackage{tikz}
\usetikzlibrary{shapes, shadows, arrows}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={align=center}
}
\begin{document}
[\begin{tikzpicture}
\node\[mynode\] (mental){\begin{tabular}{c} Mental health \\ support \end{tabular}};
\node\[mynode,below left=of mental\](family) {\begin{tabular}{c} Perceived family \\ support \end{tabular}};
\node\[mynode,below right=of mental\](distress) {Distress};
\draw\[-latex\] (family.north) -- node\[auto,\] {.2395} (mental.west);
\draw\[-latex\] (mental.east) -- node\[auto,\] {1.4509} (distress.north);
\draw\[-latex\] (family.east) -- node\[below=3mm, align=center\] {$-.0453$$^*$} (distress.west);
\draw\[-latex\] (family.east) -- node\[above=3mm, align=center\] {$-.0248$$^*$} (distress.west);
\end{tikzpicture}
\end{document}
\documentclass[jou]{apa7}
\usepackage{tikz}
\usetikzlibrary{shapes, shadows, arrows}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={align=center,text width=3cm}
}
\begin{document}
\begin{tikzpicture}
\node[mynode] (mental){Mental health \\ support};
\node[below= of mental] (dummy) {};
\node[mynode,left=2cm of dummy](family) {Perceived family \\ support};
\node[mynode,right=2cm of dummy](distress) {Distress};
\draw[-latex] (family.north) -- node[auto,] {.2395} (mental.west);
\draw[-latex] (mental.east) -- node[auto,] {1.4509} (distress.north);
\draw[-latex] (family.east) -- node[below=3mm, align=center] {$-.0453$$^*$} (distress.west);
\draw[-latex] (family.east) -- node[above=3mm, align=center] {$-.0248$$^*$} (distress.west);
\end{tikzpicture}
\end{document}

Setting Tikz Boarder Globally | Latex

With the following Code I am able to set the boarder for current page, but how can I make the boarder available to all pages without explicitly setting it on every page.
% !TeX TS-program = xelatex % | xelatex %
\documentclass[12pt, a4paper]{article}
\usepackage[left=3.3cm,right=2.3cm,top=2.3cm,bottom=2.3cm, footskip=42pt]{geometry}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=3pt] ($(current page.north west)+(2.5cm,-1.5cm)$) rectangle ($(current page.south east)+(-1.5cm,1.5cm)$);
\draw[line width=1pt] ($(current page.north west)+(2.6cm,-1.6cm)$) rectangle ($(current page.south east)+(-1.6cm,1.6cm)$);
\fill[red] (current page.center) circle (0.1);
\node[font=\Large\bfseries, text width=5cm,align=center] at (current page.center) {
\uppercase{Note -- 1}
\vspace{24pt}
\uppercase{Data analysis}
};
\end{tikzpicture}
\newpage
test
\end{document}
One possibility is to use the eso-pic package:
% !TeX TS-program = xelatex % | xelatex %
\documentclass[12pt, a4paper]{article}
\usepackage[left=3.3cm,right=2.3cm,top=2.3cm,bottom=2.3cm, footskip=42pt]{geometry}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=3pt] ($(current page.north west)+(2.5cm,-1.5cm)$) rectangle ($(current page.south east)+(-1.5cm,1.5cm)$);
\draw[line width=1pt] ($(current page.north west)+(2.6cm,-1.6cm)$) rectangle ($(current page.south east)+(-1.6cm,1.6cm)$);
\end{tikzpicture}%
}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\fill[red] (current page.center) circle (0.1);
\node[font=\Large\bfseries, text width=5cm,align=center] at (current page.center) {
\uppercase{Note -- 1}
\vspace{24pt}
\uppercase{Data analysis}
};
\end{tikzpicture}
\newpage
test
\end{document}

Space at begin of paragraph

Hello im doing a project for my university in latex and came accross this problem and nothing to fix it.
Basically there is this white space bevore the beginning of each paragraph. Below is my latex code from this sheet.
einem Ausgabeneuron. Gewichte in Neuronalen Netzen sind reelle Zahlen, unter denen man sich die Wichtigkeit der jeweiligen Eingabe vorstellen kann. Ändert man die Gewichte der einzelnen Eingabeneuronen, beeinflusst man somit die spätere Aktivierung des Ausgabeneurons. Die Ausgabe $y$ wird bestimmt durch die Aktivierungsfunktion des Ausgabeneurons und ist dabei wie folgt definiert: \\
%Output gleichung
\begin{equation}
y =
\begin{cases}
0, & \text{wenn}\ $$\sum_{i} w_{i}x_{i} \leq Schwellwert$$ \\
1, & \text{andernfalls}
\end{cases}
\end{equation}\\
Dabei ist der Schwellwert Teil des jeweiligen Neurons. Wie bei den Eingaben und Gewichtungen handelt es sich bei dem Schwellwert auch um eine reelle Zahl, welche anpassbar ist, um unterschiedliche Ergebnisse zu erzwingen. Worin besteht nun der Unterschied zu einem Multilayer Perzeptron? \\
Die Aktivierungsfunktion eines Multilayer Perzeptrons springt nicht zwischen 0 und 1, wie in (1) definiert sondern verhält sich stetig. \\
Das Singlelayer Perzeptron ist in der Lage, linear separierbare Probleme, wie z.B. die AND Funktion, zu lösen. Hier lassen sich die Resultatrelationen klar durch eine Gerade trennen. Bei der XOR Funktion reicht eine Gerade nicht mehr aus, ein Singlelayer Perzeptron wäre also nicht in der Lage, die XOR Funktion zu lösen.
Add \usepackage{parskip} to your preamble. For further customisation options see the parskip documentation.

Resources