Overfull \hbox (124.69516pt too wide) in paragraph in a table

I'm making a table with the following code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\author{That's me}
\date{March 2018}
\setlength{\parindent}{0pt}
\begin{document}

\maketitle
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c c||}
\hline
Instruction & Mode & \#cycles without prefetch & \#cycles with prefetch & \#memory accesses \\ [0.5ex]
\hline\hline
ADD $R_i$ expr & 6 & 87837 & 787 & pototo \\
LOAD $R_i$ [expr] & 7 & 78 & 5415 & pototo\\
XOR $R_i$ [expr] & 545 & 778 & 7507 & pototo\\
STOR $R_i$ [expr] & 545 & 18744 & 7560 & pototo \\
BEQ disp (not taken) & 88 & 788 & 6344 & pototo \\
BEQ disp (taken) & 88 & 788 & 6344 & pototo\\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
\end{document}


But getting the following error \hbox (124.69516pt too wide) and therefore the table isn't showing.

I checked these two questions but the solution didn't work for me. This one and This one

Edit: the whole code so that Phelype Oleinik can check it:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\author{That's me}
\date{March 2018}
\setlength{\parindent}{0pt}
\newcommand{\tblmultiline}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\begin{document}
\pagenumbering{gobble}

\maketitle

\textbf{2.1.b)} normal text
\\

\textbf{2.1.c)} Normal text
\\

\textbf{2.1.d)} Normal text and some code. Here's the code: \\

SigmaA $<-$ IR.val(Bbus) \\
\{ SigA = IR.val \} \\
SigmaR $<-$ RAM[SigmaA] \\
\{ SigA = IR.val, SigR = RAM \} \\
SigmaW, CC $<-$ RA(Abus) + SigmaR(Bbus), ALU.cc \\
\{ SigA = IR.val, SigR = RAM[IR.val], CC = ALU.cc, SigW = RA+RAM[IR.val]\} \\
RAM[SigmaA] $<-$ SigmaW \\
\{RAM[IR.val] = RAM[IR.val] + RA \} \\

\textbf{2.3.c)}

\begin{table}[h!]
\centering
\begin{tabular}{||c c c c c||}
\hline
Instruction & Mode & \tblmultiline{\#cycles\\without\\prefetch} &     \tblmultiline{\#cycles\\with\\prefetch} & \tblmultiline{\#memory\\accesses} \\    [0.5ex]
\hline\hline
ADD $R_i$ expr & 6 & 87837 & 787 & pototo \\
LOAD $R_i$ [expr] & 7 & 78 & 5415 & pototo\\
XOR $R_i$ [expr] & 545 & 778 & 7507 & pototo\\
STOR $R_i$ [expr] & 545 & 18744 & 7560 & pototo \\
BEQ disp (not taken) & 88 & 788 & 6344 & pototo \\
BEQ disp (taken) & 88 & 788 & 6344 & pototo\\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}

\end{document}


I'm using sharelatex.com if that's relevant at all.

• An overfull hbox mean that something is extrapolating the document margins. In this case, your table is too wide because of its headers. – Phelype Oleinik Mar 19 '18 at 18:39
• @PhelypeOleinik how do i fix that? – Does it matter Mar 19 '18 at 18:40

An "overfull hbox" basically means that something is extrapolating the text margins, in this case, the table. To save it you can increase the limit of extrapolation that TeX allows (not recommended), or shrink the faulty line (table) to fit in the margins.

Your table is too wide because of its headers. I used a \tblmultiline comman to split them into multiple lines to fit in the page:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\author{That's me}
\date{March 2018}
\setlength{\parindent}{0pt}
\newcommand{\tblmultiline}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\begin{document}
\pagenumbering{gobble}

\maketitle
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c c||}
\hline
Instruction & Mode & \tblmultiline{\#cycles\\without\\prefetch} & \tblmultiline{\#cycles\\with\\prefetch} & \tblmultiline{\#memory\\accesses} \\[0.5ex]
\hline\hline
ADD $R_i$ expr & 6 & 87837 & 787 & pototo \\
LOAD $R_i$ [expr] & 7 & 78 & 5415 & pototo\\
XOR $R_i$ [expr] & 545 & 778 & 7507 & pototo\\
STOR $R_i$ [expr] & 545 & 18744 & 7560 & pototo \\
BEQ disp (not taken) & 88 & 788 & 6344 & pototo \\
BEQ disp (taken) & 88 & 788 & 6344 & pototo\\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
\end{document}

• I copied your solution but it still doesn't work. Am i missing something? – Does it matter Mar 19 '18 at 18:47
• @AbdulMalekAltawekji What doesn't work? I compiled the exmaple code and there are no warnings. If you're using the table in a large document, did you remember to copy the line that says \newcommand{\tblmultiline}...? – Phelype Oleinik Mar 19 '18 at 18:49
• Yes i did but oddly enough the table is not visible but i'm getting no warnings – Does it matter Mar 19 '18 at 18:50
• @AbdulMalekAltawekji Very strange... Can you share the whole code you're using for me to see why the table isn't showing? If not, try removing parts of the code until there is enough to show the problem. – Phelype Oleinik Mar 19 '18 at 18:54
• @AbdulMalekAltawekji The definition of \tblmultiline in the code you posted was missing a ]. I edited your question to fix it. Other than that, it works fine. Here is the result. – Phelype Oleinik Mar 19 '18 at 19:06