[Tex/LaTex] How to use a usepackage only for one section

graphicspackagestexinputstikz-pgf

I need 2 different usepackages: one for a floatchart ( http://www.texample.net/tikz/examples/simple-flow-chart/) and one for my whole document.

.

For the Floatchart:

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

For my document:

\usepackage[pdftex]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

If I insert both, texmaker says: option clash for package graphicx and for package inputenc.

What can I do? Can I specify the usepackage for the floatchart only for the floatchart?

Best Answer

I don't know where this [pdftex] habit originates but you don't need to use it. You can read a few answers on this site too about it but in a nut shell, most modern packages know what the current driver is and they can decide. Providing a fixed option is only looking for trouble.

In your example, TikZ already loads graphicx so you don't need to do anything. Just load TikZ and you are good to go. If for some reason you don't want to include the package then include it as a picture.

So, using

\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows}

and it should work for both sections. Instead of font and input encoding, I would go with LuaTeX though.

Some reading;

Conflict between color, graphicx and libertine

Option clash when using graphicx and tikz packages

Is it possible to load a TikZ library locally?