Overfull \hbox with a tabular TikZ

Compiling my .tex file in TeXnicCenter,

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{arrows.meta,decorations.markings}

\tikzset{->-/.style={semithick,decoration={
markings,
mark=at position .52 with {\arrow{Stealth[length=2.5mm]}}},
postaction={decorate}}}

\tikzset{--<--/.style={semithick,decoration={
markings,
mark=at position .28 with {\arrow{Stealth[length=2.5mm]}}},
postaction={decorate}}}

\begin{document}

\begin{tabular}{cp{1cm}c}
$A_1=\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}$; &  &
$\Gamma(A_1)\equiv \;\;\;\;\;$

\begin{minipage}{1cm}

\begin{tikzpicture}[scale=0.725]

\coordinate [label=below left:$P_1$] (p1) at (0,0);
\coordinate [label=below right:$P_2$] (p2) at (6cm,0);

\draw[->-] (0,0) to [bend left] (6cm,0);

\draw[->-] (p1) to [bend left] (p2);

\draw[->-] (p2) to [bend left] (p1);

\draw[--<--,rotate=60] (p2) arc (360:0:-1cm and -0.5cm);

\draw[--<--,rotate=120] (p1) arc (0:360:-1cm and -0.5cm);

\end{tikzpicture}

\end{minipage}

\end{tabular}

\end{document}


you get 1 bad box and the following message in Build Output:

pdflatex> Overfull \hbox (147.05411pt to wide) in paragraph at line 50--51


How can I get rid of them without removing the tabular?

• you declare the width of the minipage to be 1cm, however image inside is at least 6cm wide. consequently you receive mentioned warning. welcome to tex.se! – Zarko May 16 '18 at 15:12

You do not need the minipage, I think. The complaint was because the minipage was not wide enough to fit the picture, as pointed out by Zarko.

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{arrows.meta,decorations.markings}

\tikzset{->-/.style={semithick,decoration={
markings,
mark=at position .52 with {\arrow{Stealth[length=2.5mm]}}},
postaction={decorate}}}

\tikzset{--<--/.style={semithick,decoration={
markings,
mark=at position .28 with {\arrow{Stealth[length=2.5mm]}}},
postaction={decorate}}}

\begin{document}

\begin{tabular}{cp{1cm}c}
$A_1=\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}$; &  &
$\Gamma(A_1)\equiv \;\;\;\;\;$

%\begin{minipage}{1cm}

\begin{tikzpicture}[scale=0.725,baseline=(p1)]

\coordinate [label=below left:$P_1$] (p1) at (0,0);
\coordinate [label=below right:$P_2$] (p2) at (6cm,0);

\draw[->-] (0,0) to [bend left] (6cm,0);

\draw[->-] (p1) to [bend left] (p2);

\draw[->-] (p2) to [bend left] (p1);

\draw[--<--,rotate=60] (p2) arc (360:0:-1cm and -0.5cm);

\draw[--<--,rotate=120] (p1) arc (0:360:-1cm and -0.5cm);

\end{tikzpicture}

%\end{minipage}

\end{tabular}

\end{document}


And actually I would not use a tabular either. And I add some other features, some of which are suggested by Zarko (Thanks!).

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{arrows.meta,decorations.markings}

\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
arc arrow/.style args={%
to pos #1 with length #2}{
decoration={
markings,
mark=at position 0 with {\pgfextra{%
\pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
\xdef\tmpArrowTime{\tmpArrowTime}}},
mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
mark=at position {#1} with {\coordinate(@4);
\draw[-{Stealth[length=#2,bend]}]
(@1) .. controls (@2) and (@3) .. (@4);},
},
postaction=decorate,
}
}

\tikzset{->-/.style={semithick,arc arrow={to pos 0.52 with length 2.5mm}}}

\tikzset{--<--/.style={semithick,arc arrow={to pos 0.28 with length 2.5mm}}}
\begin{document}

$A_1=\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \quad\text{with}~ \Gamma(A_1)\equiv \quad \begin{tikzpicture}[scale=0.725,baseline=(p1)] \coordinate [label=below left:P_1] (p1) at (0,0); \coordinate [label=below right:P_2] (p2) at (6cm,0); \filldraw (p1) circle [radius=0.08cm] (p2) circle [radius=0.08cm]; \draw[->-] (p1) to [bend left] (p2); \draw[->-] (p1) to [bend left] (p2); \draw[->-] (p2) to [bend left] (p1); \draw[--<--,rotate=60] (p2) arc (360:0:-1cm and -0.5cm); \draw[--<--,rotate=120] (p1) arc (0:360:-1cm and -0.5cm); \end{tikzpicture}$

\end{document}


Other options to center the tikzpicture include wrapping it into \vcenter{\hbox{...}}.

• @Zarko Thanks! There are additional improvements possible, I think, but the output is already decent, so why changing a code the OP created and is comfortable with? – user121799 May 16 '18 at 15:38
• you are right. actually, i'm surprised that y comment appear. at writing it some magic happens and and i lost it on my screen, so i believe, that it is not uploaded ... anyway, i will delete it now. – Zarko May 16 '18 at 15:43
• @Zarko Thanks again. I added some of your suggestions.... – user121799 May 16 '18 at 15:47
• How could I remove the bad box with my minipage? – Ignacio T May 16 '18 at 16:06
• @IgnacioT I guess you only need to make it wider, e.g. \begin{minipage}{7cm} or so. But why do you want to keep it? – user121799 May 16 '18 at 16:10