1

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 .)

enter image description here

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?

Here is some more information about the document I am writing:

\documentclass[%
    a4paper,
    corpo=12pt,
    oneside,
    stile=standard,
    tipotesi=magistrale,
    numerazioneromana, % roman numbering for appendixes and preambles, up to Table of Contents
    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{adjustbox}
\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}
4
  • 6
    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
  • 2
    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
  • Thanks for your comments. I am using a template I found on Overleaf. I'll add some more information about it in the original post! – Robb1 Jun 24 '20 at 15:51
4

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,
    numerazioneromana, % roman numbering for appendixes and preambles, up to Table of Contents
    openright,
    cucitura=7mm,
]{toptesi}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{adjustbox}
\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.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.