0

I am having trouble and some confusing behaviour while trying to produce a large tikz picture. Here is the minimal example of the problem. I should note that I am doing all the work online on Overleaf.

This is my main file main.tex:

\documentclass{amsart}

\usepackage[dvipsnames]{xcolor}

\usepackage{tikz}
    
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]

\begin{document}
\begin{tikzpicture} % line X
    \input{pic}
\end{tikzpicture} % line Y
\end{document}

The file pic.tex is very large (complete file is here), but basically it looks like this:

\begin{tikzpicture}
    [scale=4]

    % 10000 lines, each drawing one short segment in a different color
\end{tikzpicture}

The following two strange things happen:

  1. I get the following result

enter image description here

but I am 100% certain the result should be

enter image description here

For some reason the two thirds of the picture are trimmed.

  1. Note that I actually have two nested tikzpicture environments. For some reason this doesn't throw an error, but if I try to remove one of them by commenting line X and line Y in main.tex, I get the error

    TeX capacity exceeded, sorry [main memory size=5000000].
    

This doesn't make any sense to me, why does having two nested tikzpicture environments help here? Is there a more logical way to do it?

4
  • Have you tried with a shorter pic? Result?
    – Mensch
    Commented Oct 28, 2023 at 13:18
  • If you remove the \begin{tikzpicture}[scale=4] and \end{tikzpicture} from pic.tex and add [scale=4] in the main file, everything seems to work. I don't know the internals of TikZ well enough to understand why.
    – Senex
    Commented Oct 28, 2023 at 13:30
  • @Mensch Yes, with a shorter picture it seems to work fine. Commented Oct 28, 2023 at 13:40
  • @Senex Hmmm, that's really strange... I'd really like to know what is going on here. Commented Oct 28, 2023 at 13:40

0

You must log in to answer this question.

Browse other questions tagged .