LaTeX 작성법
in Tip on Other Tips
Overview
LaTeX는 문서 작성 도구의 일종으로, 논문이나 출판물 등의 특수 형식 문서를 작성하는데 쓰인다.
LaTeX
레이텍 혹은 라텍이라고 읽는다. 이렇게 읽는 이유는 LaTeX의 모체인 TeX의 X가 라틴 문자 X(엑스)가 아닌 그리스 문자 X(키, 카이)를 뜻하기 때문이다.
따라서 조사를 붙일 때도 ‘LaTeX는’, ‘LaTeX를’이 아닌 ‘LaTeX은’, ‘LaTeX을’이라고 해야 맞다.
LaTeX는 직접 사용하기 어려운 TeX를 좀 더 쉽게 쓸 수 있도록 만들어진 매크로 집합이라고 볼 수 있다.
입출력 예시
아래는 LaTeX 입력의 예이다.
\documentclass[12pt]{article}
\usepackage{amsmath}
\title{\LaTeX}
\date{}
\begin{document}
\maketitle
\LaTeX{} is a document preparation system for the \TeX{}
typesetting program. It offers programmable desktop publishing
features and extensive facilities for automating most aspects of
typesetting and desktop publishing, including numbering and
cross-referencing, tables and figures, page layout, bibliographies,
and much more. \LaTeX{} was originally written in 1984 by Leslie
Lamport and has become the dominant method for using \TeX; few
people write in plain \TeX{} anymore. The current version is
\LaTeX2e.
% This is a comment; it will not be shown in the final output.
% The following shows a little of the typesetting power of LaTeX:
\begin{align}
E &= mc^2 \\
m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}
\end{align}
\end{document}
이 입력은 다음과 같이 출력된다.
특수문자 작성법
구별부호
\dot{a}, \ddot{a}, \acute{a}, \grave{a} | \(\dot{a}, \ddot{a}, \acute{a}, \grave{a}\) |
\check{a}, \breve{a}, \tilde{a}, \bar{a} | \(\check{a}, \breve{a}, \tilde{a}, \bar{a}\) |
\hat{a}, \widehat{a}, \vec{a} | \(\hat{a}\), \(\widehat{a}\), \(\vec{a}\) |
산술함수
\exp_a b = a^b, \exp b = e^b, 10^m | \(\exp_a b = a^b, \exp b = e^b, 10^m\) |
\ln c, \lg d = \log e, \log_{10} f | \(\ln c, \lg d = \log e, \log_{10} f\) |
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f | \(\sin a, \cos b, \tan c, \cot d, \sec e, \csc f\) |
\arcsin h, \arccos i, \arctan j | \(\arcsin h, \arccos i, \arctan j\) |
\sinh k, \cosh l, \tanh m, \coth n | \(\sinh k, \cosh l, \tanh m, \coth n\) |
\operatorname{sh}\,k, \operatorname{ch}\,l, \operatorname{th}\,m, \operatorname{coth}\,n | \(\operatorname{sh}\,k\), \(\operatorname{ch}\,l\), \(\operatorname{th}\,m\), \(\operatorname{coth}\,n\) |
\operatorname{argsh}\,o, \operatorname{argch}\,p, \operatorname{argth}\,q | \(\operatorname{argsh}\,o\), \(\operatorname{argch}\,p\), \(\operatorname{argth}\,q\) |
\sgn r, \left\vert s \right\vert | \(\sgn r\), \(\left\vert s \right\vert\) |
\min(x,y), \max(x,y) | \(\min(x,y), \max(x,y)\) |
상한과 하한
\min x, \max y, \inf s, \sup t | \(\min x, \max y, \inf s, \sup t\) |
\lim u, \liminf v, \limsup w | \(\lim u, \liminf v, \limsup w\) |
\dim p, \deg q, \det m, \ker\phi | \(\dim p, \deg q, \det m, \ker\phi\) |
투영
\Pr j, \hom l, \lVert z \rVert, \arg z | \(\Pr j, \hom l, \lVert z \rVert, \arg z\) |
미분
dt, \operatorname{d}\!t, \partial t, \nabla\psi | \(dt\), \(\operatorname{d}\!t\), \(\partial t\), \(\nabla\psi\) |
dy/dx, \operatorname{d}\!y/\operatorname{d}\!x, {dy \over dx}, {\operatorname{d}\!y\over\operatorname{d}\!x}, {\partial^2\over\partial x_1\partial x_2}y | \(dy/dx\), \(\operatorname{d}\!y/\operatorname{d}\!x\), \({dy \over dx}\), \({\operatorname{d}\!y\over\operatorname{d}\!x}\), \({\partial^2\over\partial x_1\partial x_2}y\) |
\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y | \(\prime\), \(\backprime\), \(f^\prime\), \(f'\), \(f''\), \(f^{(3)}\), \(\dot y\), \(\ddot y\) |
유사 문자 기호
\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar | \(\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar\) |
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS | \(\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS\) |
모듈러 연산
s_k \equiv 0 \pmod{m} | \(s_k \equiv 0 \pmod{m}\) |
a\,\bmod\,b | \(a\,\bmod\,b\) |
\gcd(m, n), \operatorname{lcm}(m, n) | \(\gcd(m, n)\), \(\operatorname{lcm}(m, n)\) |
\mid, \nmid, \shortmid, \nshortmid | \(\mid, \nmid, \shortmid, \nshortmid\) |
근호
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} | \(\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2}\) |
조합론
{}_n\mathrm{P}_{k} , _{n}\mathrm{C}_{k} , _{n}\mathrm{\pi}_{k}, _{n}\mathrm{H}_{k}, P(n,k), S(n,k), \mathrm{P}_{k}^{n} | \({}_n\mathrm{P}_{k} , _{n}\mathrm{C}_{k} , _{n}\mathrm{\pi}_{k}, _{n}\mathrm{H}_{k}, P(n,k), S(n,k), \mathrm{P}_{k}^{n}\) |
연산자
+, -, \pm, \mp, \dotplus | \(+, -, \pm, \mp, \dotplus\) |
\times, \div, \divideontimes, /, \backslash | \(\times, \div, \divideontimes, /, \backslash\) |
\cdot, * \ast, \star, \circ, \bullet | \(\cdot, * \ast, \star, \circ, \bullet\) |
\boxplus, \boxminus, \boxtimes, \boxdot | \(\boxplus, \boxminus, \boxtimes, \boxdot\) |
\oplus, \ominus, \otimes, \oslash, \odot | \(\oplus, \ominus, \otimes, \oslash, \odot\) |
\circleddash, \circledcirc, \circledast | \(\circleddash, \circledcirc, \circledast\) |
\bigoplus, \bigotimes, \bigodot | \(\bigoplus, \bigotimes, \bigodot\) |
집합
\{ \}, \O \empty \emptyset, \varnothing | \(\{ \}\), \(\O\), \(\empty\), \(\emptyset\), \(\varnothing\) |
\in, \notin \not\in, \ni, \not\ni | \(\in\), \(\notin\), \(\not\in\), \(\ni\), \(\not\ni\) |
\cap, \Cap, \sqcap, \bigcap | \(\cap , \Cap, \sqcap, \bigcap\) |
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus | \(\cup , \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus\) |
\setminus, \smallsetminus, \times | \(\setminus , \smallsetminus, \times\) |
\subset, \not\subset, \Subset, \sqsubset | \(\subset\), \(\not\subset\), \(\Subset\), \(\sqsubset\) |
\supset, \not\supset, \Supset, \sqsupset | \(\supset\), \(\not\supset\), \(\Supset\), \(\sqsupset\) |
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq | \(\subseteq , \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq\) |
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq | \(\supseteq , \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq\) |
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq | \(\subseteqq , \nsubseteqq, \subsetneqq, \varsubsetneqq\) |
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq | \(\supseteqq , \nsupseteqq, \supsetneqq, \varsupsetneqq\) |
관계
=, \ne, \neq, \equiv, \not\equiv | \(=\), \(\ne\), \(\neq\), \(\equiv\), \(\not\equiv\) |
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, := | \(\doteq\), \(\doteqdot\), \(\overset{\underset{\mathrm{def}}{}}{=}\), \(:=\) |
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong | \(\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong\) |
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto | \(\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto\) |
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot | \(<\), \(\nless\), \(\ll\), \(\not\ll\), \(\lll\), \(\not\lll\), \(\lessdot\) |
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot | \(>\), \(\ngtr\), \(\gg\), \(\not\gg\), \(\ggg\), \(\not\ggg\), \(\gtrdot\) |
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq | \(\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq\) |
\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq | \(\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq\) |
\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless | \(\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless\) |
\leqslant, \nleqslant, \eqslantless | \(\leqslant, \nleqslant, \eqslantless\) |
\geqslant, \ngeqslant, \eqslantgtr | \(\geqslant, \ngeqslant, \eqslantgtr\) |
\lesssim, \lnsim, \lessapprox, \lnapprox | \(\lesssim, \lnsim, \lessapprox, \lnapprox\) |
\gtrsim, \gnsim, \gtrapprox, \gnapprox | \(\gtrsim, \gnsim, \gtrapprox, \gnapprox\) |
\prec, \nprec, \preceq, \npreceq, \precneqq | \(\prec, \nprec, \preceq, \npreceq, \precneqq\) |
\succ, \nsucc, \succeq, \nsucceq, \succneqq | \(\succ, \nsucc, \succeq, \nsucceq, \succneqq\) |
\preccurlyeq, \curlyeqprec | \(\preccurlyeq, \curlyeqprec\) |
\succcurlyeq, \curlyeqsucc | \(\succcurlyeq, \curlyeqsucc\) |
\precsim, \precnsim, \precapprox, \precnapprox | \(\precsim, \precnsim, \precapprox, \precnapprox\) |
\succsim, \succnsim, \succapprox, \succnapprox | \(\succsim, \succnsim, \succapprox, \succnapprox\) |
기하
\parallel, \nparallel, \shortparallel, \nshortparallel | \(\parallel, \nparallel, \shortparallel, \nshortparallel\) |
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ | \(\perp, \angle, \sphericalangle, \measuredangle, 45^\circ\) |
\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar | \(\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar\) |
\bigcirc, \triangle \bigtriangleup, \bigtriangledown | \(\bigcirc, \triangle \bigtriangleup, \bigtriangledown\) |
\vartriangle, \triangledown | \(\vartriangle, \triangledown\) |
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright | \(\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright\) |
\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \stackrel\frown{AB} | \(\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \stackrel\frown{AB}\) |
논리
\forall, \exists, \nexists | \(\forall, \exists, \nexists\) |
\therefore, \because, \And | \(\therefore\), \(\because\), \(\And\) |
\or \lor \vee, \curlyvee, \bigvee | \(\or\), \(\lor\), \(\vee\), \(\curlyvee\), \(\bigvee\) |
\and \land \wedge, \curlywedge, \bigwedge | \(\and\), \(\land\), \(\wedge\), \(\curlywedge\), \(\bigwedge\) |
\lnot \neg, \not\operatorname{R}, \bot, \top | \(\lnot\), \(\neg\), \(\not\operatorname{R}\), \(\bot\), \(\top\) |
\vdash \dashv, \vDash, \Vdash, \models | \(\vdash \dashv, \vDash, \Vdash, \models\) |
\Vvdash \nvdash \nVdash \nvDash \nVDash | \(\Vvdash \nvdash \nVdash \nvDash \nVDash\) |
\ulcorner \urcorner \llcorner \lrcorner | \(\ulcorner \urcorner \llcorner \lrcorner\) |
화살표
\Rrightarrow, \Lleftarrow | \(\Rrightarrow, \Lleftarrow\) |
\Rightarrow, \nRightarrow, \Longrightarrow \implies | \(\Rightarrow\), \(\nRightarrow\), \(\Longrightarrow\) \(\implies\) |
\Leftarrow, \nLeftarrow, \Longleftarrow | \(\Leftarrow\), \(\nLeftarrow\), \(\Longleftarrow\) |
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff | \(\Leftrightarrow\), \(\nLeftrightarrow\), \(\Longleftrightarrow\)\iff$$ |
\Uparrow, \Downarrow, \Updownarrow | \(\Uparrow, \Downarrow, \Updownarrow\) |
\rightarrow \to, \nrightarrow, \longrightarrow | \(\rightarrow \to, \nrightarrow, \longrightarrow\) |
\leftarrow \gets, \nleftarrow, \longleftarrow | \(\leftarrow \gets, \nleftarrow, \longleftarrow\) |
\leftrightarrow, \nleftrightarrow, \longleftrightarrow | \(\leftrightarrow, \nleftrightarrow, \longleftrightarrow\) |
\uparrow, \downarrow, \updownarrow | \(\uparrow, \downarrow, \updownarrow\) |
\nearrow, \swarrow, \nwarrow, \searrow | \(\nearrow, \swarrow, \nwarrow, \searrow\) |
\mapsto, \longmapsto | \(\mapsto, \longmapsto\) |
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons | \(\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons\) |
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright | \(\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright\) |
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft | \(\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft\) |
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow | \(\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow\) |
특수
\amalg \P \S \% \dagger \ddagger \ldots \cdots | \(\amalg \P \S \%\), \(\dagger\), \(\ddagger\), \(\ldots\), \(\cdots\) |
\smile \frown \wr \triangleleft \triangleright | \(\smile \frown \wr \triangleleft \triangleright\) |
한글
\text{한 글 } | \(\text{한 글 }\) |
삭제 표시
\cancel{1} | \(\cancel{1}\) |
색깔
{\color{Blue}x^2}+{\color{Red}2x}-{\color{Green}1} | \({\color{Blue}x^2}+{\color{Red}2x}-{\color{Green}1}\) |
기타
\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes | \(\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes\) |
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq | \(\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq\) |
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork | \(\intercal \barwedge \veebar \doublebarwedge \between \pitchfork\) |
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright | \(\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright\) |
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq | \(\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq\) |
위, 아래, 전치, 후치 첨자
기능 | 문법 | 문서에서 보이는 식 |
---|---|---|
위 첨자 | a^2 | \(a^2\) |
아래 첨자 | y_m | \(y_m\) |
x_s-x_D | \(x_s-x_D\) | |
다문자 첨자 | a^{2+2} | \(a^{2+2}\) |
a_{i,j} | \(a_{i,j}\) | |
위 아래 첨자 동시에 | x_2^3 | \(x_2^3\) |
위 가운데 첨자 | \overset{x}{P} | \(\overset{x}{P}\) |
전치 위, 아래 첨자 동시에 | {}_{b}^{a}X | \({}_{b}^{a}X\) |
전,후치,위,아래 첨자 동시에 | _{c}^{a}Z_{d}^{b} | \(_{c}^{a}Z_{d}^{b}\) |
전,후치,가운데,위,아래 첨자 동시에 | \underset{y}{\overset{x}{_{c}^{a}Z_{d}^{b}}} | \(\underset{y}{\overset{x}{_{c}^{a}Z_{d}^{b}}}\) |
미분 (옳음) | x' | \(x'\) |
미분 (HTML의 경우 틀림) | x^\prime | \(x^\prime\) |
미분 (PNG의 경우 틀림) | x\prime | \(x\prime\) |
시그마 | \sum_{k=1}^N k^2 | \(\sum_{k=1}^N k^2\) |
곱기호 | \prod_{i=1}^N x_i | \(\prod_{i=1}^N x_i\) |
극한 | \lim_{n \to \infty}x_n | \(\lim_{n \to \infty}x_n\) |
적분 | \int_{-N}^{N} e^x\, dx | \(\int_{-N}^{N} e^x\, dx\) |
선적분 | \oint_{C} x^3\, dx + 4y^2\, dy | \(\oint_{C} x^3\, dx + 4y^2\, dy\) |
분수, 행렬, 여러행
기능 | 문법 | 문서에서 보이는 식 |
---|---|---|
분수 | \frac{2}{4} or {2 \over 4} | \(\frac{2}{4} or {2 \over 4}\) |
이항 계수 | {n \choose k} | \({n \choose k}\) |
행렬 | \begin{pmatrix} x & y \\ z & v \end{pmatrix} | \(\begin{pmatrix} x & y \\ z & v \end{pmatrix}\) |
\begin{bmatrix}0 & \cdots & 0 \\\vdots & \ddots & \vdots \\0 & \cdots & 0\end{bmatrix} | \(\begin{bmatrix}0 & \cdots & 0 \\\vdots & \ddots & \vdots \\0 & \cdots & 0\end{bmatrix}\) | |
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix} | \(\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}\) | |
\begin{vmatrix} x & y \\ z & v \end{vmatrix} | \(\begin{vmatrix} x & y \\ z & v \end{vmatrix}\) | |
\begin{Vmatrix} x & y \\ z & v \end{Vmatrix} | \(\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}\) | |
\begin{matrix} x & y \\ z & v \end{matrix} | \(\begin{matrix} x & y \\ z & v \end{matrix}\) | |
경우 나누기 | f(n)=\begin{cases}n/2, & \mbox{if }n\mbox{ is even} \\3n+1, & \mbox{if }n\mbox{ is odd}\end{cases} | \(f(n)=\begin{cases}n/2, & \mbox{if }n\mbox{ is even} \\3n+1, & \mbox{if }n\mbox{ is odd}\end{cases}\) |
두 줄 이상의 방정식 | \begin{matrix}f(n+1) &=& (n+1)^2 \\&=& n^2 + 2n + 1\end{matrix} | \(\begin{matrix}f(n+1) &=& (n+1)^2 \\&=& n^2 + 2n + 1\end{matrix}\) |