/
multilines.tex
247 lines (226 loc) · 5.81 KB
/
multilines.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
\documentclass[12pt,english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{relsize} % make some math large
\usepackage{bm} % make some math bold
\usepackage{bbm}
% url package
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
% Titling and Author
\title{Latex Example, Multiple Lines Equations}
\author{\href{https://fanwangecon.github.io/}{Fan Wang}\thanks{https://fanwangecon.github.io, repository: \href{https://fanwangecon.github.io/Tex4Econ/}{Tex4Econ}}}
\date{\today}
\begin{document}
\maketitle
\section{Indicator Function}
\begin{align}\label{eq:indi}
\begin{gathered}
\mathbbm{1}\left\{1 + 2 +3\right\}
\\
\mathlarger{\mathlarger{\mathlarger{
\mathbbm{1}
}}}
\left\{
\begin{array}{cc}
1 + 2 + 3\\
+ 4 + 5\\
> 0\\
\end{array}
\right\}
\\
\mathlarger{\mathlarger{\mathlarger{
\mathlarger{\mathlarger{\mathlarger{
\mathbbm{1}
}}}}}}
\left\{
\begin{array}{cc}
1 + 2 + 3\\
+ 4 + 5 + 6 \\
+ 7 + 8 + 9 \\
> 0\\
\end{array}
\right\}
\end{gathered}
\end{align}
\section{Multiple Lines of Equation}
Below, I demonstrate several possible ways of aligning and labeling four lines of equations. First, I label some of the four lines with own labels and align by equality sign. Second, we align by the equality sign but use one single label for all lines of equations. Third, we center align on page label each line using gather. Fourth, we center align on page with one label putting gather inside align.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% A.1 Align and Split
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\subsection{Align and Split}
\subsubsection{Align and Label Lines}
\begin{verbatim}
\begin{align}
x_1 =& 1 \label{eq:lineone}\\
x_2 =& 1 \nonumber\\
h(x) =& f(-20 + 15 + 17) \label{eq:linethree}\\
h(x) =& f(12) \approx 1 \label{eq:linefour}
\end{align}
\end{verbatim}
\begin{align}
x_1 =& 1 \label{eq:lineone}\\
x_2 =& 1 \nonumber\\
h(x) =& f(-20 + 15 + 17) \label{eq:linethree}\\
h(x) =& f(12) \approx 1 \label{eq:linefour}
\end{align}
\subsubsection{Align Split One Label}
\begin{verbatim}
\begin{align}\label{eq:split}
\begin{split}
x_1 &= 1 \\
y &= 1 \\
h(x) &= f(-20 + 10 + 20) \\
g(x) &= f(12) \approx 2
\end{split}
\end{align}
\end{verbatim}
\begin{align}\label{eq:split}
\begin{split}
x_1 &= 1 \\
y &= 1 \\
h(x) &= f(-20 + 10 + 20) \\
g(x) &= f(12) \approx 2
\end{split}
\end{align}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% A.2 Align and Gather
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\subsection{Align and Gather}
\subsubsection{Gather and Label Lines}
\begin{verbatim}
\begin{gather}
x_1 = 1 \label{eq:lineone}\\
x_2 = 1 \nonumber\\
h(x) = f(-20 + 15 + 17) \label{eq:linethree}\\
h(x) = f(12) \approx 1 \label{eq:linefour}
\end{gather}
\end{verbatim}
\begin{gather}
x_1 = 1 \label{eq:lineone}\\
x_2 = 1 \nonumber\\
h(x) = f(-20 + 15 + 17) \label{eq:linethree}\\
h(x) = f(12) \approx 1 \label{eq:linefour}
\end{gather}
\subsubsection{Align Gathered}
\begin{verbatim}
\label{eq:gathered}
\begin{gathered}
x_1 = 1 \\
x_2 = 1 \\
h(x) = f(-20 + 15 + 17) \\
h(x) = f(12) \approx 1
\end{gathered}
\end{verbatim}
\begin{align}
\label{eq:gathered}
\begin{gathered}
x_1 = 1 \\
x_2 = 1 \\
h(x) = f(-20 + 15 + 17) \\
h(x) = f(12) \approx 1
\end{gathered}
\end{align}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% B. Substack vs Array
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagebreak
\section{Substack vs Array}
\begin{verbatim}
\begin{align}
\begin{split}
\label{eq:Value}
v_{ih}\left(a,z\right)
=
\max_{
\substack{
c>0\\
a' \in \{0,[\bar{A}_{ih},\infty)\}
}
}
u\left(c\right)+ \beta \int v_{ih}\left(a',z'\right)f(z'|z)dz'\\
\label{eq:Value}
v_{ih}\left(a,z\right)
=
\max_{
\begin{array}{cc}
c>0\\
a' \in \{0,[\bar{A}_{ih},\infty)\}\\
\end{array}
}
u\left(c\right)+ \beta \int v_{ih}\left(a',z'\right)f(z'|z)dz'\\
\end{split}
\end{align}
\end{verbatim}
Using Substack, fonts are small under max:
\begin{align}
\begin{split}
\label{eq:Value}
v_{ih}\left(a,z\right)
=
\max_{
\substack{
c>0\\
a' \in \{0,[\bar{A}_{ih},\infty)\}
}
}
u\left(c\right)+ \beta \int v_{ih}\left(a',z'\right)f(z'|z)dz'\\
\end{split}
\end{align}
Using Array, fonts are larger under max:
\begin{align}
\begin{split}
\label{eq:Value}
v_{ih}\left(a,z\right)
=
\max_{
\begin{array}{cc}
c>0\\
a' \in \{0,[\bar{A}_{ih},\infty)\}\\
\end{array}
}
u\left(c\right)+ \beta \int v_{ih}\left(a',z'\right)f(z'|z)dz'\\
\end{split}
\end{align}
\pagebreak
\section{Multiple Lines}
\begin{verbatim}
\begin{align}
x = y + z +
\left\{
\begin{array}{l}
a \\
+ b \\
+ c \\
+ d \\
\end{array}
\right\}
\end{align}
\end{verbatim}
\begin{align}
x = y + z +
\left\{
\begin{array}{l}
a \\
+ b \\
+ c \\
+ d \\
\end{array}
\right\}
\end{align}
\section{Brackets}
Then in your document:
\[
\left(\rule{0cm}{2cm}
\frac{\prod_0^\infty k}{\sum_0^\infty n}
\right)
\]
\end{document}