# inline equation outside margin

My inline equation falls outside the margin. I was wondering if there is any solution for that? Here is the MWE:

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\begin{document}
where the first equality in \ref{inequality} follows from $\lceil\frac{s}% {t}\rceil=\lfloor\frac{s+t-1}{t}\rfloor$ for integer $s$ and $t$ and the
inequality follows from the feasibility condition. We also assume that the
item can be ordered at any day of the week and these orders arrive instantly.
For each day $t\in W$ define $p_{x,t,n,j} \left( \text{for all }x=0,\cdots,u_{j}\text{ }\text{and } n\in N_{x,t,j} \right)$ to be the joint probability of
\end{document}

-
Stuff enclosed in \left...\right can't be broken, so you're giving the paragraph formatter an impossible problem to solve. Either (a) use a displayed formula or (b) leave out \left and \right or (c) use \raggedright. –  Stephan Lehmke Nov 20 '12 at 6:13
… (d) without braces at all, (dd) $p_{x,t,n,j}$ for all $x=0,\cdots,u_{j}$ and $n\in N_{x,t,j}$, (e) combining (dd) and text braces. (Note, that your \left( hasn't a space preceding it.) –  Qrrbrbirlbel Nov 20 '12 at 6:30

One solution is to use the \bracr macro as below:

or as Stephan Lehmke suggested, use display math:

## CodeL

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,showframe]{geometry}

\makeatletter
\def\@BracContents{} % default (used by \suchthat)
\newcommand{\BracKern}{\kern-\nulldelimiterspace}
\newcommand{\@Brac}[3]{% #1,#3 = left/right bracket type
\ensuremath{%
\begingroup\def\@BracContents{#2}%
\mathopen{\left#1\vphantom{#2}\BracKern\right.}% left bracket
#2%  content
\mathclose{\left.\BracKern\vphantom{#2}\right#3}% right bracket
\endgroup%
}%
}
\newcommand{\bracr}[1]{\@Brac{(}{#1}{)}}%
\makeatother

\begin{document}
\section{Use macro:}
where the first equality in \ref{inequality} follows from $\lceil\frac{s}% {t}\rceil=\lfloor\frac{s+t-1}{t}\rfloor$ for integer $s$ and $t$ and the
inequality follows from the feasibility condition. We also assume that the
item can be ordered at any day of the week and these orders arrive instantly.
For each day $t\in W$ define $p_{x,t,n,j} \bracr{ \text{for all }x=0,\cdots,u_{j}\text{ }\text{and } n\in N_{x,t,j} }$ to be the joint probability of

\section{Display Math:}
where the first equality in \ref{inequality} follows from $\lceil\frac{s}% {t}\rceil=\lfloor\frac{s+t-1}{t}\rfloor$ for integer $s$ and $t$ and the
inequality follows from the feasibility condition. We also assume that the
item can be ordered at any day of the week and these orders arrive instantly.
For each day $t\in W$ define
$p_{x,t,n,j} \left( \text{for all }x=0,\cdots,u_{j}\text{ }\text{and } n\in N_{x,t,j} \right)$
to be the joint probability of
\end{document}

-
Thanks a lot; very insightful as always! This works. –  N Nik Nov 20 '12 at 17:31
For future reference: I used solution suggested by @egreg (solution). But for situations where egreg's solution don't apply, solution suggested by @ Peter works perfectly fine. Actually Peter's solution is more general. –  N Nik Nov 20 '12 at 17:34

The way you input the formula is questionable. Here is how I'd type it:

For each day $t\in W$ define $p_{x,t,n,j}$ (for all $x=0$,~\dots, $u_{j}$
and $n\in N_{x,t,j}$) to be the joint probability of


Those parentheses are not math and shouldn't be larger than usual. You are simply stating a side condition, just use alternating text and math.

-
Very good point @egreg. I fixed it. –  N Nik Nov 20 '12 at 17:31