TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
\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?

share|improve this question
up vote 6 down vote accepted

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.

enter image description here

share|improve this answer
    
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
1  
@jpayansomet \renewcommand{\mid}{|} – egreg Jan 29 at 23:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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