latex_template.tex 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % Short Sectioned Assignment
  3. % LaTeX Template
  4. % Version 1.0 (5/5/12)
  5. %
  6. % This template has been downloaded from:
  7. % http://www.LaTeXTemplates.com
  8. %
  9. % Original author:
  10. % Frits Wenneker (http://www.howtotex.com)
  11. %
  12. % License:
  13. % CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
  14. %
  15. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  16. %----------------------------------------------------------------------------------------
  17. % PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
  18. %----------------------------------------------------------------------------------------
  19. \documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size
  20. \usepackage[colorlinks=true, allcolors=red]{hyperref}
  21. \usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
  22. %\usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
  23. \usepackage[english]{babel} % English language/hyphenation
  24. \usepackage{amsmath,amsfonts,amsthm} % Math packages
  25. \usepackage{sectsty} % Allows customizing section commands
  26. \allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps
  27. \usepackage{tikz}
  28. \usetikzlibrary{automata,positioning}
  29. \usepackage{fancyhdr} % Custom headers and footers
  30. \pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
  31. \fancyhead{} % No page header - if you want one, create it in the same way as the footers below
  32. \fancyfoot[L]{} % Empty left footer
  33. \fancyfoot[C]{} % Empty center footer
  34. \fancyfoot[R]{\thepage} % Page numbering for right footer
  35. \renewcommand{\headrulewidth}{0pt} % Remove header underlines
  36. \renewcommand{\footrulewidth}{0pt} % Remove footer underlines
  37. \setlength{\headheight}{13.6pt} % Customize the height of the header
  38. \numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
  39. \numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
  40. \numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
  41. \setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text
  42. %\usepackage{mathtools}
  43. %\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
  44. %\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
  45. \newcommand{\heads}{\textsc{h}}
  46. \newcommand{\tails}{\textsc{t}}
  47. \newcommand{\logten}{\log}%\mathrm{log}\hspace{0.05in}}
  48. \newcommand{\logtwo}{\lg}%\mathrm{lg}\hspace{0.05in}}
  49. \newcommand{\loge}{\ln}%\mathrm{ln}\hspace{0.05in}}
  50. \theoremstyle{definition}
  51. \newtheorem*{solution}{Solution}
  52. \usepackage{algpseudocode, algorithm}
  53. %----------------------------------------------------------------------------------------
  54. % TITLE SECTION
  55. %----------------------------------------------------------------------------------------
  56. \newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height
  57. \title{
  58. \normalfont \normalsize
  59. \textsc{ECS60 \hfill Dept. of Computer Science, University of California, Davis} % Your university, school and/or department name(s)
  60. \horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
  61. \huge Homework \#1 \\ % The assignment title
  62. \horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
  63. }
  64. \author{Natalie Pueyo Svoboda, 997466498} % Put your name here
  65. \date{\today}
  66. \begin{document}
  67. \maketitle
  68. Classmate collaborator(s): If you collaborated with fellow students, you \emph{must} list them here.
  69. \section{First Problem}
  70. \begin{solution}
  71. Write your solution here.
  72. You insert math into a sentence using the dollar sign, like this: $f(x) = 2x$.
  73. Sometimes you need an entire line for an equation, so you use the equation environment, like this:
  74. \begin{equation*}
  75. 2^{n+1} = \sum_{i=0}^{n} 2^{i}
  76. \end{equation*}
  77. If you wish to define an equation that spans multiple lines, use the align environment, like this:
  78. \begin{align*}
  79. % This percent denotes a comment.
  80. % Here, the & tells Latex where to align the text
  81. % The \\ is required for every line except the last, and it denotes a newline.
  82. 1 + 2 + 2^2 + \ldots + 2^{k+1} &= (1 + 2 + 2^2 + \ldots + 2^k) + 2^{k+1}\\
  83. &= 2^{k+1} - 1 + 2^{k+1}\\
  84. &= 2 \cdot 2^{k+1} - 1\\
  85. &= 2^{k + 2} - 1
  86. \end{align*}
  87. If you wish to define a function with cases, use the cases environment, like this:
  88. \begin{equation*}
  89. f(n) =
  90. \begin{cases}
  91. n & \text{if $n$ is even } \\
  92. -n & \text{if $n$ is odd}
  93. \end{cases}
  94. \end{equation*}
  95. \end{solution}
  96. \section{Second Problem}
  97. \begin{solution}
  98. Sometimes you will want to write proofs. Use the proof environment, like this:
  99. \begin{proof}
  100. Suppose that $f:A \to B$ and $g:B \to C$ are injective. Suppose that $x, y \in A$ and $x \neq y$. Then $f(x) \neq f(y)$ because $f$ is injective. Similarly, $g(f(x)) \neq g(f(y))$ because $g$ is injective. Therefore $g \circ f (x) \neq g \circ f (y)$ whenever $x \neq y$, so $g \circ f$ is injective.
  101. \end{proof}
  102. \end{solution}
  103. Sometimes you will want to write algorithms. Use the algorithmic environment, like this:
  104. \begin{algorithm}
  105. \caption{YourAlgorithm$(A, B)$}
  106. \begin{algorithmic}
  107. \For{$i = 1$ to $n$}
  108. \If{$A[i] > B[i]$}
  109. \State $A[i]$ is bigger!
  110. \Else
  111. \State $A[i]$ is not bigger!
  112. \EndIf
  113. \EndFor
  114. \State \Return \texttt{True}
  115. \end{algorithmic}
  116. \end{algorithm}
  117. Sometimes you will want to use tables. Use the tabular environment, like this:\\
  118. \begin{tabular}{|l|cr|}
  119. $a$ & $b$ & 10\\ \hline
  120. $e$ & 2 & $d$\\
  121. \end{tabular}\\
  122. The argument after the beginning of tabular specifies the columns. l for left justification, c for centered, r for right justification. The bar $|$ creates a vertical line in the table. $\backslash$hline creates a horizontal line in the table.
  123. \section{Third Problem}
  124. Here is a brief, incomplete list of useful math symbols etc.
  125. \begin{enumerate}
  126. \item Exponential $\exp{n}$, $e^n$, $2^n$ etc.
  127. \item Logarithm $\log$
  128. \item Big-O $O(f(n))$, Big-Omega $\Omega(f(n))$, Big-Theta $\Theta(f(n))$
  129. \item Summation $\sum_{i=1}^n i$
  130. \item Function $f: A \to B$
  131. \item Union $A \cup B$, Intersection $A \cap B$, Complement $\overline{A}$, Set Difference $A \setminus B$
  132. \item Set membership $x \in A$
  133. \item Power Set $\mathcal{P}(A)$
  134. \end{enumerate}
  135. \end{document}