# Why am I getting a vertical bar at the end of an equation?

I am using Overleaf to write an equation. This is the latex:

\begin{equation*}
P_{0}\equiv \mathbf{E}\left[ \left( X_{0}-\hat{X}_{0}\right) \left( X_{0}-%
\hat{X}_{0}\right) ^{\intercal }\right] =\mathbf{E}\left[ \left( X_{0}-%
\mathbf{E}\left[ X_{0}\right] \right) \left( X_{0}-\mathbf{E}\left[ X_{0}%
\right] \right) ^{\intercal }\right] \equiv Cov\left( X_{0},X_{0}\right) .
\end{equation*}


Why am I getting a vertical bar at the end of the equation? (right after the final .)

I thought this may be since the equation is exactly as wide as the page.

I tried splitting the equation in two lines and the bar disappears. Is there a way to keep everything on one line removing the vertical line?

\documentclass[%
a4paper,
corpo=12pt,
oneside,
stile=standard,
tipotesi=magistrale,
openright,
cucitura=7mm,
]{toptesi}

\begin{document}
% ...
\end{document}


Packages I am using:

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{hyperref}

\usepackage[hyperref=true,backref=true,backend=biber,maxbibnames=9,maxcitenames=2,style=numeric,citestyle=numeric,sorting=none]{biblatex}

\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{booktabs}
\usepackage[labelfont=bf]{caption}
\usepackage{csquotes}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage[
toc,
abbreviations,
nonumberlist,
]{glossaries-extra}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage{mathtools}
\usepackage{mfirstuc}
\usepackage[final]{microtype}
\usepackage{multirow}
\usepackage{nicefrac}
\usepackage{ragged2e}
\usepackage{siunitx}
\usepackage{subfig}
\usepackage{svg}
\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{url}
\usepackage{verbatim}
\usepackage{xcolor}

• You are not showing a complete code so we can only guess. My guess is that you probably have the option draft and a rather small value for \overfullrule. – campa Jun 24 '20 at 13:56
• Unrelated: mist of your \left...\right pairs are irrelevant here their scaling are not needed. Additionally have a look at \DeclareMathOperator\Cov{Cov} to define a proper \Cov command. – daleif Jun 24 '20 at 14:42
• The most straightforward way to make a complete document from your extract is to add \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} at the beginning and \end{document} at the end. That works fine and doesn't show any vertical bar, so more information (that is some other short complete document) from you is needed. – pst Jun 24 '20 at 15:12

I get no “bar”. But I get an “Overfull \hbox” message.

You can avoid it by properly writing the expression with no \left and \right that create too big delimiters and excess space.

It's probably better to split the long equation in parts, doing a favor to your readers who will see more clearly the steps.

\documentclass[%
a4paper,
corpo=12pt,
oneside,
stile=standard,
tipotesi=magistrale,
openright,
cucitura=7mm,
]{toptesi}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{booktabs}
\usepackage[labelfont=bf]{caption}
\usepackage{csquotes}
\usepackage{enumitem}
\usepackage{geometry}
\usepackage[
toc,
abbreviations,
nonumberlist,
]{glossaries-extra}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage{mathtools}
\usepackage{mfirstuc}
\usepackage[final]{microtype}
\usepackage{multirow}
\usepackage{nicefrac}
\usepackage{ragged2e}
\usepackage{siunitx}
\usepackage{subfig}
\usepackage{svg}
\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{url}
\usepackage[
hyperref=true,
backref=true,
backend=biber,
maxbibnames=9,
maxcitenames=2,
style=numeric,
citestyle=numeric,
sorting=none,
]{biblatex}

\usepackage{hyperref}

\begin{document}

\begin{equation*}
P_{0}
\equiv \mathbf{E}\bigl[(X_{0}-\hat{X}_{0}) (X_{0}-\hat{X}_{0})^{\intercal }\bigr]
=\mathbf{E}\bigl[(X_{0}-\mathbf{E}[X_{0}])(X_{0}-\mathbf{E}[X_{0}])^{\intercal}\bigr]
\equiv \operatorname{Cov}(X_{0},X_{0}) .
\end{equation*}

\begin{align*}
P_{0}
&\equiv \mathbf{E}\bigl[(X_{0}-\hat{X}_{0}) (X_{0}-\hat{X}_{0})^{\intercal }\bigr] \\
&=\mathbf{E}\bigl[(X_{0}-\mathbf{E}[X_{0}])(X_{0}-\mathbf{E}[X_{0}])^{\intercal}\bigr]\\
&\equiv \operatorname{Cov}(X_{0},X_{0}) .
\end{align*}

\end{document}


Do you really need all those packages? By the way, hyperref should go last. Particularly geometry sounds very strange with no option.

For the covariance operator, use \operatorname{Cov}; but if you use it several times, it's better to have

\DeclareMathOperator{\Cov}{Cov}


in the preamble and to use \Cov in the document.