0

I am trying to use tikz to make a field tower. I have \usepackage{tikz}at the top, and when I comment out my tikz section, the file compiles with no problem. The section using tikz looks like this:

\begin{tikzpicture}
\node (Q1) at (0,0) {$\mathbb{Q}$};
\node (Q2) at (2,2) {$\mathbb{Q}\Big[\sqrt{7}\Big]$};
\node (Q3) at (0,4) {$\mathbb{Q}\Big[\sqrt{3}, \sqrt{7}\Big]$};
\node (Q4) at (-2,2) {$\mathbb{Q}\Big[\sqrt{3}\Big]$};

\draw (Q1)--(Q2)
\draw (Q1)--(Q4)
\draw (Q3)--(Q2)
\draw (Q3)--(Q4)
\end{tikzpicture}

The error I am getting is "Sorry, your compile took too long to run and timed out." I know that usually means a fatal error, but the rest of my document compiles totally fine and I am not sure what is wrong with my tikz. I am using Overleaf and have never really had this problem before.

3
  • 6
    Welcome to TeX.SX! You need to add a semicolon ; after every \draw (as well as after every \fill, \node and similar) macro in a TikZ environment. So, in your code, you need to write \draw (Q1)--(Q2); etc. Oct 25, 2022 at 17:40
  • 1
    Lines between nodes you can write as \draw (Q1)--(Q2)-- (Q3)--(Q4) -- (Q1);
    – Zarko
    Oct 25, 2022 at 18:13
  • The reason for the timeout is that nested \draw (or node, fill, etc) commands create infinite loops.
    – Rmano
    Oct 25, 2022 at 20:16

2 Answers 2

4
  • In Overleaf you can compile tikzpictures without any problems
  • but your picture code is erroneous. Each command in code had to be terminated with ; as mentioned @Jasper Habich in his comment. -Your code you ba srite also on the following way:
\documentclass[margin=3.141592,varwidth]{standalone}
\usepackage{tikz}
\usepackage{amssymb}

\begin{document}
\begin{tikzpicture}
\node (Q1) at (0,0)     {$\mathbb{Q}$};
\node (Q2) at (2,2)     {$\mathbb{Q}\Big[\sqrt{7}\Big]$};
\node (Q3) at (0,4)     {$\mathbb{Q}\Big[\sqrt{3}, \sqrt{7}\Big]$};
\node (Q4) at (-2,2)    {$\mathbb{Q}\Big[\sqrt{3}\Big]$};

\draw (Q1)--(Q2)-- (Q3)--(Q4) -- (Q1);
\end{tikzpicture}
\end{document}

Result is the same if you compile above MWE with local LaTeX installation or use Overleaf service:

enter image description here

3

Using (off-topic) tikz-cd package you will have the same effect.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}[row sep=2cm, arrows=dash]
  &&   \mathbb{Q}\Big[\sqrt{3}, \sqrt{7}\Big] &  \\
   & \mathbb{Q}\Big[\sqrt{3}\Big] \arrow[ur] &&  \mathbb{Q}\Big[\sqrt{7}\Big] \arrow[ul] & \\
  &&   \arrow[ul] \mathbb{Q} \arrow[ur]  
\end{tikzcd}
\]

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .