# Tikz Horizontal Centering

I'm trying to center the following tikz image, but it's not correctly centered almost like there's a left margin... It goes to much to the right ATM please help, I've tried \centering and \begin{center}:

\begin{center}
\resizebox{15cm}{15cm}{
\definecolor{dbdbvq}{rgb}{0.8588235294117647,0.8588235294117647,0.3137254901960784}
\definecolor{dbzsqq}{rgb}{0.8588235294117647,0.5725490196078431,0.}
\definecolor{qqsczs}{rgb}{0.,0.17254901960784313,0.5725490196078431}
\definecolor{qqafqq}{rgb}{0.,0.6862745098039216,0.}
\definecolor{veqqzs}{rgb}{0.3686274509803922,0.,0.5725490196078431}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.35714285714285715cm,y=0.35714285714285715cm]
\draw [color=cqcqcq,, xstep=1.7857142857142858cm,ystep=1.7857142857142858cm] (-14.,-14.) grid (14.,14.);
\draw[->,color=black] (-14.,0.) -- (14.,0.);

\foreach \x in {-10.,-5.,5.,10.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-14.) -- (0.,14.);

\foreach \y in {-10.,-5.,5.,10.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};

\clip(-14.,-14.) rectangle (14.,14.);
\node[inner sep=0pt, opacity=0.5] (whitehead) at (0,0)
{\includegraphics[width=.25\textwidth,angle=-19.962]{Bil.png}};
\draw [->,line width=1.pt,color=veqqzs] (0.,0.) -- (0.,-12.);
\draw [->,line width=1.pt,color=qqafqq] (0.,0.) -- (4.01,11.04);
\draw [->,line width=1.pt,color=qqsczs] (0.,0.) -- (1.104,-0.401);
\draw[line width=2.pt] (-28.415610102473128,19.087651578067057) -- (-16.884268018623146,19.087651578067057);
\draw [->,line width=1.pt,color=dbzsqq] (0.,0.) -- (-9.42,3.42);
\draw [->,line width=1.pt,color=dbdbvq] (0.,0.) -- (-4.306,2.059);
\draw [line width=1.pt,domain=-14.:14.] plot(\x,{(--18.477050744352262--3.1540440892439214*\x)/-8.683453053679028});

\begin{scriptsize}
\draw[color=veqqzs] (1.5082226051175684,-6.36778607203197) node {$\vec{FT}$};
\draw[color=qqafqq] (1.5082226051175684,7.988734822361365) node {$\vec{FN}$};
\draw[color=qqsczs] (0.8739987905058194,-1.2939955551379403) node {$\vec{FG}$};
\draw [fill=black] (-20.343670643778143,19.087651578067057) circle (2.5pt);
\draw[color=black] (-20.113043802101142,20.44258427291944) node {$a = 2$};
\draw[color=dbzsqq] (-5.583552776450169,3.2032278575635864) node {$\vec{FM}$};
\draw[color=dbdbvq] (-2.5277471242299248,1.9924369387593293) node {$\vec{FR}$};
\draw[color=black] (-29.684057731696626,8.219361664038365) node {$l$};
\end{scriptsize}
\end{tikzpicture}}
\end{center}


The picture i wanna center is from the following file

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{hyperref}
\usetikzlibrary{arrows}
\pgfplotsset{compat=1.15}

\title{Vektor i planet}
\date{Januar 2018}

\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\bibliographystyle{alpha}

\begin{document}
\begin{titlepage}
\maketitle
\begin{center}
\resizebox{10cm}{10cm}{
\begin{tikzpicture}
\draw[thin,gray!40] (-2,-2) grid (2,2);
\draw[<->] (-2,0)--(2,0) node[right]{$x$};
\draw[<->] (0,-2)--(0,2) node[above]{$y$};
\draw[line width=2pt,blue,-stealth](0,0)--(2,2) node[anchor=south west]{$\boldsymbol{\vec{u}}$};
\draw[line width=2pt,green,-stealth](0,0)--(-2,-2) node[anchor=north east]{$\boldsymbol{\vec{-u}}$};
\end{tikzpicture}}
\end{center}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{titlepage}

