I am drawing a TikZ picture as a standalone file and then I use \includestandlaone in my main document. When I insert the file the picture is not centered even though I use \centering. How can I fix this?


Main file



\includestandalone[max width=0.5\textwidth]{./fig/partA_inventory_diagram}


Standalone file


% define origin of coordinate system
\coordinate (origin) at (0,0);

\draw[<->] (0,-3) -- (0,7) node[above] {Inventory $Q$};
\draw[->] (origin) -- (10,0) node[right] {Time $t$};

  • can you move \usetikzlibrary part before \begin{document} and try? and also remove the empty line before figure environment and add \noindent – percusse Oct 10 '17 at 11:59
  • 1
    Does that even work for you? I get ! LaTeX Error: Option clash for package adjustbox., which can be fixed by making \usepackage[export]{adjustbox} the first package to be loaded. (And doing that it works fine.) – Torbjørn T. Oct 10 '17 at 12:02
  • @TorbjørnT. it works when I made it the first package to be loaded. Thank you. – lala_12 Oct 10 '17 at 14:00

Do not ignore errors!

Your code produces an error saying

! LaTeX Error: Option clash for package adjustbox.

which is caused by the fact that the standalone package loads the adjustbox package without options, and when you try to load again, with more options, you get an error.

Whenever a package is loaded more than once, the options passed to it the second time has to be a subset of the options passed to it the first time. Hence, load adjustbox before standalone, i.e. do


instead of


and you're fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.