2

Anybody knows how to make this long equation look neat in LaTeX? Many thanks!

enter image description here

\documentclass[12pt]{article}

\begin{document}
\begin{equation} 
t_p= \left\{ \begin{array}{ll} 
1 & D=0 \\ 
1-(Credit_{fed}^L+Credit_{provin}^L) & 0<D\leq 200 \\ 
200*[1-(Credit_{fed}^L+Credit_{provin}^L)]
+(D-200)*[1-(Credit_{fed}^H+Credit_{provin}^H)] & D>200 
\end{array} \right. 
\end{equation} 
\end{document} 
  • 1
    Welcome to Maths SX! Could you post a full compilable code, as a starting point? – Bernard Nov 29 '17 at 0:05
  • 4
    Start by using “C” instead of “Credit”. – egreg Nov 29 '17 at 0:07
  • 1
    You should edit your question and insert this code therein. B.t.w. what are your document class, paper format, font size, &c.? – Bernard Nov 29 '17 at 0:20
  • \documentclass[12pt]{article} – user149250 Nov 29 '17 at 0:23
2

If you want the variable names Credit, fed and provin to be in italics, use \mathit{Credit}, etc. Or \mathrm{Credit} for Roman.

Since you have a complicated repeated expression, I suggest you define a function C(K) to simplify your definition of t_p. I use the cases environment from the amsmath package.

enter image description here

Here is the code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
Let $C(K)=\mathit{Credit}_{\mathit{fed}}^K+\mathit{Credit}_{\mathit{provin}}^K$. Then
\begin{equation}
t_p=\begin{cases}
    1 & D=0 \\ 
    1-C(L) & 0<D\leq 200 \\ 
    200\big(1-C(L)\big)+(D-200)\big(1-C(H)\big) & D>200 
\end{cases}
\end{equation}
\end{document}
| improve this answer | |
  • It may seem strange, but we typically do not use comments for offering thanks. The way to show appreciation is by up-voting the answer or answers that you think are helpful. An answer that you feel best addresses your question should be "accepted". More information can be found here. – Sandy G Dec 4 '17 at 15:30
1

Something like this?

enter image description here

Observe the use of "roman", i.e., upright, lettering for the variable names 'Credit', 'fed', and 'provin'.

\documentclass[12pt]{article}
\newcommand\vn[1]{\mathrm{#1}} % "variable name"
\usepackage{mathtools} % for "dcases" environment
\begin{document}

\begin{equation} 
t_p= \begin{dcases} 
  1 & D=0 \\[1ex]
  1-(\vn{Credit}_{\vn{fed}}^L+\vn{Credit}_{\vn{provin}}^L) & 0<D\leq 200 \\[1ex]
  \begin{array}[b]{@{}r@{}}
200\phantom{)}[1-(\vn{Credit}_{\vn{fed}}^L+\vn{Credit}_{\vn{provin}}^L)]\\[1ex]
  {}+(D-200)[1-(\vn{Credi‌​t}_{\vn{fed}}^H+\vn{Credit}_{\vn{pr‌ovin}}^H)] 
  \end{array} & D>200 
\end{dcases}
\end{equation} 
\end{document}
| improve this answer | |
1

I propose this non-standard layout, with some shortcuts, based o, the empheq package and the alignedat environment:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{empheq}
\newcommand{\credit}{\mathrm{Credit}}
\newcommand{\fed}{\mathrm{fed}}
\newcommand{\provin}{\mathrm{provin}}

\begin{document}

\begin{empheq}[left = {t_p = \empheqlbrace}]{equation}
  \begin{alignedat}{4}
    & 1 &\hspace{1.5em}\text{if }&D=0, &\hspace{4em} &
    1-\bigl(\mathrm{Credit}_\mathrm{fed}^L + \mathrm{Credit}_\mathrm{provin}^L\bigr) &\qquad\text{if } & 0 <D\leq 200, \\[1.5ex] %
    & \mathrlap{\begin{aligned}[b] 200*\bigl[1&-\bigl(\credit_{\fed} ^L + \credit_{\provin}^L\bigr)\bigr] \\& + (D-200)*[1-\bigl(\credit_{\fed}^H + \credit_{\provin}^H\bigl)\bigr]\end{aligned}} & & & & & \quad\text{if } & D>200.
  \end{alignedat}
\end{empheq}

\end{document} 

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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