In general I create all my tikzpictures in separate tex files which I then input using the \input command to a main tex file.

I started using a template from my university for the main file and now I see that any \draw or \node do not show up (or at least I don't see them within the plotting area) in the final pdf when compiled.

Only the pgfplots seems to work. I have included the packages for tikz and pgfplots in the main file and still nothing. In one of my plots the nodes did show up but they had another scale in the y axis (I had to multiply by 10 the values of the y coordinates in the nodes to fix them to the right place).

Any idea why the insertion of the tikzpicture using \input{mytikz.tex} do not work properly for tikz items? and how to fix it?

Here is an example of what I am talking:

  1. Compiling tex file with only the tikzpicture a tex file with only tikzpicture

  2. Compiling the main file main file with text and input figure

Example code:


    % Libraries

    % Others


        \begin{tikzpicture}[dots/.style={circle,draw=blue,fill=blue, inner sep=-1pt}]

        scale only axis, % scale axis to specified size, otherwise the complete picture takes the size
    %   scale=1,
    %   normalsize,
    %   x=8cm,
    %   xmin=1, xmax=200,
    %   ymin=-1, ymax=0,
    %   ticks=none,
        axis x line=top,
        axis y line=left,
        y axis line style={stealth-},
    %   xlabel={$ln(\tau_{rz})$},
        x label style={above,font=\large,at={(1,1)}},
    %   ylabel={$\delta_{head}$},
        y label style={font=\Large},
        legend style={at={(0.01,0.01)},anchor=south west,font=\scriptsize},
        legend columns=1,
        legend style={/tikz/column 3/.style={column sep=10pt}},
        legend cell align=left,
        log ticks with fixed point,

            \addlegendimage{empty legend}
            \addlegendentry{A $\rightarrow$ B  $\Delta\tau$=0 with t}
            \addlegendimage{empty legend}
            \addlegendentry{A $\rightarrow$ C  $\Delta\tau$=change with t}

            % NC-line
            \addplot[name path global=nc1,domain=30:60]{-0.01*ln(x)}
            coordinate [pos=0.3] (K1)
            coordinate [pos=0.6] (K2)
            \addplot[name path global=nc2,domain=60.01:160]{-0.1*ln(x)+(0.1*ln(60)-0.01*ln(60))}
            coordinate [pos=0.3] (L1)
            coordinate [pos=0.4] (L2)

            % Isotachs
            \addplot[name path global=iso2,domain=45.01:160]{-0.1*ln(x)+(0.1*ln(60.01)-0.01*ln(60))-0.05};

            % Dots  
            \node[dots,label=right:\normalsize A] (A1) at (100,-0.092) {};

            \node[dots,label=right:\normalsize B] (B1) at (100,-0.092-0.05) {};
            \node[dots,label=left:\normalsize C] (C1) at (90,-0.081-0.05) {};

            \node[label=right:\normalsize time] (t11) at (120,-0.092) {};
            \node[] (t22) at (120,-0.092-0.05) {};

            % Arrows
            \draw [->,black,thick,shorten <=1pt, shorten >=1pt,densely dashed] (A1.south)--(B1.north);
            \draw [->,black,thick,shorten <=1pt, shorten >=1pt,densely dashed] (A1.south)--(C1.north);
            \draw [|->,red,thick,shorten <=1pt, shorten >=1pt,solid] (t11.south)--(t22.north);



After commenting out the preamble of the single file, I input it in the main file:


My plot is in semilog scale by the way. After removing the scale, the nodes show somewhere in the plot space, but I don't know why the are not matching the assigned coordinates.

nodes in wrong place

  • Do you have some sort of every node or every picture type of tikzset style settings in some place?
    – percusse
    Commented Aug 31, 2015 at 16:44
  • But your example code doesn't show the problem mentioned. Commented Aug 31, 2015 at 16:45
  • percusse, I do not have any type of tikzset and Gonzalo, my example is the pictures I added, the code is more to illustrate what I do, my functions is more complex. I forgot to add some node comand in the example code.
    – Gabriel
    Commented Aug 31, 2015 at 16:55
  • @Gabriel, is content of your image complete or is a part of it imported from some subfolder? If the latter is the case, than you have problem with defining paths to image and "sub image". Otherwise, if the image is complete in one file, it should appear complete in main file.
    – Zarko
    Commented Aug 31, 2015 at 17:19
  • @Zarko the image is complete in its own tex file. I then comment the preamble since the same things are in the main file, so when I use \input I just pull everything inside the \begin{tikzpicture} to \end{tikzpicture}. The path seems ok. I just added a picture without the semilogx scale to show that the nodes are floating somewhere in the plot space.
    – Gabriel
    Commented Aug 31, 2015 at 18:11

1 Answer 1


I am the author of the template Gabriel uses, and I do make use of overlay and remember picture for the cover page.

But I'm pretty sure that the real solution to this problem is to make use of axis cs when specying the nodal points in the plot axis c.s.

The pgfplots gallery show multiple uses of this.

\node[...] at (axis cs:0.18,0.74,0.08) {...};

(I could be wrong)

  • I think your remember picture setting might have leaked out if you had used every picture/.style otherwise this shouldn't be a problem. And since version 1.11 assumes axis cs for the naked coordinates if it is not explicitly mentioned.
    – percusse
    Commented Aug 31, 2015 at 21:21
  • This solved the problem, I will keep checking all my other plots. Thanks to all!
    – Gabriel
    Commented Aug 31, 2015 at 21:23
  • @percusse I only used remember picture, overlay on a single tikzpicture in the front matter. No tikzset or anything my template. My template doens't include pgfplots package at all, so I don't try to set any compat version either, so likely, in this case version 1.11 wasn't in use. Commented Aug 31, 2015 at 22:06

You must log in to answer this question.

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