Math & ScienceLetters in different Styles inside an Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Letters in different Styles inside an Equation

Post by NELLLY »

Hi
when I typeset the following equation

Code: Select all

\begin{align*}
\displaystyle P(s'_{t+1}|s_t, a_t, o_{t+1})&=\frac{\rm
P(s'_{t+1},o_{t+1}|s_t,
a_t)}{\rm P(o_{t+1}|s_t, a_t)}\\
                             &=\frac{\rm P(o_{t+1}|s'_{t+1}, s_t,
                             a_t)}{\rm P(s'_{t+1}|s_t, a_t)}.
\end{align*}
The letters in the left side term are nice and in italic wherever the letters in the fractions of the right side are nor with the same style even if I use \displaystyle.
What should I do?
Last edited by NELLLY on Wed Aug 24, 2011 6:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Letters in different Styles inside an Equation

Post by localghost »

Please get used to always providing a complete example that is compilable for everybody as is. This increases your chance of getting help, especially when a problem becomes more complicated. You are not new to the forum so you should know that.

Regarding your problem, you can simply use the \dfrac command from amsmath to enable fractions in displayed math style.

Code: Select all

\documentclass[11pt]{article}
\usepackage{mathtools}   % loads »amsmath«

\begin{document}
  \begin{align*}
    P(s'_{t+1}|s_t, a_t, o_{t+1}) &= \dfrac{\mathrm{P}(s'_{t+1},o_{t+1}|s_t,a_t)}{\mathrm{P}(o_{t+1}|s_t, a_t)}\\
                                  &= \dfrac{\mathrm{P}(o_{t+1}|s'_{t+1},s_t,a_t)}{\mathrm{P}(s'_{t+1}|s_t, a_t)}.
  \end{align*}
\end{document}
Useful information about math typesetting can be found in the excellent »Math mode« document.

And by the way, you should not use obsolete LaTeX2.09 syntax for font styles in math mode. Use \mathrm{…} from LaTeX2e instead.


Thorsten
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Letters in different Styles inside an Equation

Post by NELLLY »

Hi
The problem still persist, the complete code is

Code: Select all

\documentclass [12pt]{report}
\usepackage[pdftex]{graphicx}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{titletoc}
%\usepackage{fancychapters}
\usepackage[Lenny]{fncychap}
\usepackage{lettrine}
\usepackage{dropping}
\usepackage{float}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{amsmath,amssymb}
\usepackage{longtable}
\usepackage{booktabs}

\begin{document}

\begin{align*}
 P(s'_{t+1}|s_t, a_t, o_{t+1})&=\dfrac{\rm
P(s'_{t+1},o_{t+1}|s_t,
a_t)}{\rm P(o_{t+1}|s_t, a_t)}\\
&=\dfrac{\rm P(o_{t+1}|s'_{t+1}, s_t, a_t)}{\rm P(s'_{t+1}|s_t,
a_t)}.
\end{align*}
\end{document}



User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Letters in different Styles inside an Equation

Post by Stefan Kottwitz »

Hi,

of course it persists, because you still use the obsolete \rm command. That's why the symbols are roman, not italic. Just remove \rm.

Stefan
LaTeX.org admin
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: Letters in different Styles inside an Equation

Post by NELLLY »

This is perfect now, many thanks.
Post Reply