<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>usage &#8211; Luxing Huang</title>
	<atom:link href="https://luxing.im/tag/usage/feed/" rel="self" type="application/rss+xml" />
	<link>https://luxing.im</link>
	<description>Thoughs and things</description>
	<lastBuildDate>Sun, 17 Nov 2013 04:10:48 +0000</lastBuildDate>
	<language>en-CA</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
<site xmlns="com-wordpress:feed-additions:1">58771605</site>	<item>
		<title>Some useful LaTeX tips</title>
		<link>https://luxing.im/some-useful-latex-tips/</link>
					<comments>https://luxing.im/some-useful-latex-tips/#respond</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Fri, 25 Oct 2013 02:10:34 +0000</pubDate>
				<category><![CDATA[Learning Notes]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[usage]]></category>
		<guid isPermaLink="false">http://blog.luxing.im/?p=155</guid>

					<description><![CDATA[This is for my own reminder, and if you like them, take and modify them as you wish. Preamble Preamble is where you put all your defining and including stuff there. It&#8217;s a bit like #include #define BLAH blahblah in C. In , we need to start with a \documentclass[letterpaper]{article} to start an article. Usually &#8230; <p class="link-more"><a href="https://luxing.im/some-useful-latex-tips/" class="more-link">Continue reading<span class="screen-reader-text"> "Some useful LaTeX tips"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>This is for my own reminder, and if you like them, take and modify them as you wish.<br />
<span id="more-155"></span></p>
<h1>Preamble</h1>
<p>Preamble is where you put all your defining and including stuff there. It&#8217;s a bit like </p>
<pre>
#include <blah>
#define BLAH blahblah
</pre>
<p> in C.</p>
<p>In <img decoding="async" src="https://s0.wp.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;LaTeX" class="latex" />, we need to start with a </p>
<pre>\documentclass[letterpaper]{article}</pre>
<p> to start an article. Usually when I write an assignment or Lab report, I use <em>article</em> rather than <em>report</em>.</p>
<h2>Packages</h2>
<p>Then it&#8217;s the packages. <img decoding="async" src="https://s0.wp.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;LaTeX" class="latex" /> is so versatile because so many clever people put their effort in improving it. The usual ones that I use are:</p>
<pre>\usepackage[margin=1cm]{geometry} % For paper margin
\usepackage{amsmath, amssymb, color, colortbl, graphicx, tikz, setspace, multirow}
\usepackage[pdfstartview=FitH]{hyperref}
\usepackage[utf8]{inputenc}
% amsmath is used for generating math expressions;
% amssymb is used for getting prettier math symbols;
% color is color :) and colortbl can be used to highlight cells in tabular (table);
% graphicx is used for importing graphics to the document;
% tikz is a strong and powerful graphics drawer, very versatile and difficult to learn them all.
% setspace is used for setting space size between lines. 
% multirow is an extra tool used for mainly creating tables.
% hyperref is used to changing default zoom options.
% inputenc set the default encoding to utf8 or else.
</pre>
<p>The percentage sign % is comment sign! When you need the percentage sign, you need to type \% like in regex.<br />
When it comes to you that you&#8217;ll use some of the packages, then include the necessary ones into your \usepackage.</p>
<h3>Resources</h3>
<p>amssymb list: <a href="http://www.math.niu.edu/help/tex/amssymbols.pdf" target="_blank">http://www.math.niu.edu/help/tex/amssymbols.pdf</a><br />
tikz examples: <a href="http://www.texample.net/tikz/" target="_blank">http://www.texample.net/tikz/</a><br />
tikz docu: <a href="http://www.texample.net/media/pgf/builds/pgfmanualCVS2012-11-04.pdf" target="_blank">http://www.texample.net/media/pgf/builds/pgfmanualCVS2012-11-04.pdf</a><br />
Importing graphics: <a href="http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics" target="_blank">http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics</a><br />
setspace: <a href="http://mirror.its.dal.ca/ctan/macros/latex/contrib/setspace/setspace.sty" target="_blank">http://mirror.its.dal.ca/ctan/macros/latex/contrib/setspace/setspace.sty</a><br />
multirow: <a href="http://en.wikibooks.org/wiki/LaTeX/Tables#Columns_spanning_multiple_rows" target="_blank">http://en.wikibooks.org/wiki/LaTeX/Tables#Columns_spanning_multiple_rows</a><br />
hyperref:<a href="http://mirror.switch.ch/ftp/mirror/tex/macros/latex/contrib/hyperref/doc/manual.html" target="_blank">http://mirror.switch.ch/ftp/mirror/tex/macros/latex/contrib/hyperref/doc/manual.html</a><br />
Always, Google is our best friend.</p>
<h2>End of Preamble</h2>
<p>For more detailed Document Structure, please visit <a href="http://en.wikibooks.org/wiki/LaTeX/Document_Structure" target="_blank">WikiBooks</a></p>
<h1> Document </h1>
<p>After finishing the preamble content, let&#8217;s start to write our content!<br />
Usually we need to add title, author and date on our first page for lab report or assignments.</p>
<pre>
\begin{document}
\title{Some Lab Report \\ % \\ is nextline
     Circuit Lab \\
     Section 1 \\
     Composed by: }
\author{ Luxing Huang \and Some Guy \and Another Guy }
\date{\today}
\maketitle
</pre>
<p>You can extend your spacing between lines using \vspace{2cm} inside your title or author section.<br />
I think the indentation is messed up by default, so I always add </p>
<pre>\setlength{\parindent}{0cm}</pre>
<p> under \maketitle.</p>
<p>Then time for your \section{name}&#8217;s. And \subsections.</p>
<h2>Math</h2>
<p>The math module is very fun. You need to write your math expressions inside two dollar signs &#8220;$&#8221;.</p>
<pre>$\sum m{(0, 1, 3, 6)}$</pre>
<p> looks like: <img decoding="async" src="https://s0.wp.com/latex.php?latex=%5Csum+m%7B%280%2C+1%2C+3%2C+6%29%7D&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;sum m{(0, 1, 3, 6)}" class="latex" />, fraction function is </p>
<pre>\frac{numeritor}{denominator}</pre>
<p>Some Math resources: <a href="http://en.wikibooks.org/wiki/LaTeX/Mathematics" target="_blank">http://en.wikibooks.org/wiki/LaTeX/Mathematics</a> <a href="http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics" target="_blank">http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics</a></p>
<h2>Table</h2>
<p>Table is even more fun. Here is a snippet of my <img decoding="async" src="https://s0.wp.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;LaTeX" class="latex" /> for the lab work:</p>
<pre>
\begin{center}
    \begin{tabular}{l l l l l l} 
        A & B & C & D & f & Simu \\ \hline
        0 & 0 & 0 & 0 & 1 & 1 \\ \hline
        0 & 0 & 0 & 1 & 1 & 1 \\ \hline
        0 & 0 & 1 & 0 & 1 & 1 \\ \hline
        0 & 0 & 1 & 1 & 0 & 0 \\ \hline
        0 & 1 & 0 & 0 & 1 & 1 \\ \hline
        0 & 1 & 0 & 1 & 0 & 0 \\ \hline
        0 & 1 & 1 & 0 & 0 & 0 \\ \hline
        0 & 1 & 1 & 1 & 1 & 1 \\ \hline
        1 & 0 & 0 & 0 & 0 & 0 \\ \hline
        1 & 0 & 0 & 1 & 0 & 0 \\ \hline
        1 & 0 & 1 & 0 & 1 & 1 \\ \hline
        1 & 0 & 1 & 1 & 1 & 1 \\ \hline
        1 & 1 & 0 & 0 & 0 & 0 \\ \hline
        1 & 1 & 0 & 1 & 1 & 1 \\ \hline
        1 & 1 & 1 & 0 & 0 & 0 \\ \hline
        1 & 1 & 1 & 1 & 0 & 0 \\ 
    \end{tabular} 
\end{center}</pre>
<p>You define whether you&#8217;ll need a column line in \begin{tabular}{l l l l l l}, where the second set of braces located. So l l l l l means 5 left alignment&#8217;s, if I write |c|c|c|c|c| then I&#8217;ll get colomn lines (\cline) and text centered. \hline is obviously a horizontal line.<br />
More on tables: <a href="http://en.wikibooks.org/wiki/LaTeX/Tables" target="_blank">http://en.wikibooks.org/wiki/LaTeX/Tables</a>.</p>
<h2>Tikz</h2>
<p>Tikz is always a headache for me. I do not have enough time to dig through it but I know it&#8217;s extreamly powerful.<br />
Here is some code I wrote for probability tree:</p>
<pre>
\tikzstyle{level 1}=[level distance=3cm, sibling distance=7cm]
\tikzstyle{level 2}=[level distance=1.5cm, sibling distance=3.5cm]
\tikzstyle{level 3}=[level distance=2.5cm, sibling distance=2cm]

\tikzstyle{fly}=[text width=2em, text centered]
\tikzstyle{end}=[circle, minimum width=1pt, fill, inner sep=0pt]

\begin{tikzpicture}[grow=right, sloped]
\node[fly] {}
child
{
    node[fly] {B}
    child
    {
        node[fly]{B}
        child
        {
            node [end, label=right:B BBB 0.027] {}
            edge from parent
            node[above] {0.3}
        }   
        child
        {   
            node[end, label=right:G BBG 0.063] {}
            edge from parent
            node[above] {0.7}
        }   
    }       
    child   
    {   
        node[fly]{G}
        child
        {
            node[end, label=right:B BGB 0.063] {}
            edge from parent
            node[above] {0.3}
        }   
        child
        {   
            node[end, label=right:G BGG 0.147] {}
            edge from parent
            node[above] {0.7}
        }   
    }       
}
child   
{   
    node[fly] {G}
    child
    {
        node[fly]{B}
        child
        {
            node[end, label=right:B GBB 0.063] {}
            edge from parent
            node[above] {0.3}
        }
        child
        {
            node[end, label=right:G GBG 0.147] {}
            edge from parent
            node[above] {0.7}
        }
    }
    child
    {
        node[fly]{G}
        child
        {
            node[end, label=right:B GGB 0.147] {}
            edge from parent
            node[above] {0.3}
        }
        child
        {
            node[end, label=right:G GGG 0.343] {}
            edge from parent
            node[above] {0.7}
        }
    }
};
\end{tikzpicture}
</pre>
<p>You&#8217;ll see what it looks like when you compile it to PDF.</p>
<h2>Bullet Points and Indentation</h2>
<p>There are 3 types of bullet points listing, itemize(points or dashes), enumerate(using numbers and abc&#8217;s) and description, can be nested. No external package required. Code is like this:</p>
<pre>
\begin{itemize}
    \item Be Professional

        \begin{itemize}
            \item Formal

            \item Subject Line - State the Purpose

            \item Hello, Good Morning, Good Afternoon ...

            \item Clear, concise, get to the point

            \item Proofread everything
        \end{itemize}

    \item Don't be Emotional

        \begin{itemize}
            \item Angry, Sad, Frustrated.

            \item Never assume the receiver will take your message the way you expect.

            \item Limit the exchanges

            \item Limit the "reply all" Button

            \item Acronyms

                \begin{description}
                    \item[yes]: TQM(Total Quality Management)/CEO/ROI

                    \item[no]: LOL/TTYL/CUL8R
                \end{description}
        \end{itemize}
\end{itemize}
</pre>
<h2>Compilation</h2>
<p><img decoding="async" src="https://s0.wp.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;LaTeX" class="latex" /> is so great when it work with Makefile. I didn&#8217;t write much for my Makefile, here is the general template:</p>
<pre>LC = pdflatex  # LC stands for Latex Compiler
SOURCE = assign5.tex
OUTPUT = assign5.pdf

make: all

all: $(SOURCE)
    $(CC) $(SOURCE) $(OUTPUT)
    okular $(OUTPUT) #okular is my pdf viewer.
</pre>
<p>When you see an error or warning while compiling PDF from .tex files, read where the problem is, and type X then enter to quit compilation. Otherwise sometimes pdflatex will drain your CPU resource.<br />
When you finish your document, put \end{document} at the very bottom.</p>
<h1>texlive</h1>
<p>This is the package you need to install under your system. For Linux users, package manage systems should already include most of the latex packages.<br />
For RHEL and Fedora users, type</p>
<pre>sudo yum install texlive*</pre>
<p> should do the intallation job.<br />
I will add more <img decoding="async" src="https://s0.wp.com/latex.php?latex=%5CLaTeX&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" alt="&#92;LaTeX" class="latex" /> notes when it comes to me.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/some-useful-latex-tips/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">155</post-id>	</item>
	</channel>
</rss>