\tableofcontents

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est \href{https://www.geogebra.org/m/nxqPCdU8}{laborum}. \cite{MatBog}

\begin{center}
\resizebox{15cm}{15cm}{
\definecolor{dbdbvq}{rgb}{0.8588235294117647,0.8588235294117647,0.3137254901960784}
\definecolor{dbzsqq}{rgb}{0.8588235294117647,0.5725490196078431,0.}
\definecolor{qqsczs}{rgb}{0.,0.17254901960784313,0.5725490196078431}
\definecolor{qqafqq}{rgb}{0.,0.6862745098039216,0.}
\definecolor{veqqzs}{rgb}{0.3686274509803922,0.,0.5725490196078431}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.35714285714285715cm,y=0.35714285714285715cm]
\draw [color=cqcqcq,, xstep=1.7857142857142858cm,ystep=1.7857142857142858cm] (-14.,-14.) grid (14.,14.);
\draw[->,color=black] (-14.,0.) -- (14.,0.);

\foreach \x in {-10.,-5.,5.,10.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-14.) -- (0.,14.);

\foreach \y in {-10.,-5.,5.,10.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};

\clip(-14.,-14.) rectangle (14.,14.);
\node[inner sep=0pt, opacity=0.5] (whitehead) at (0,0)
{\includegraphics[width=.25\textwidth,angle=-19.962]{Bil.png}};
\draw [->,line width=1.pt,color=veqqzs] (0.,0.) -- (0.,-12.);
\draw [->,line width=1.pt,color=qqafqq] (0.,0.) -- (4.01,11.04);
\draw [->,line width=1.pt,color=qqsczs] (0.,0.) -- (1.104,-0.401);
\draw[line width=2.pt] (-28.415610102473128,19.087651578067057) -- (-16.884268018623146,19.087651578067057);
\draw [->,line width=1.pt,color=dbzsqq] (0.,0.) -- (-9.42,3.42);
\draw [->,line width=1.pt,color=dbdbvq] (0.,0.) -- (-4.306,2.059);
\draw [line width=1.pt,domain=-14.:14.] plot(\x,{(--18.477050744352262--3.1540440892439214*\x)/-8.683453053679028});

\begin{scriptsize}
\draw[color=veqqzs] (1.5082226051175684,-6.36778607203197) node {$\vec{FT}$};
\draw[color=qqafqq] (1.5082226051175684,7.988734822361365) node {$\vec{FN}$};
\draw[color=qqsczs] (0.8739987905058194,-1.2939955551379403) node {$\vec{FG}$};
\draw [fill=black] (-20.343670643778143,19.087651578067057) circle (2.5pt);
\draw[color=black] (-20.113043802101142,20.44258427291944) node {$a = 2$};
\draw[color=dbzsqq] (-5.583552776450169,3.2032278575635864) node {$\vec{FM}$};
\draw[color=dbdbvq] (-2.5277471242299248,1.9924369387593293) node {$\vec{FR}$};
\draw[color=black] (-29.684057731696626,8.219361664038365) node {$l$};
\end{scriptsize}
\end{tikzpicture}}
\end{center}

\begin{center}
\resizebox{10cm}{10cm}{
$\hat{\hat{\hat{a}}}$
}
\end{center}

\bibliography{Main}
\end{document}


Welcome! I slightly modified your file. Instead of \resizebox, use the option scale in the TikZ picture. In future, please strip off styles that are not relevant to the problem, and also do not include graphics files that others don't have.

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{hyperref}
\usetikzlibrary{arrows}
\pgfplotsset{compat=1.15}

\title{Vektor i planet}
\date{Januar 2018}

\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\bibliographystyle{alpha}

