[Tex/LaTex] inline equation outside margin

equationsinline()line-breaking

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}

Best Answer

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

enter image description here

or as Stephan Lehmke suggested, use display math:

enter image description here

References:

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}
Related Question