Legendary LaTeX Turorial! Creator of tutorial: Thomaster
In this turorial, I will highlight begin and end tags in \(\sf\color{red}{red}\), commands in \(\sf\color{green}{green}\) and parameters in \(\sf\color{blue}{blue}\). Normal text is black. You can't copy these colored examples and use them because they won't work (they contain different symbols to make it possible to display them here without it being recognized as latex) So you'll have to type over everything.
\(\hspace{50pt}\Huge\sf \color{#730000}{Basic\ \LaTeX\ Layout}\) Always begin with \(\color{red}{\backslash(}\) and end with \(\color{red}{\backslash)}\) When you write your text between these two, it will be recognized as LaTeX \(\color{red}{\backslash(}\sf Hello~there!!!\color{red}{\backslash)}\) will look like: \(Hello there!!!\) The commands (or tags) in latex begin with a backslash and most of them also want parameters, which are enclosed in curly braces after the command. For example, write: \(\sf\color{red}{\backslash(}\color{green}{\backslash underline}\color{blue}{\{my\ first\ underlined\ text!\}} \color{red}{\backslash)}\) It will look like this: \(\underline{my first underlined text!}\) In LaTeX, you need to define spaces. You can use a single backslash followed by a space to induce spaces. So just type a single backslash\ after\ every\ word\ and you'll have text with spaces. You can also use a tilde (\(\sf\sim\)) to induce spaces. Now we write: \(\sf\color{red}{\backslash(}\color{green}{\backslash underline}\color{blue}{\{my\backslash~first\backslash~underlined\backslash~text!\}} \color{red}{\backslash)}\) It will look like this: \(\underline{my\ first\ underlined\ text!}\) When you use the tide, it will be \(\sf\color{red}{\backslash(}\color{green}{\backslash underline}\color{blue}{\{my\sim first\sim underlined\sim text!\}} \color{red}{\backslash)}\) Other ways to create spaces are: \(\backslash;\) = thick space \(\hspace{60 pt}~\to\sf M\;M\) \(\backslash\hspace{-2pt}:\) = medium space\(\hspace{51 pt}~\to\sf M\:M\) \(\backslash,\) = thin space\(\hspace{68 pt}~\to\sf M\,M\) \(\backslash!\) = negative space\(\hspace{51 pt}~\to\sf M\!M\) \(\backslash\sf quad\) = 1 em space\(\hspace{43 pt}~\to\sf M\quad M\) \(\backslash\sf qquad\) = 2 em space (2x \quad)\(~\to\sf M\qquad M\) For long white spaces, use: \(\sf\color{green}{\backslash hspace\color{blue}{\{x~pt\}}}\), where x is the length. Example: \(\color{red}{\backslash(}\sf Hello\color{green}{\backslash hspace}\color{blue}{\{100~pt\}}there!\color{red}{\backslash)}\) will be: \(Hello~\hspace{100 pt}there!\)
\(\hspace{80pt}\Huge\sf \color{#730000}{More\ fonts} \) Now this italic text is nice, but we can use way cooler fonts! The syntax for this is: \(\color{red}{\backslash(}\sf\color{green}{\backslash font}\color{blue}{~text }\color{red}{\backslash)}\) \(\sf\color{red}{\backslash(}\color{green}{\backslash bf}\color{blue}{~Hello\sim there!}\color{red}{\backslash)} Will become: \bf Hello\ there!\) \(\LARGE\sf Fonts\ you\ can\ use:\) \(\huge\sf\color{green}{\backslash sf} \hspace{19pt} \to ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash tt} \hspace{19pt} \to \tt ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash it} \hspace{21pt} \to \it ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash bf} \hspace{15pt} \to \bf ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash rm} \hspace{10pt} \to \rm ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash cal} \hspace{10pt} \to \cal ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash scr} \hspace{10pt} \to \scr ABCDEFabcdef123456\) \(\huge\sf\color{green}{\backslash frak} \to \frak ABCDEFabcdef123456\) \(\LARGE\sf There\ are\ 2\ exceptions: \) You need to add braces to these fonts in order to use them, so \(\bf\color{red}{\backslash(}\color{green}{\backslash mathbb\{}\color{blue}{text}\color{green}{\} }\color{red}{\backslash)} \) \(\LARGE\sf\color{green}{\backslash mathbb} \to \mathbb{ ABCDEFabcdef123456}\) \(\LARGE\sf\color{green}{\backslash boldsymbol} \to \boldsymbol{ ABCDEFabcdef123456}\) \(\Large\sf How\ to\ use\ 2\ fonts\ in\ 1\ line:\) When you type \sf, everything after that will become Sans-serif until you introduce another font command. So when you type: \(\color{red}{\backslash(}\sf\color{green}{\backslash sf}\color{blue}{~hello\sim everyone\sim i'm}\color{green}{\backslash cal}\color{blue}{~Thomaster!!}\color{red}{\backslash)}\) It will become: \(\sf hello\ everyone\ i'm\ \cal Thomaster!!\)
\(\hspace{80pt}\Huge\sf \color{#730000}{Change\ Sizes}\) In \(\LaTeX\) on QuestionCove, we can use a few different text sizes. The syntax for this is \(\bf\color{red}{\backslash(}\color{green}{\backslash size~}\color{blue}{text}\color{red}{\backslash)} \)(don't forget the space after the size tag) For\( \sf\color{green}{\backslash size}\) we can use the following 9 sizes: \begin{array}{ll} \large\sf\color{green}{\backslash tiny}&\Large\to\sf\tiny ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash scriptsize}&\Large\to\sf\scriptsize ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash small}&\Large\to\sf\small ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash normalsize}&\Large\to\sf\normalsize ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash large}&\Large\to\sf\large ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash Large}&\Large\to\sf\Large ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash LARGE}&\Large\to\sf\LARGE ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash huge}&\Large\to\sf\huge ABCDEFabcdef123456\\ \large\sf\color{green}{\backslash Huge}&\Large\to\sf\Huge ABCDEFabcdef123456\\ \end{array} You can use more sizes in 1 line. Everytime you introduce a new size text, everything after that will be in that size untill you introduce a new one. So \(\bf\color{red}{\backslash(}\color{green}{\backslash Huge~}\color{blue}{hello}\color{green}{\backslash small~}\color{blue}{every}\color{green}{\backslash LARGE~}\color{blue}{one}\color{red}{\backslash)}\) will output: \(\Huge hello\small every\LARGE one\)
\(\hspace{110pt}\Huge\sf \color{#730000}{Symbols}\) Syntax for symbols: \(\sf\color{red}{\backslash(}\color{green}{\backslash symbolcode} \color{red}{\backslash)}\) \begin{array}{|c|l|c|l|} \hline \large\sf symbol&\sf\large code&\sf\large symbol&\sf\large code\\\hline \large\leftarrow&\sf\backslash leftarrow&\large\rightarrow&\sf\backslash righttarrow\\\hline \large\Leftarrow&\sf\backslash Leftarrow&\large\Rightarrow&\sf\backslash Righttarrow\\\hline \large\longleftarrow&\sf\backslash longleftarrow&\large\large\longrightarrow&\sf\backslash longrighttarrow\\\hline \large\Longleftarrow&\sf\backslash Longleftarrow&\large\Longrightarrow&\sf\backslash Longrighttarrow\\\hline \large\leftrightarrow&\sf\backslash leftrightarrow&\large\Leftrightarrow&\sf\backslash Leftrightarrow\\\hline \large\longleftrightarrow&\sf\backslash longleftrightarrow&\Longleftrightarrow&\sf\backslash Longleftrightarrow\\\hline \large\uparrow&\sf\backslash uparrow&\large\downarrow&\sf\backslash downarrow\\\hline \large\leq&\sf\backslash leq&\large\geq&\sf\backslash geq\\\hline \large\ll&\sf\backslash ll&\large\gg&\sf\backslash gg\\\hline \large\approx&\sf\backslash approx&\large\neq&\sf\backslash neq\\\hline \large\pm&\sf\backslash pm&\large\div&\sf\backslash div\\\hline \large\sum&\sf\backslash sum&\large\infty&\sf\backslash infty\\\hline \large\diamondsuit&\sf\backslash diamondsuit&\large\heartsuit&\sf\backslash heartsuit\\\hline \large\triangle&\sf\backslash triangle&\large\Box&\sf\backslash Box\\\hline \large\LaTeX&\sf\backslash LaTeX&\large\bigstar&\sf\backslash bigstar\\\hline \end{array} Example of combination with size and color: \(\bf\color{red}{\backslash(}\color{green}{\backslash Huge}\color{green}{\backslash color\{\color{#8C00FF }{red}\}\{\color{blue}{\backslash sum}\}}\color{red}{\backslash)}~~\Large\longrightarrow~\Huge\color{red}{\sum} \) For more symbols, visit http://detexify.kirelabs.org/symbols.html All latex symbols are on that list but you can only use the mathmode symbols on QuestionCove.
\(\hspace{110pt}\Huge\sf \color{#730000}{Math}\) Some useful latex math stuff: \begin{array}{l|l|l} \hline \large\sf function&\sf\large preview&\sf\large code\\\hline\\ \sf fraction& \dfrac{1+2}{3+4} &\sf\backslash dfrac\{1+2\}\{3+4\} \\~\\ \sf square\ root&\large\sqrt{x+3}&\sf\backslash sqrt\{x+3\}\\~\\ \sf multiple\ root&\large\sqrt[3]{x+3}&\sf\backslash sqrt[3]\{x+3\}\\~\\ \sf limit & \large\lim_{x \to \infty}&\sf\backslash lim\_\{x ~\backslash to \backslash infty\} \\~\\ \sf power& \large5x^2 &\sf 5x\wedge 2 \\~\\ \sf indices&\large F_{(x)} &\sf F\_\{(x)\} \\~\\ \sf integral& \large\int_7^2 x &\sf\backslash int\_7\wedge2~ x \\~\\ \sf sum& \large\sum_{x=4}^{19} t_x &\sf\backslash sum\_\{x=4\}\wedge\{19\} ~t\_x \\~\\ \end{array}
\(\hspace{90pt}\Huge\sf \color{#730000}{Chemistry}\) For a chemical equation, you need mainly subscripts. Use the _ symbol to do this. When only 1 number is used as subscript, you can just write it as _3 (in case the number is 3) When more characters are used, you need to put them in curly braces, so _{12} Let's write a chemical equation: \(\sf\color{red}{\backslash(}\color{blue}{6CO\_2+6H\_2O\backslash to~C\_6H\_\{12\}O\_6+6O\_2}\color{red}{\backslash)}\) Will become: \(\sf\large 6CO_2+6H_2O ~\to~C_6H_{12}O_6+6O_2\) For nuclear equations, you can use subscripts and superscripts. When you write \(_5^2 x\), it will look like \(\large^2_5 x\) Don't forget to add braces for 2 or more characters. \(\sf\color{red}{\backslash(}\color{blue}{\_6\wedge{13}C + \_2\wedge4He \backslash to \large\_8\wedge{16}O+\_0\wedge1n}\color{red}{\backslash)} \) Will become: \(\sf\large_6^{13}C + _2^4He \to _8^{16}O+_0^1n\)
\(\hspace{100pt}\Huge\sf \color{#730000}{Tables}\) You can create tables with the \begin{array} tag First determine how many columns you want to have. For this example I use 5 columns After {array} you add a new parameter in curly braces, In this one you can set the table borders and the alignment The symbol | is used to create a vertical line in the table. Since I'm going to make 5 columns, I need 6 vertical lines. Now we have `\begin{array}{||||||}` {||||||} will be like this in the table: {|column 1|column 2|" 3|" 4|" 5|} We can set the alignment of the stuff in the column by placing a l, r or c between the || of the corresponding column. l = left, r = right and c = center To show the difference, i'll use {|l|c|r|c|l|}. So the first column will be aligned left, the second in the center and the middle one right. 4 center again and column 5 has left alignment. We'll begin with `\begin{array}{|l|c|r|c|l|}` To end the table, we use `\end{array}` The table content will be between these 2 tags. The last tag you need to know is `\hline`, this is a horizontal line which indicates a new row. `\begin{array}{|l|c|r|c|l|}` \hline (if you want a line on top of the table) To skip to the next column, use & we're now in the first row of the second column & 3rd column & 4th column & 5th column \\ with the `\\` you tell want to go to the next row. Now begin with the \hline tag to get a horizontal line after the first row. Now an example of 3 rows. \begin{array}{|l|c|r|c|l|} \hline first&second&third&fourth&fifth\\ \hline 1&2&3&4&5\\ \hline uno&dos&tres&cuatro&cinco\\ \hline \end{array} You can see the difference in the alignment of the different columns. If you want to make this table longer, just continue with adding rows.
Wondering how to use the `grey boxes`? Just put your text between `` (the key for this symbol is above the tab key) When I put hello between 2 of these ``, it will become `hello` You can also use a bigger grey box by typing 3 of these symbols, so ``` when you do this at the beginning of a row and go to the next line, it will become a big grey box where you can input code. it will stop when you add another ``` at the beginning of a new line after the code ``` It will look like this when I type another on the next line and press enter, the grey box will end ``` In this big box, some words or numbers will be colored, this is meant to differentiate certain programming code tags
\(\hspace{90pt}\Huge\sf \color{#730000}{Hyperlinks}\) Currently, it's only possible to create links to webpages within the questioncove.com domain. That means it's not possible to create a latex link to wikipedia or google. You also have to strip the url and remove the questioncove.com part. So http://questioncove.com/rules.html will become /code-of-conduct Now if we want to make a link to the CoC, we use the \href tag This is the syntax: \(\bf\color{red}{\backslash(}\color{green}{\backslash href\{\color{blue }{stripped~url}\}\{\color{blue}{link~text}\}}\color{red}{\backslash)}\) The link to the CoC will be: \(\bf\color{red}{\backslash(}\color{green}{\backslash href\{\color{blue }{/code-of-conduct}\}\{\color{blue}{Code\sim of\sim Conduct}\}}\color{red}{\backslash)}\) And it will look like this: \(\href{http://questioncove.com/rules.html}{Code~of~Conduct}\) You can change the color or add an underline to make it look more like a link.
Also check out: \(\sf\large\color{blue}{\href{/study#/updates/51b10358e4b05b167ed2f45e}{\LaTeX\ welcoming\ messages}}\) \(\small \color{#FF0000}█ \color{#FF1700}█ \color{#FF2E00}█ \color{#FF4500}█ \color{#FF5C00}█ \color{#FF7300}█ \color{#FF8A00}█ \color{#FFA100}█ \color{#FFB800}█ \color{#FFCF00}█ \color{#FFE600}█ \color{#FFFD00}█ \color{#FFff00}█ \color{#E8ff00}█ \color{#D1ff00}█ \color{#BAff00}█ \color{#A3ff00}█ \color{#8Cff00}█ \color{#75ff00}█ \color{#5Eff00}█ \color{#47ff00}█ \color{#30ff00}█ \color{#19ff00}█ \color{#02ff00}█ \color{#00ff00}█ \color{#00ff17}█ \color{#00ff2E}█ \color{#00ff45}█ \color{#00ff5C}█ \color{#00ff73}█ \color{#00ff8A}█ \color{#00ffA1}█ \color{#00ffB8}█ \color{#00ffCF}█ \color{#00ffE6}█ \color{#00ffFD}█ \color{#00ffff}█ \color{#00FDff}█ \color{#00E6ff}█ \color{#00CFff}█ \color{#00B8ff}█ \color{#00A1ff}█ \color{#008Aff}█ \color{#0073ff}█ \color{#005Cff}█ \color{#0045ff}█ \color{#002Eff}█ \color{#0017ff}█ \color{#0000ff}█ \color{#0200ff}█ \color{#1900ff}█ \color{#3000ff}█ \color{#4700ff}█ \color{#5E00ff}█ \color{#7500ff}█ \color{#8C00ff}█ \color{#A300ff}█ \color{#BA00ff}█ \color{#D100ff}█ \color{#E800ff}█ \color{#FF00ff}█ \color{#FF00FD}█ \color{#FF00E6}█ \color{#FF00CF}█ \color{#FF00B8}█ \color{#FF00A1}█ \color{#FF008A}█\\\) \(\hspace{100pt}\Huge©\sf\huge ~Thomaster\)
\(hello there testing\)
\(\bf Hello ~ there!\)
@Ultrilliam
thanks
Thank youu
Join our real-time social learning platform and learn together with your friends!