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?
MWE:
Main file
\documentclass{article}
\usepackage{standalone}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{textcomp}
\usepackage{amsmath,amsfonts,amssymb,mathtools,bm,amsthm,commath,esvect}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{standalone}
\usepackage{tikz}
\usepackage{forest}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{figure}
\centering
\includestandalone[max width=0.5\textwidth]{./fig/partA_inventory_diagram}
\end{figure}
\end{document}
Standalone file
\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\usetikzlibrary{arrows,decorations.markings}
\begin{tikzpicture}[>=stealth]
% 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$};
\end{tikzpicture}
\end{document}
\usetikzlibrarypart before\begin{document}and try? and also remove the empty line before figure environment and add\noindent– percusse Oct 10 '17 at 11:59! 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