tikz add tag
Raaja
I am trying to create a document where, I have a logo generated by tikz. I am trying to place the logo in every page while also trying to externalise the figure generation.

The problem is this technique worked seamlessly with `beamer` but with article class, I am not able to replicate it.
```
%&lualatex
% !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]
\documentclass[12pt,a4paper]{article}
%% necessary packages
\usepackage{graphicx, tikz,  stix2, geometry}
\geometry{margin = 1in}
% dont use it along with standalone both does the same job
% when tikz needs to be externalised, when only standalone is used, dont use this
\usetikzlibrary{external}
\tikzexternalize[prefix=tikzfig/]
\usepackage{standalone}
%% logo setup
\usepackage[all]{background}

\usepackage{lipsum}


%https://tex.stackexchange.com/questions/38751/how-do-i-add-an-image-in-the-upper-left-hand-corner-using-tikz-and-graphicx?noredirect=1&lq=1
%\newcommand{\MyGraphicLogo}{% For imported graphic logo
%\begin{tikzpicture}[remember picture,overlay,yshift=-2cm, xshift=2cm]
%  \node at (0,0) {\includegraphics[width=2cm,height=2cm]{foo}};
% \end{tikzpicture}
%}

\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ
\begin{tikzpicture}[remember picture,overlay,yshift=-1cm, xshift=1cm]
    \draw [cyan,fill=yellow] (0cm,0cm) 
        -- (2cm,  0cm) 
        -- (2cm, -2cm)
        -- (0cm, -2cm)
        -- cycle;
 \end{tikzpicture}
}

%\SetBgContents{\MyGraphicLogo}% Select included image
\SetBgContents{\MyTikzLogo}% Select tikz picture

\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}% Select opacity
\SetBgAngle{0.0}% Select roation of logo
\SetBgScale{1.0}% Select scale factor of logo


\begin{document}
\section*{Lorem Ipsum}
\lipsum[1-12]
\end{document}
```

Could you guys help me?
Top Answer
user 3.14159
As for the main question, you can disable `external` with `\tikzexternaldisable`, and switch it on again with `\tikzexternalenable`. I personally also do not think there is any need to use the `background` package if you use `tikz`. Rather, using it just may leed to unvoluntary nesting of `tikzpicture`s. 

```
%&lualatex
% !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]
\documentclass[12pt,a4paper]{article}
%% necessary packages
\usepackage[margin = 1in]{geometry}
\usepackage{tikz}
\usepackage{stix2}
% dont use it along with standalone both does the same job
% when tikz needs to be externalised, when only standalone is used, dont use this
\usetikzlibrary{external}
\tikzexternalize[prefix=tikzfig/]
\usepackage{standalone}
%% logo setup
\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\tikzexternaldisable
\begin{tikzpicture}[remember picture,overlay]
    \draw [cyan,fill=yellow] ([xshift=1cm,yshift=-1cm]current page.north west) 
	 rectangle ++ (2,-2);
 \end{tikzpicture}
\tikzexternalenable}
\usepackage{lipsum}

\begin{document}
\section*{Lorem Ipsum}
\lipsum[1-12]
\end{document}
```

I agree with @samcarter that if you have this background on many pages, and if it is a more complicated picture, you can use a `\savebox` and just `eso-pic` without Ti*k*Zy mechanisms to position it. I personally like to have `external` disabled for most of the document and switch it on just for extensive pictures. In general I do not think that `external` can be safely used for `overlay` and/or `remember picture` pictures. For this reason in practice I do mostly what Skillmon suggests: really extensive picutures get produced in `standalone` pictures and then included via `\includegraphics`. It should also be said that the additional compilation time that arises from recompiling extensive pictures can easily below the time spent on designing yet another shaky mechanism that externalizes the pictures. I personally like to spend the time to optimize the `tikzpicture`s themselves. This strategy is mostly successful with the exception of some `pgfplots`, which one still can externalize in one way or another..

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.