# Space after semicolon

\documentclass{beamer}

\begin{document}
\begin{frame}{Mutual Information}
\begin{align}
I(X;Y)&=H\left( {X} \right) -H\left( {X\mid Y} \right)\\
I(X{;}Y)&=H\left( {X} \right) -H\left( {X\mid Y} \right)
\end{align}

\end{frame}

\end{document}

In my opinion, the second equation is right but I prefer to write the first. Is it possible automatically?

-

It's easy to do it; but of course this changes all spacing around the semicolon in math mode. I left the second row for comparison.

\documentclass{beamer}

% punctuation is type 6
\mathcode;=\numexpr\mathcode;-"6000

\begin{document}

\begin{frame}{Mutual Information}

\begin{align}
I(X;Y)&=H(X) - H(X\mid Y)\\
I(X{;}Y)&=H(X) - H(X\mid Y)
\end{align}

\end{frame}

\end{document}

Note that your usage of \left and \right is wrong: there's no need for them here; also bracing the inner expressions is redundant.

-
thanks for your answer. I know my usage of \left and \right it´s not necessary. I think there is a problem with the space after comma and semicolon in math mode. Your answer is a possible solution. Thanks again. – jpayansomet Jan 29 at 23:11
@jpayansomet By default, the semicolon is considered a punctuation symbol, like the comma, so it's followed by a thin space. The trick in my answer changes the setting, making the semicolon into an ordinary symbol – egreg Jan 29 at 23:22
{@greg}, the same problem happens with the symbol \mid. It is normal to use it like 'conditional probability', for example. It is possible to use the same trick? How? – jpayansomet Jan 29 at 23:38
@jpayansomet You can use |, but I don't think the result is good and I'd much prefer \mid. – egreg Jan 29 at 23:39
@jpayansomet \renewcommand{\mid}{|} – egreg Jan 29 at 23:45