1. Collecting
Code
LaTeX
June 12
Berisi kumpulan kode latex yang dapat digunakan dalam pembuatan
buku, paper, article, jurnal, poster, dan presentasi menggunakan
beamer. Selain itu, didalam juga diberikan alternatif dalam
pembuatan presentasi seperti pdfscreen , prosper dan komascript.
For Advanced
Users
2. BAB 1
ARTICLE
1. Ar cle_1.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Large Colored Title Ar cle
% LaTeX Template
% Version 1.1 (25/11/12)
%
% This template has been downloaded from:
% h p://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (h p://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (h p://crea vecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass[DIV=calc, paper=a4, fontsize=11pt, twocolumn]{scrartcl} % A4 paper
and 11pt font size
usepackage{lipsum} % Used for inser ng dummy 'Lorem ipsum' text into the template
usepackage[english]{babel} % English language/hyphena on
usepackage[protrusion=true,expansion=true]{microtype} % Be er typography
usepackage{amsmath,amsfonts,amsthm} % Math packages
usepackage[svgnames]{xcolor} % Enabling colors by their 'svgnames'
usepackage[hang, small,labelfont=bf,up,tex ont=it,up]{cap on} % Custom cap ons
under/above floats in tables or figures
usepackage{booktabs} % Horizontal rules in tables
usepackage{fix-cm} % Custom font sizes - used for the ini al le er in the document
usepackage{sectsty} % Enables custom sec on tles
allsec onsfont{usefont{OT1}{phv}{b}{n}} % Change the font of all sec on commands
usepackage{fancyhdr} % Needed to define custom headers/footers
pagestyle{fancy} % Enables the custom headers/footers
usepackage{lastpage} % Used to determine the number of pages in the document (for "Page
X of Total")
% Headers - all currently empty
lhead{}
chead{}
rhead{}
3. % Footers
lfoot{}
cfoot{}
rfoot{footnotesize Page thepage of pageref{LastPage}} % "Page 1 of 2"
renewcommand{headrulewidth}{0.0pt} % No header rule
renewcommand{footrulewidth}{0.4pt} % Thin footer rule
usepackage{le rine} % Package to accentuate the first le er of the text
newcommand{ini al}[1]{ % Defines the command and style for the first le er
le rine[lines=3,lhang=0.3,nindent=0em]{
color{DarkGoldenrod}
{textsf{#1}}}{}}
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
usepackage{ tling} % Allows custom tle configura on
newcommand{HorRule}{color{DarkGoldenrod} rule{linewidth}{1pt}} % Defines the gold
horizontal rule around the tle
pre tle{vspace{-30pt} begin{flushle } HorRule fontsize{50}{50} usefont{OT1}{phv}{b}{n}
color{DarkRed} selec ont} % Horizontal rule before the tle
tle{Ar cle Title} % Your ar cle tle
pos tle{parend{flushle }vskip 0.5em} % Whitespace under the tle
preauthor{begin{flushle }large lineskip 0.5em usefont{OT1}{phv}{b}{sl}
color{DarkRed}} % Author font configura on
author{John Smith, } % Your name
postauthor{footnotesize usefont{OT1}{phv}{m}{sl} color{Black} % Configura on for the
ins tu on name
University of California % Your ins tu on
parend{flushle }HorRule} % Horizontal rule a er the tle
date{} % Add a date here if you would like one to appear underneath the tle block
%----------------------------------------------------------------------------------------
begin{document}
make tle % Print the tle
thispagestyle{fancy} % Enabling the custom headers/footers for the first page
4. %----------------------------------------------------------------------------------------
% ABSTRACT
%----------------------------------------------------------------------------------------
% The first character should be within ini al{}
ini al{H}textbf{ere is some sample text to show the ini al in the introductory paragraph of
this template ar cle. The color and lineheight of the ini al can be modified in the preamble
of this document.}
%----------------------------------------------------------------------------------------
% ARTICLE CONTENTS
%----------------------------------------------------------------------------------------
sec on*{Sec on 1}
lipsum[1-3] % Dummy text
begin{align}
A =
begin{bmatrix}
A_{11} & A_{21}
A_{21} & A_{22}
end{bmatrix}
end{align}
lipsum[4] % Dummy text
%------------------------------------------------
subsec on*{Subsec on 1}
lipsum[5] % Dummy text
begin{itemize}
item First item in a list
item Second item in a list
item Third item in a list
end{itemize}
lipsum[6] % Dummy text
%------------------------------------------------
subsec on*{Subsec on 2}
lipsum[7] % Dummy text
begin{table}
cap on{Random table}
centering
begin{tabular}{llr}
5. toprule
mul column{2}{c}{Name}
cmidrule(r){1-2}
First name & Last Name & Grade
midrule
John & Doe & $7.5$
Richard & Miles & $2$
bo omrule
end{tabular}
end{table}
%------------------------------------------------
sec on*{Sec on 2}
lipsum[8] % Dummy text
begin{descrip on}
item[First] This is the first item
item[Last] This is the last item
end{descrip on}
lipsum[9] % Dummy text
%----------------------------------------------------------------------------------------
% REFERENCE LIST
%----------------------------------------------------------------------------------------
begin{thebibliography}{99} % Bibliography - this is inten onally simple in this template
bibitem[Figueredo and Wolf, 2009]{Figueredo:2009dg}
Figueredo, A.~J. and Wolf, P. S.~A. (2009).
newblock Assorta ve pairing and life history strategy - a cross-cultural
study.
newblock {em Human Nature}, 20:317--330.
end{thebibliography}
%----------------------------------------------------------------------------------------
end{document}
2. Ar cle_2.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Journal Ar cle
% LaTeX Template
% Version 1.2 (15/5/13)
%
% This template has been downloaded from:
% h p://www.LaTeXTemplates.com
6. %
% Original author:
% Frits Wenneker (h p://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (h p://crea vecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass[twoside]{ar cle}
usepackage{lipsum} % Package to generate dummy text throughout this template
usepackage[sc]{mathpazo} % Use the Pala no font
usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
linespread{1.05} % Line spacing - Pala no needs more space between lines
usepackage{microtype} % Slightly tweak font spacing for aesthe cs
usepackage[hmarginra o=1:1,top=32mm,columnsep=20pt]{geometry} % Document
margins
usepackage{mul col} % Used for the two-column layout of the document
usepackage[hang, small,labelfont=bf,up,tex ont=it,up]{cap on} % Custom cap ons
under/above floats in tables or figures
usepackage{booktabs} % Horizontal rules in tables
usepackage{float} % Required for tables and figures in the mul -column environment - they
need to be placed in specific loca ons with the [H] (e.g. begin{table}[H])
usepackage{hyperref} % For hyperlinks in the PDF
usepackage{le rine} % The le rine is the first enlarged le er at the beginning of the text
usepackage{paralist} % Used for the compac tem environment which makes bullet points
with less space between them
usepackage{abstract} % Allows abstract customiza on
renewcommand{abstractnamefont}{normalfontbfseries} % Set the "Abstract" text to
bold
renewcommand{abstrac ex ont}{normalfontsmallitshape} % Set the abstract itself to
small italic text
usepackage{ tlesec} % Allows customiza on of tles
renewcommandthesec on{Roman{sec on}}
tleformat{sec on}[block]{largescshapecentering}{thesec on.}{1em}{} % Change the
look of the sec on tles
usepackage{fancyhdr} % Headers and footers
pagestyle{fancy} % All pages have headers and footers
fancyhead{} % Blank out the default header
fancyfoot{} % Blank out the default footer
7. fancyhead[C]{Running tle $bullet$ November 2012 $bullet$ Vol. XXI, No. 1} % Custom
header text
fancyfoot[RO,LE]{thepage} % Custom footer text
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
tle{vspace{-15mm}fontsize{24pt}{10pt}selec onttextbf{Ar cle Title}} % Ar cle tle
author{
large
textsc{John Smith}thanks{A thank you or further informa on}[2mm] % Your name
normalsize University of California % Your ins tu on
normalsize href{mailto:john@smith.com}{john@smith.com} % Your email address
vspace{-5mm}
}
date{}
%----------------------------------------------------------------------------------------
begin{document}
make tle % Insert tle
thispagestyle{fancy} % All pages have headers and footers
%----------------------------------------------------------------------------------------
% ABSTRACT
%----------------------------------------------------------------------------------------
begin{abstract}
noindent lipsum[1] % Dummy abstract text
end{abstract}
%----------------------------------------------------------------------------------------
% ARTICLE CONTENTS
%----------------------------------------------------------------------------------------
begin{mul cols}{2} % Two-column layout throughout the main ar cle text
sec on{Introduc on}
le rine[nindent=0em,lines=3]{L} orem ipsum dolor sit amet, consectetur adipiscing elit.
lipsum[2-3] % Dummy text
%------------------------------------------------
sec on{Methods}
8. Maecenas sed ultricies felis. Sed imperdiet dictum arcu a egestas.
begin{compac tem}
item Donec dolor arcu, rutrum id moles e in, viverra sed diam
item Curabitur feugiat
item turpis sed auctor facilisis
item arcu eros accumsan lorem, at posuere mi diam sit amet tortor
item Fusce fermentum, mi sit amet euismod rutrum
item sem lorem moles e diam, iaculis aliquet sapien tortor non nisi
item Pellentesque bibendum pre um aliquet
end{compac tem}
lipsum[4] % Dummy text
%------------------------------------------------
sec on{Results}
begin{table}[H]
cap on{Example table}
centering
begin{tabular}{llr}
toprule
mul column{2}{c}{Name}
cmidrule(r){1-2}
First name & Last Name & Grade
midrule
John & Doe & $7.5$
Richard & Miles & $2$
bo omrule
end{tabular}
end{table}
lipsum[5] % Dummy text
begin{equa on}
label{eq:emc}
e = mc^2
end{equa on}
lipsum[6] % Dummy text
%------------------------------------------------
sec on{Discussion}
lipsum[7-8] % Dummy text
%----------------------------------------------------------------------------------------
% REFERENCE LIST
%----------------------------------------------------------------------------------------
9. begin{thebibliography}{99} % Bibliography - this is inten onally simple in this template
bibitem[Figueredo and Wolf, 2009]{Figueredo:2009dg}
Figueredo, A.~J. and Wolf, P. S.~A. (2009).
newblock Assorta ve pairing and life history strategy - a cross-cultural
study.
newblock {em Human Nature}, 20:317--330.
end{thebibliography}
%----------------------------------------------------------------------------------------
end{mul cols}
end{document}
3. Ar cle_3.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Stylish Ar cle
% LaTeX Template
% Version 1.0 (31/1/13)
%
% This template has been downloaded from:
% h p://www.LaTeXTemplates.com
%
% Original author:
% Mathias Legrand (legrand.mathias@gmail.com)
%
% License:
% CC BY-NC-SA 3.0 (h p://crea vecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass[fleqn,10pt]{SelfArx} % Document font size and equa ons flushed le
setlength{columnsep}{0.55cm} % Distance between the two columns of text
setlength{ oxrule}{0.75pt} % Width of the border around the abstract
definecolor{color1}{RGB}{0,0,90} % Color of the ar cle tle and sec ons
definecolor{color2}{RGB}{0,20,20} % Color of the boxes behind the abstract and headings
newlength{tocsep}
setlengthtocsep{1.5pc} % Sets the indenta on of the sec ons in the table of contents
setcounter{tocdepth}{3} % Show only three levels in the table of contents sec on: sec ons,
subsec ons and subsubsec ons
10. usepackage{lipsum} % Required to insert dummy text
%----------------------------------------------------------------------------------------
% ARTICLE INFORMATION
%----------------------------------------------------------------------------------------
JournalInfo{Journal, Vol. XXI, No. 1, 1-5, 2013} % Journal informa on
Archive{Addi onal note} % Addi onal notes (e.g. copyright, DOI, review/research ar cle)
PaperTitle{Ar cle Title} % Ar cle tle
Authors{John Smithtextsuperscript{1}*, James Smithtextsuperscript{2}} % Authors
affilia on{textsuperscript{1}tex t{Department of Biology, University of Examples, London,
United Kingdom}} % Author affilia on
affilia on{textsuperscript{2}tex t{Department of Chemistry, University of Examples,
London, United Kingdom}} % Author affilia on
affilia on{*textbf{Corresponding author}: john@smith.com} % Corresponding author
Keywords{Keyword1 --- Keyword2 --- Keyword3} % Keywords - if you don't want any simply
remove all the text between the curly brackets
newcommand{keywordname}{Keywords} % Defines the keywords heading name
%----------------------------------------------------------------------------------------
% ABSTRACT
%----------------------------------------------------------------------------------------
Abstract{lipsum[1]~}
%----------------------------------------------------------------------------------------
begin{document}
flushbo om % Makes all text pages the same height
make tle % Print the tle and abstract box
tableofcontents % Print the contents sec on
thispagestyle{empty} % Removes page numbering from the first page
%----------------------------------------------------------------------------------------
% ARTICLE CONTENTS
%----------------------------------------------------------------------------------------
sec on*{Introduc on} % The sec on*{} command stops sec on numbering
addcontentsline{toc}{sec on}{hspace*{-tocsep}Introduc on} % Adds this sec on to the
table of contents with nega ve horizontal space equal to the indent for the numbered
sec ons
lipsum[1-3] % Dummy text
11. %------------------------------------------------
sec on{Methods}
begin{figure*}[ht]centering % Using begin{figure*} makes the figure take up the en re
width of the page
includegraphics[width=linewidth]{view}
cap on{Wide Picture}
label{fig:view}
end{figure*}
lipsum[4] % Dummy text
begin{equa on}
cos^3 theta =frac{1}{4}costheta+frac{3}{4}cos 3theta
label{eq:refname2}
end{equa on}
lipsum[5] % Dummy text
begin{enumerate}[noitemsep] % [noitemsep] removes whitespace between the items for a
compact look
item First item in a list
item Second item in a list
item Third item in a list
end{enumerate}
subsec on{Subsec on}
lipsum[6] % Dummy text
paragraph{Paragraph} lipsum[7] % Dummy text
paragraph{Paragraph} lipsum[8] % Dummy text
subsec on{Subsec on}
lipsum[9] % Dummy text
begin{figure}[ht]centering
includegraphics[width=linewidth]{results}
cap on{In-text Picture}
label{fig:results}
end{figure}
Reference to Figure ref{fig:results}.
%------------------------------------------------
sec on{Results and Discussion}
12. lipsum[10] % Dummy text
subsec on{Subsec on}
lipsum[11] % Dummy text
begin{table}[hbt]
cap on{Table of Grades}
centering
begin{tabular}{llr}
toprule
mul column{2}{c}{Name}
cmidrule(r){1-2}
First name & Last Name & Grade
midrule
John & Doe & $7.5$
Richard & Miles & $2$
bo omrule
end{tabular}
label{tab:label}
end{table}
subsubsec on{Subsubsec on}
lipsum[12] % Dummy text
begin{descrip on}
item[Word] Defini on
item[Concept] Explana on
item[Idea] Text
end{descrip on}
subsubsec on{Subsubsec on}
lipsum[13] % Dummy text
begin{itemize}[noitemsep] % [noitemsep] removes whitespace between the items for a
compact look
item First item in a list
item Second item in a list
item Third item in a list
end{itemize}
subsubsec on{Subsubsec on}
lipsum[14] % Dummy text
subsec on{Subsec on}
lipsum[15-23] % Dummy text
13. %------------------------------------------------
sec on*{Acknowledgments} % The sec on*{} command stops sec on numbering
addcontentsline{toc}{sec on}{hspace*{-tocsep}Acknowledgments} % Adds this sec on to
the table of contents with nega ve horizontal space equal to the indent for the numbered
sec ons
So long and thanks for all the fish cite{Figueredo:2009dg}.
%----------------------------------------------------------------------------------------
% REFERENCE LIST
%----------------------------------------------------------------------------------------
bibliographystyle{unsrt}
bibliography{sample}
%----------------------------------------------------------------------------------------
end{document}
14. BAB 2
ASSIGNMENNT
1. Assignment_1.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Structured General Purpose Assignment
% LaTeX Template
%
% This template has been downloaded from:
% h p://www.latextemplates.com
%
% Original author:
% Ted Pavlic (h p://www.tedpavlic.com)
%
% Note:
% The lipsum[#] commands throughout this template generate dummy text
% to fill the template out. These commands should all be removed when
% wri ng assignment content.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass{ar cle}
usepackage{fancyhdr} % Required for custom headers
usepackage{lastpage} % Required to determine the last page for the footer
usepackage{extramarks} % Required for headers and footers
usepackage{graphicx} % Required to insert images
usepackage{lipsum} % Used for inser ng dummy 'Lorem ipsum' text into the template
% Margins
topmargin=-0.45in
evensidemargin=0in
oddsidemargin=0in
textwidth=6.5in
textheight=9.0in
headsep=0.25in
linespread{1.1} % Line spacing
% Set up the header and footer
pagestyle{fancy}
lhead{hmwkAuthorName} % Top le header
chead{hmwkClass (hmwkClassInstructor hmwkClassTime): hmwkTitle} % Top center header
rhead{firstxmark} % Top right header
lfoot{lastxmark} % Bo om le footer
cfoot{} % Bo om center footer
15. rfoot{Page thepage of pageref{LastPage}} % Bo om right footer
renewcommandheadrulewidth{0.4pt} % Size of the header rule
renewcommandfootrulewidth{0.4pt} % Size of the footer rule
setlengthparindent{0pt} % Removes all indenta on from paragraphs
%----------------------------------------------------------------------------------------
% DOCUMENT STRUCTURE COMMANDS
% Skip this unless you know what you're doing
%----------------------------------------------------------------------------------------
% Header and footer for when a page split occurs within a problem environment
newcommand{enterProblemHeader}[1]{
nobreakextramarks{#1}{#1 con nued on next pageldots}nobreak
nobreakextramarks{#1 (con nued)}{#1 con nued on next pageldots}nobreak
}
% Header and footer for when a page split occurs between problem environments
newcommand{exitProblemHeader}[1]{
nobreakextramarks{#1 (con nued)}{#1 con nued on next pageldots}nobreak
nobreakextramarks{#1}{}nobreak
}
setcounter{secnumdepth}{0} % Removes default sec on numbers
newcounter{homeworkProblemCounter} % Creates a counter to keep track of the number of
problems
newcommand{homeworkProblemName}{}
newenvironment{homeworkProblem}[1][Problem arabic{homeworkProblemCounter}]{ % Makes a
new environment called homeworkProblem which takes 1 argument (custom name) but the default
is "Problem #"
stepcounter{homeworkProblemCounter} % Increase counter for number of problems
renewcommand{homeworkProblemName}{#1} % Assign homeworkProblemName the name of
the problem
sec on{homeworkProblemName} % Make a sec on in the document with the custom problem
count
enterProblemHeader{homeworkProblemName} % Header and footer within the environment
}{
exitProblemHeader{homeworkProblemName} % Header and footer a er the environment
}
newcommand{problemAnswer}[1]{ % Defines the problem answer command with the content as
the only argument
noindentframebox[columnwidth][c]{begin{minipage}{0.98columnwidth}#1end{minipage}} %
Makes the box around the problem answer and puts the content inside
}
newcommand{homeworkSec onName}{}
newenvironment{homeworkSec on}[1]{ % New environment for sec ons within homework
problems, takes 1 argument - the name of the sec on
16. renewcommand{homeworkSec onName}{#1} % Assign homeworkSec onName to the name of
the sec on from the environment argument
subsec on{homeworkSec onName} % Make a subsec on with the custom name of the subsec on
enterProblemHeader{homeworkProblemName [homeworkSec onName]} % Header and footer
within the environment
}{
enterProblemHeader{homeworkProblemName} % Header and footer a er the environment
}
%----------------------------------------------------------------------------------------
% NAME AND CLASS SECTION
%----------------------------------------------------------------------------------------
newcommand{hmwkTitle}{Assignment #1} % Assignment tle
newcommand{hmwkDueDate}{Monday, January 1, 2012} % Due date
newcommand{hmwkClass}{BIO 101} % Course/class
newcommand{hmwkClassTime}{10:30am} % Class/lecture me
newcommand{hmwkClassInstructor}{Jones} % Teacher/lecturer
newcommand{hmwkAuthorName}{John Smith} % Your name
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
tle{
vspace{2in}
textmd{textbf{hmwkClass: hmwkTitle}}
normalsizevspace{0.1in}small{Due on hmwkDueDate}
vspace{0.1in}large{tex t{hmwkClassInstructor hmwkClassTime}}
vspace{3in}
}
author{textbf{hmwkAuthorName}}
date{} % Insert date here if you want it to appear below your name
%----------------------------------------------------------------------------------------
begin{document}
make tle
%----------------------------------------------------------------------------------------
% TABLE OF CONTENTS
%----------------------------------------------------------------------------------------
%setcounter{tocdepth}{1} % Uncomment this line if you don't want subsec ons listed in the ToC
newpage
tableofcontents
newpage
17. %----------------------------------------------------------------------------------------
% PROBLEM 1
%----------------------------------------------------------------------------------------
% To have just one problem per page, simply put a clearpage a er each problem
begin{homeworkProblem}
lipsum[1]vspace{10pt} % Ques on
problemAnswer{ % Answer
begin{center}
includegraphics[width=0.75columnwidth]{example_figure} % Example image
end{center}
lipsum[2]
}
end{homeworkProblem}
%----------------------------------------------------------------------------------------
% PROBLEM 2
%----------------------------------------------------------------------------------------
begin{homeworkProblem}[Exercise #arabic{homeworkProblemCounter}] % Custom sec on tle
lipsum[3] % Ques on
%--------------------------------------------
begin{homeworkSec on}{(a)} % Sec on within problem
lipsum[4]vspace{10pt} % Ques on
problemAnswer{ % Answer
lipsum[5]
}
end{homeworkSec on}
%--------------------------------------------
begin{homeworkSec on}{(b)} % Sec on within problem
problemAnswer{ % Answer
lipsum[6]
}
end{homeworkSec on}
%--------------------------------------------
end{homeworkProblem}
%----------------------------------------------------------------------------------------
% PROBLEM 3
%----------------------------------------------------------------------------------------
18. begin{homeworkProblem}[Prob. Roman{homeworkProblemCounter}] % Roman numerals
%--------------------------------------------
begin{homeworkSec on}{homeworkProblemName:~(a)} % Using the problem name elsewhere
problemAnswer{ % Answer
lipsum[7]
}
end{homeworkSec on}
%--------------------------------------------
begin{homeworkSec on}{homeworkProblemName:~(b)}
lipsum[8]vspace{10pt} % Ques on
problemAnswer{ % Answer
lipsum[9]
}
end{homeworkSec on}
%--------------------------------------------
end{homeworkProblem}
%----------------------------------------------------------------------------------------
% PROBLEM 4
%----------------------------------------------------------------------------------------
begin{homeworkProblem}[Prob. Roman{homeworkProblemCounter}] % Roman numerals
problemAnswer{ % Answer
lipsum[10]
}
end{homeworkProblem}
%----------------------------------------------------------------------------------------
end{document}
2. Assignment_2.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Programming/Coding Assignment
% LaTeX Template
%
% This template has been downloaded from:
% h p://www.latextemplates.com
%
% Original author:
% Ted Pavlic (h p://www.tedpavlic.com)
%
% Note:
19. % The lipsum[#] commands throughout this template generate dummy text
% to fill the template out. These commands should all be removed when
% wri ng assignment content.
%
% This template uses a Perl script as an example snippet of code, most other
% languages are also usable. Configure them in the "CODE INCLUSION
% CONFIGURATION" sec on.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass{ar cle}
usepackage{fancyhdr} % Required for custom headers
usepackage{lastpage} % Required to determine the last page for the footer
usepackage{extramarks} % Required for headers and footers
usepackage[usenames,dvipsnames]{color} % Required for custom colors
usepackage{graphicx} % Required to insert images
usepackage{lis ngs} % Required for inser on of code
usepackage{courier} % Required for the courier font
usepackage{lipsum} % Used for inser ng dummy 'Lorem ipsum' text into the template
% Margins
topmargin=-0.45in
evensidemargin=0in
oddsidemargin=0in
textwidth=6.5in
textheight=9.0in
headsep=0.25in
linespread{1.1} % Line spacing
% Set up the header and footer
pagestyle{fancy}
lhead{hmwkAuthorName} % Top le header
chead{hmwkClass (hmwkClassInstructor hmwkClassTime): hmwkTitle} % Top center
head
rhead{firstxmark} % Top right header
lfoot{lastxmark} % Bo om le footer
cfoot{} % Bo om center footer
rfoot{Page thepage of protectpageref{LastPage}} % Bo om right footer
renewcommandheadrulewidth{0.4pt} % Size of the header rule
renewcommandfootrulewidth{0.4pt} % Size of the footer rule
setlengthparindent{0pt} % Removes all indenta on from paragraphs
%----------------------------------------------------------------------------------------
% CODE INCLUSION CONFIGURATION
20. %----------------------------------------------------------------------------------------
definecolor{MyDarkGreen}{rgb}{0.0,0.4,0.0} % This is the color used for comments
lstloadlanguages{Perl} % Load Perl syntax for lis ngs, for a list of other languages supported
see: p:// p.tex.ac.uk/tex-archive/macros/latex/contrib/lis ngs/lis ngs.pdf
lstset{language=Perl, % Use Perl in this example
frame=single, % Single frame around code
basicstyle=small amily, % Use small true type font
keywordstyle=[1]color{Blue}bf, % Perl func ons bold and blue
keywordstyle=[2]color{Purple}, % Perl func on arguments purple
keywordstyle=[3]color{Blue}underbar, % Custom func ons underlined and blue
iden fierstyle=, % Nothing special about iden fiers
commentstyle=usefont{T1}{pcr}{m}{sl}color{MyDarkGreen}small, % Comments small
dark green courier font
stringstyle=color{Purple}, % Strings are purple
showstringspaces=false, % Don't put marks in string spaces
tabsize=5, % 5 spaces per tab
%
% Put standard Perl func ons not included in the default language here
morekeywords={rand},
%
% Put Perl func on parameters here
morekeywords=[2]{on, off, interp},
%
% Put user defined func ons here
morekeywords=[3]{test},
%
morecomment=[l][color{Blue}]{...}, % Line con nua on (...) like blue comment
numbers=le , % Line numbers on le
firstnumber=1, % Line numbers start with line 1
numberstyle= nycolor{Blue}, % Line numbers are blue and small
stepnumber=5 % Line numbers go in steps of 5
}
% Creates a new command to include a perl script, the first parameter is the filename of the
script (without .pl), the second parameter is the cap on
newcommand{perlscript}[2]{
begin{itemize}
item[]ls nputlis ng[cap on=#2,label=#1]{#1.pl}
end{itemize}
}
%----------------------------------------------------------------------------------------
% DOCUMENT STRUCTURE COMMANDS
% Skip this unless you know what you're doing
%----------------------------------------------------------------------------------------
% Header and footer for when a page split occurs within a problem environment
newcommand{enterProblemHeader}[1]{
nobreakextramarks{#1}{#1 con nued on next pageldots}nobreak
nobreakextramarks{#1 (con nued)}{#1 con nued on next pageldots}nobreak
21. }
% Header and footer for when a page split occurs between problem environments
newcommand{exitProblemHeader}[1]{
nobreakextramarks{#1 (con nued)}{#1 con nued on next pageldots}nobreak
nobreakextramarks{#1}{}nobreak
}
setcounter{secnumdepth}{0} % Removes default sec on numbers
newcounter{homeworkProblemCounter} % Creates a counter to keep track of the number
of problems
newcommand{homeworkProblemName}{}
newenvironment{homeworkProblem}[1][Problem arabic{homeworkProblemCounter}]{ %
Makes a new environment called homeworkProblem which takes 1 argument (custom name)
but the default is "Problem #"
stepcounter{homeworkProblemCounter} % Increase counter for number of problems
renewcommand{homeworkProblemName}{#1} % Assign homeworkProblemName the
name of the problem
sec on{homeworkProblemName} % Make a sec on in the document with the custom
problem count
enterProblemHeader{homeworkProblemName} % Header and footer within the
environment
}{
exitProblemHeader{homeworkProblemName} % Header and footer a er the environment
}
newcommand{problemAnswer}[1]{ % Defines the problem answer command with the
content as the only argument
noindentframebox[columnwidth][c]{begin{minipage}{0.98columnwidth}#1end{minipag
e}} % Makes the box around the problem answer and puts the content inside
}
newcommand{homeworkSec onName}{}
newenvironment{homeworkSec on}[1]{ % New environment for sec ons within homework
problems, takes 1 argument - the name of the sec on
renewcommand{homeworkSec onName}{#1} % Assign homeworkSec onName to the
name of the sec on from the environment argument
subsec on{homeworkSec onName} % Make a subsec on with the custom name of the
subsec on
enterProblemHeader{homeworkProblemName [homeworkSec onName]} % Header and
footer within the environment
}{
enterProblemHeader{homeworkProblemName} % Header and footer a er the
environment
}
%----------------------------------------------------------------------------------------
% NAME AND CLASS SECTION
%----------------------------------------------------------------------------------------
22. newcommand{hmwkTitle}{Assignment #1} % Assignment tle
newcommand{hmwkDueDate}{Monday, January 1, 2012} % Due date
newcommand{hmwkClass}{COMPSCI 101} % Course/class
newcommand{hmwkClassTime}{10:30am} % Class/lecture me
newcommand{hmwkClassInstructor}{Jones} % Teacher/lecturer
newcommand{hmwkAuthorName}{John Smith} % Your name
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
tle{
vspace{2in}
textmd{textbf{hmwkClass: hmwkTitle}}
normalsizevspace{0.1in}small{Due on hmwkDueDate}
vspace{0.1in}large{tex t{hmwkClassInstructor hmwkClassTime}}
vspace{3in}
}
author{textbf{hmwkAuthorName}}
date{} % Insert date here if you want it to appear below your name
%----------------------------------------------------------------------------------------
begin{document}
make tle
%----------------------------------------------------------------------------------------
% TABLE OF CONTENTS
%----------------------------------------------------------------------------------------
%setcounter{tocdepth}{1} % Uncomment this line if you don't want subsec ons listed in the
ToC
newpage
tableofcontents
newpage
%----------------------------------------------------------------------------------------
% PROBLEM 1
%----------------------------------------------------------------------------------------
% To have just one problem per page, simply put a clearpage a er each problem
begin{homeworkProblem}
Lis ng ref{homework_example} shows a Perl script.
perlscript{homework_example}{Sample Perl Script With Highligh ng}
lipsum[1]
23. end{homeworkProblem}
%----------------------------------------------------------------------------------------
% PROBLEM 2
%----------------------------------------------------------------------------------------
begin{homeworkProblem}
lipsum[2]
problemAnswer{
begin{center}
includegraphics[width=0.75columnwidth]{example_figure} % Example image
end{center}
lipsum[3-5]
}
end{homeworkProblem}
%----------------------------------------------------------------------------------------
end{document}
3. Assignment_3.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short Sec oned Assignment
% LaTeX Template
% Version 1.0 (5/5/12)
%
% This template has been downloaded from:
% h p://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (h p://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (h p://crea vecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size
usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to
return to the LaTeX default
usepackage[english]{babel} % English language/hyphena on
usepackage{amsmath,amsfonts,amsthm} % Math packages
24. usepackage{lipsum} % Used for inser ng dummy 'Lorem ipsum' text into the template
usepackage{sectsty} % Allows customizing sec on commands
allsec onsfont{centering normalfontscshape} % Make all sec ons centered, the default
font and small caps
usepackage{fancyhdr} % Custom headers and footers
pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers
and footers
fancyhead{} % No page header - if you want one, create it in the same way as the footers
below
fancyfoot[L]{} % Empty le footer
fancyfoot[C]{} % Empty center footer
fancyfoot[R]{thepage} % Page numbering for right footer
renewcommand{headrulewidth}{0pt} % Remove header underlines
renewcommand{footrulewidth}{0pt} % Remove footer underlines
setlength{headheight}{13.6pt} % Customize the height of the header
numberwithin{equa on}{sec on} % Number equa ons within sec ons (i.e. 1.1, 1.2, 2.1, 2.2
instead of 1, 2, 3, 4)
numberwithin{figure}{sec on} % Number figures within sec ons (i.e. 1.1, 1.2, 2.1, 2.2
instead of 1, 2, 3, 4)
numberwithin{table}{sec on} % Number tables within sec ons (i.e. 1.1, 1.2, 2.1, 2.2 instead
of 1, 2, 3, 4)
setlengthparindent{0pt} % Removes all indenta on from paragraphs - comment this line
for an assignment with lots of text
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
newcommand{horrule}[1]{rule{linewidth}{#1}} % Create horizontal rule command with 1
argument of height
tle{
normalfont normalsize
textsc{university, school or department name} [25pt] % Your university, school and/or
department name(s)
horrule{0.5pt} [0.4cm] % Thin top horizontal rule
huge Assignment Title % The assignment tle
horrule{2pt} [0.5cm] % Thick bo om horizontal rule
}
author{John Smith} % Your name
date{normalsizetoday} % Today's date or a custom date
begin{document}
25. make tle % Print the tle
%----------------------------------------------------------------------------------------
% PROBLEM 1
%----------------------------------------------------------------------------------------
sec on{Problem tle}
lipsum[2] % Dummy text
begin{align}
begin{split}
(x+y)^3 &= (x+y)^2(x+y)
&=(x^2+2xy+y^2)(x+y)
&=(x^3+2x^2y+xy^2) + (x^2y+2xy^2+y^3)
&=x^3+3x^2y+3xy^2+y^3
end{split}
end{align}
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. E am
ultricies nisi vel augue. Curabitur ullamcorper ultricies
%------------------------------------------------
subsec on{Heading on level 2 (subsec on)}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
begin{align}
A =
begin{bmatrix}
A_{11} & A_{21}
A_{21} & A_{22}
end{bmatrix}
end{align}
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque pena bus et magnis
dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque
eu, pre um quis, sem.
%------------------------------------------------
subsubsec on{Heading on level 3 (subsubsec on)}
lipsum[3] % Dummy text
paragraph{Heading on level 4 (paragraph)}
lipsum[6] % Dummy text
%----------------------------------------------------------------------------------------
% PROBLEM 2
%----------------------------------------------------------------------------------------
26. sec on{Lists}
%------------------------------------------------
subsec on{Example of list (3*itemize)}
begin{itemize}
item First item in a list
begin{itemize}
item First item in a list
begin{itemize}
item First item in a list
item Second item in a list
end{itemize}
item Second item in a list
end{itemize}
item Second item in a list
end{itemize}
%------------------------------------------------
subsec on{Example of list (enumerate)}
begin{enumerate}
item First item in a list
item Second item in a list
item Third item in a list
end{enumerate}
%----------------------------------------------------------------------------------------
end{document}