\begin{document}
\begin{titlepage}
\maketitle
\begin{center}
\resizebox{10cm}{10cm}{
\begin{tikzpicture}
\draw[thin,gray!40] (-2,-2) grid (2,2);
\draw[<->] (-2,0)--(2,0) node[right]{$x$};
\draw[<->] (0,-2)--(0,2) node[above]{$y$};
\draw[line width=2pt,blue,-stealth](0,0)--(2,2) node[anchor=south west]{$\boldsymbol{\vec{u}}$};
\draw[line width=2pt,green,-stealth](0,0)--(-2,-2) node[anchor=north east]{$\boldsymbol{\vec{-u}}$};
\end{tikzpicture}}
\end{center}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{titlepage}

\tableofcontents

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est \href{https://www.geogebra.org/m/nxqPCdU8}{laborum}. \cite{MatBog}

\begin{center}
%        \resizebox{15cm}{15cm}{ %<- removed in favor of scale
\definecolor{dbdbvq}{rgb}{0.8588235294117647,0.8588235294117647,0.3137254901960784}
\definecolor{dbzsqq}{rgb}{0.8588235294117647,0.5725490196078431,0.}
\definecolor{qqsczs}{rgb}{0.,0.17254901960784313,0.5725490196078431}
\definecolor{qqafqq}{rgb}{0.,0.6862745098039216,0.}
\definecolor{veqqzs}{rgb}{0.3686274509803922,0.,0.5725490196078431}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}

\begin{tikzpicture}[line cap=round,line join=round,>=triangle
45,x=0.35714285714285715cm,y=0.35714285714285715cm,scale=1.3] %<-
\draw [color=cqcqcq,, xstep=1.7857142857142858cm,ystep=1.7857142857142858cm] (-14.,-14.) grid (14.,14.);
\draw[->,color=black] (-14.,0.) -- (14.,0.);

\foreach \x in {-10.,-5.,5.,10.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-14.) -- (0.,14.);

\foreach \y in {-10.,-5.,5.,10.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};

\clip(-14.,-14.) rectangle (14.,14.);
% Removed because I don't have the file "Bil.png"
%                     \node[inner sep=0pt, opacity=0.5] (whitehead) at (0,0)
%                         {\includegraphics[width=.25\textwidth,angle=-19.962]{Bil.png}};
\draw [->,line width=1.pt,color=veqqzs] (0.,0.) -- (0.,-12.);
\draw [->,line width=1.pt,color=qqafqq] (0.,0.) -- (4.01,11.04);
\draw [->,line width=1.pt,color=qqsczs] (0.,0.) -- (1.104,-0.401);
\draw[line width=2.pt] (-28.415610102473128,19.087651578067057) -- (-16.884268018623146,19.087651578067057);
\draw [->,line width=1.pt,color=dbzsqq] (0.,0.) -- (-9.42,3.42);
\draw [->,line width=1.pt,color=dbdbvq] (0.,0.) -- (-4.306,2.059);
\draw [line width=1.pt,domain=-14.:14.] plot(\x,{(--18.477050744352262--3.1540440892439214*\x)/-8.683453053679028});

%                \begin{scriptsize} %<- removed
\draw[color=veqqzs] (1.5082226051175684,-6.36778607203197) node {$\vec{FT}$};
\draw[color=qqafqq] (1.5082226051175684,7.988734822361365) node {$\vec{FN}$};
\draw[color=qqsczs] (0.8739987905058194,-1.2939955551379403) node {$\vec{FG}$};
\draw [fill=black] (-20.343670643778143,19.087651578067057) circle (2.5pt);
\draw[color=black] (-20.113043802101142,20.44258427291944) node {$a = 2$};
\draw[color=dbzsqq] (-5.583552776450169,3.2032278575635864) node {$\vec{FM}$};
\draw[color=dbdbvq] (-2.5277471242299248,1.9924369387593293) node {$\vec{FR}$};
\draw[color=black] (-29.684057731696626,8.219361664038365) node {$l$};
%                \end{scriptsize}
\end{tikzpicture}%}
\end{center}

\begin{center}
\resizebox{10cm}{10cm}{
$\hat{\hat{\hat{a}}}$
}
\end{center}

\bibliography{Main}
\end{document}

• +1 for your excellent work and for your beautiful answers. Jan 24, 2018 at 21:24