%
% Konfigurasi LaTeX untuk laporan thesis/ta/skripsi/sp sesuai dengan aturan UI
% 
% @author  Andreas Febrian
% @version 1.03
% @edit by Anggoro Dwi Nur Rohman
%
% Terima kasih untuk: 
% 1. Lia Sadita 
% 2. Andre Tampubolon
% 3. Erik Dominikus
%

%
% Konfigurasi ini dibuat dengan menggunakan:
% - konfigurasi laporan TA yang digunakan Fahrurrozi Rahman
% - konfigurasi LaTeX untuk proceeding ICACSIS 2009 yang dibuat oleh Andreas 
%	Febrian dan Andre Tampubolon
% - Laporan Thesis yang dibuat Andreas Febrian
% 


%-----------------------------------------------------------------------------%
% Package
%-----------------------------------------------------------------------------%

% 
% Digunakan untuk branching documentclass
%
\usepackage{fetchcls}

\@ifclassloaded{article}
{
  \usepackage[sc]{mathpazo} % Use the Palatino font
  \usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
  \linespread{1.05} % Line spacing - Palatino needs more space between lines
  \usepackage{microtype} % Slightly tweak font spacing for aesthetics


  \usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
  \usepackage{booktabs} % Horizontal rules in tables

  \usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text

  \usepackage{enumitem} % Customized lists
  \setlist[itemize]{noitemsep} % Make itemize lists more compact

  \usepackage{abstract} % Allows abstract customization
  \renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
  \renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

  \usepackage{titlesec} % Allows customization of titles
  \renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
  \renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
  \titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
  \titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

  % \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
  % \fancyhead[C]{Running title $\bullet$ May 2016 $\bullet$ Vol. XXI, No. 1} % Custom header text
  % \fancyfoot[RO,LE]{\thepage} % Custom footer text

  \usepackage{titling} % Customizing the title section

  % \usepackage{hyperref} % For hyperlinks in the PDF
  \usepackage{multicol}


}
{

}
%
% From The tocbibind package [author: Peter Wilson, Herries Press]:
% The tocbibind package can be used to add document elements like a 
% bibliography or an index to the Table of Contents. The package is designed 
% to work with the four standard book, report, article and proc classes, and to 
% a limited extent with the ltxdoc class.
% 
\usepackage{tocbibind}

%
% From [Wikipedia]:
% The package hyperref provides LaTeX the ability to create hyperlinks within 
% the document. It works with pdflatex and also with standard "latex" used with 
% dvips and ghostscript or dvipdfm to build a PDF file. For example: 
%	- \hyperref[mainlemma]{lemma \ref{mainlemma}}
%	- \url{http://www.wikibooks.org}
%	- \href{http://www.wikibooks.org}{wikibooks home}
%	- \href{mailto:my_address@wikibooks.org}{
%		\nolinkurl{my_address@wikibooks.org}}
% 
\usepackage{hyperref}
  \hypersetup{
  	a4paper, 
  	colorlinks=false,
  	pdfborder=0 0 0,
  	linkcolor=blue,
  	citecolor=black,
  	bookmarksopen=false,
  	bookmarksnumbered=true,
  	pdfstartview=FitH,
  	pdfview=FitH
	}

%
% The url package allows spacing and line breaks that result in intelligent 
% printing of email addresses, hypertext links, and path or directory addresses. 
% You must enter package commands in TeX fields. The address, link, path, or 
% directory address specified in the command must not contain unbalanced braces. 
% If it doesn't contain certain other characters (such as % or #) and doesn't 
% end with a backslash, you can use the command in the argument to another 
% command.
% 
\usepackage{url}
  \urlstyle{same}
  
% 
%  Agar tabel bisa menggunakan rowspan atau colspan. 
% 
\usepackage{multirow}

%
% Digunakan untuk memasukan gambar ke laporan. 
% 
\usepackage{graphicx}

%
% Digunakan untuk mengantur line spacing pada laporan. Umumnya spacing yang 
% digunakan adalah 1.5. 
% 
\usepackage{setspace}
  \onehalfspacing
  %\doublespacing
  %\singlespacing
  
%
% From Rforge:
% The geometry package controls the overall margins and text area of the 
% document. The package must be called in the preamble of the document and 
% specified when called.
% 
\@ifclassloaded{report}
{
  \usepackage[paper=a4paper,headheight=0pt,left=4cm,top=3cm,right=3cm,bottom=3cm]{geometry}
}

% 
% Digunakan untuk mengatur caption dalam dokumen.
% 

\@ifclassloaded{report}
{
  \usepackage[font=footnotesize,format=plain,labelfont=bf,up,textfont=up]{caption}
}
{

}

% digunakan untuk membuat sub gambar didalam figure
% usepackage dilakukan setelah caption,
% 
\usepackage{subcaption}

% 
% Membantu penulisan notasi matematika terutama untuk dokumen dengan banyak 
% rumus. 
% 
\usepackage{amsmath, amsfonts, stmaryrd, amssymb}

% 
% Membuat seluruh tulisan menjadi Times New Roman.
% 
\usepackage{pslatex}

% 
% Package untuk membuat header dan footer pada dokumen. 
% 
\usepackage{fancyhdr}

% 
% Package untuk memasukan berkas pdf sebagai bagian dari dokumen.
% 
\usepackage{pdfpages}

% 
% Membantu dalam mengatur jarak antara tepi kertas dengan posisi header. 
% 
\usepackage[ConnyRevised]{fncychap}

% 
% Digunakan untuk membuat tabel berwarna-warni. 
% 
\usepackage{colortbl}

% 
% 
% 
\usepackage{float}
\floatplacement{figure}{H}
\floatplacement{table}{H}

% Untuk mengatur ukuran font
%
\usepackage{anyfontsize}
%
% Digunakan untuk nomor dengan format inline
%
\@ifclassloaded{report}
{
  \usepackage[inline]{enumitem}
}
{
  
}
%
% Menggunakan biblatex untuk referensi
%
\@ifclassloaded{article}
{
  \usepackage[backend=bibtex,autocite=inline,sorting=none]{biblatex}
}
{

}
\@ifclassloaded{report}
{
  \usepackage[backend=bibtex, style=authoryear-icomp,autocite=inline,]{biblatex}
}
{

}
%
% Digunakan untuk menghasilkan tabel pseudocode
%
\usepackage{xcolor}
\@ifclassloaded{report}
{
  \usepackage[linesnumbered,ruled,vlined,algochapter]{algorithm2e}
}
{

}

\@ifclassloaded{article}
{
  \usepackage[linesnumbered,ruled,vlined]{algorithm2e}
}
{

}
%
% Digunakan untuk membuat mind map
%
\usepackage{siunitx}
\usepackage{tikz} % To generate the plot from csv
\usetikzlibrary{mindmap}
%
% Digunakan untuk plot data
%
\usepackage{pgfplots}
\pgfplotsset{compat=newest} % Allows to place the legend below plot
\usepgfplotslibrary{units} % Allows to enter the units nicely
\sisetup{
  round-mode          = places,
  round-precision     = 2,
}

\usepackage{gantt}
%-----------------------------------------------------------------------------%
% Konfigurasi
%-----------------------------------------------------------------------------%
\sloppy

\newif\ifpdf
\ifx\pdfoutput\undefined
   \pdffalse 
\else
   \pdfoutput=1
   \pdftrue
\fi


% link page numbers in TOC 
% \makeatletter
\def\contentsline#1#2#3#4{%
  \ifx\\#4\\%
    \csname l@#1\endcsname{#2}{#3}%
  \else
    \csname l@#1\endcsname{%
      \hyper@linkstart{link}{#4}{#2}\hyper@linkend
    }{%
      % same link destination for the page:
      \hyper@linkstart{link}{#4}{#3}\hyper@linkend
      % link destination is the page itself:
      % \hyperpage{#3}%
    }%
  \fi
}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                  {-3.5ex \@plus -1ex \@minus -.2ex}%
                                  {2.3ex \@plus.2ex}%
                                  {\large\bfseries}}
% \makeatother


%
% Atur header dan footer dalam dokumen.
% 
\@ifclassloaded{report}
{

\setcounter{secnumdepth}{3}

\setcounter{tocdepth}{3}

  \renewcommand{\headrulewidth}{0.0pt}
  	\fancyhf{} 
	\fancyhf{} 
  	\fancyhf{} 
	\fancyhf{} 
  	\fancyhf{} 
  	\fancyhead[L]{} 
	\fancyhead[L]{} 
  	\fancyhead[L]{} 
	\fancyhead[L]{} 
  	\fancyhead[L]{} 
  	\fancyhead[C]{} 
	\fancyhead[C]{} 
  	\fancyhead[C]{} 
	\fancyhead[C]{} 
  	\fancyhead[C]{} 
  	\fancyhead[R]{\thepage} 
	\fancyhead[R]{\thepage} 
  	\fancyhead[R]{\thepage} 
	\fancyhead[R]{\thepage} 
  	\fancyhead[R]{\thepage} 
  	\renewcommand{\headrulewidth}{0.0pt} 
	\renewcommand{\headrulewidth}{0.0pt} 
  	\renewcommand{\headrulewidth}{0.0pt} 
	\renewcommand{\headrulewidth}{0.0pt} 
  	\renewcommand{\headrulewidth}{0.0pt} 
  	\fancyfoot[R]{\footnotesize \bo{ }} 
	\fancyfoot[R]{\footnotesize \bo{ }} 
  	\fancyfoot[R]{\footnotesize \bo{ }} 
	\fancyfoot[R]{\footnotesize \bo{ }} 
  	\fancyfoot[R]{\footnotesize \bo{ }} 
  	\renewcommand{\footrulewidth}{0.0pt} 
	\renewcommand{\footrulewidth}{0.0pt} 
  	\renewcommand{\footrulewidth}{0.0pt} 
	\renewcommand{\footrulewidth}{0.0pt} 
  	\renewcommand{\footrulewidth}{0.0pt} 
  \pagestyle{fancy}
}
{

}

\@ifclassloaded{article}
{
  \pagestyle{fancy} % All pages have headers and footers
  \fancyhead{} % Blank out the default header
  \fancyfoot{} % Blank out the default footer
  % \fancyhead[C]{Running title $\bullet$ May 2016 $\bullet$ Vol. XXI, No. 1} % Custom header text
  \fancyhead{}
  \fancyfoot[RO,LE]{\thepage} % Custom footer tex
}
{

}



%-----------------------------------------------------------------------------%
% Perintah Baru
%-----------------------------------------------------------------------------%

%
% Untuk mengimport data *.csv menjadi grafik
% nb: Pada line pertama di file *.csv harus diberi nama colomnya
%     contoh pada file *.csv :
%     1>colom_x,colom_y,colom_z
%     2>0.0334,0.4455,0.11223
%     3>...,...,...
% Parameter : 1 -> no marks / only marks
%             2 -> nama colom untuk menjadi sumbu X
%             3 -> nama colom untuk menjadi sumbu Y
%             4 -> label untuk sumbu x
%             5 -> label untuk sumbu y
%             6 -> path dari file *.csv
\newcommand{\dataGraph}[6][no marks]{
  \begin{tikzpicture}
    %%https://www.latex-tutorial.com/tutorials/pgfplots/
    \begin{axis}[
        width=\linewidth, % Scale the plot to \linewidth
        grid=major, % Display a grid
        grid style={dashed,gray!30}, % Set the style
        xlabel=#4, % Set the labels
        ylabel=#5,
        #1
      ]
      \addplot
      table[x=#2,y=#3,col sep=comma]{#6};
    \end{axis}
  \end{tikzpicture}
}
% Parameter : 1 -> no marks / only marks
%             2 -> label untuk sumbu x
%             3 -> label untuk sumbu y
%             4 -> lagend entries = {plota , plotb, plot c}
%             5 -> \addplot
%                   table[x=<var in tabel x>,y=<var in tabel y,col sep=comma]{<path tabel>};
\newcommand{\dataMultiGraph}[5][no marks]{
  \begin{tikzpicture}
    %%https://www.latex-tutorial.com/tutorials/pgfplots/
    \begin{axis}[
        width=\linewidth, % Scale the plot to \linewidth
        grid=major, % Display a grid
        grid style={dashed,gray!30}, % Set the style
        xlabel=#2, % Set the labels
        ylabel=#3,
        #1,
        legend entries = {#4}
      ]
      #5
    \end{axis}
  \end{tikzpicture}
}

%
% Mengganti .et.al pada sitasi dengan dkk
\DefineBibliographyStrings{english}{andothers={\addcomma~dkk}}
%
% Mengganti penghubung 'and' dengan 'dan' pada penghubung mlti name sitasi
\DeclareDelimFormat{finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \addcomma~\addspace~dan~\space}
% 
% Perintah untuk membuat huruf tecetak miring. (alias)
\newcommand{\f}[1]{\textit{#1}}
% 
% Perintah untuk huruf tercetak tebal dan miring. 
\newcommand{\bi}[1]{\textbf{\textit{#1}}}
% 
% Perintah untuk huruf tercetak tebal.
\newcommand{\bo}[1]{\textbf{#1}}
% 
% 
\newcommand{\m}[1]{\boldmath{ \( #1 \)}}
% 
% 
\newcommand{\mc}[1]{\boldmath{ \[ #1 \]}}
% 
% 
\newcommand{\code}[1]{{\ttfamily #1}}
% 
% Buat catatan kecil. Catatan akan ditampilkan dalam tabel. 
\newcommand{\todo}[1]{
    \begin{tabular}{| p{13.5cm} |}
		\rowcolor[rgb]{.9,.6,.6}
		\bo{@todo} \\
		\rowcolor[gray]{1.}
		 #1 \\
		 \\
		\hline
	\end{tabular}
    }
% 
% Buat catatan untuk menambahkan referensi. 
\newcommand{\todoCite}{
	\begin{tabular}{| l |}
		\rowcolor[rgb]{.6,.9,.6}
		\bo{@todo} \\
		\rowcolor[gray]{1.} 
		 Referensi \\
		 \\
		\hline
	\end{tabular}
    }
% 
% Tambahkan berkas PDF ke dalam laporan dan gunakan style laporan  
% terhadap berkas ini. 
\newcommand{\inpdf}[1]{
	\includepdf[pages=-,pagecommand={\thispagestyle{fancy}}]{#1.pdf}}
% 
% Tambahkan berkas PDF ke dalam laporan. 
\newcommand{\putpdf}[1]{\includepdf[pages=-]{#1.pdf}}
% 
% Perintah untuk membuat perintah/variabel baru. 
\newcommand{\var}[2]{\newcommand{#1}{#2}}
% 
% Perintah untuk membuat perintah/variabel baru. Teks yang ditulis dalam 
% perintah ini akan diformat ulang menggunakan huruf kapital. 
\newcommand{\Var}[2]{\newcommand{#1}{\uppercase{#2}}}
% 
% Tambahkan kata-kata yang dimasukan kedalam Table of Contents. 
\newcommand{\addChapter}[1]{\phantomsection \addcontentsline{toc}{chapter}{#1}}
% 
% Alias untuk perintah \LaTeX
\newcommand{\latex}{\LaTeX}
%
% 
% fix link daftar isi yang sebelumnya ngelink ke halaman sebelumnya
\newcommand{\daftaIsi}{\phantomsection \tableofcontents}
\newcommand{\daftarGambar}{\phantomsection \listoffigures}
\newcommand{\daftarTabel}{\phantomsection \listoftables}
\@ifclassloaded{report}
{
  \newcommand{\kutip}[1]{\citeauthor*{#1}\space(\citeyear{#1})}
}
{

}

\@ifclassloaded{article}
{
  \newcommand{\kutip}[1]{\cite{#1}}
}
{

}

\newcommand{\kutipLs}[1]{\citeauthor*{#1},\citeyear{#1}}
\newcommand{\kutipLsHal}[2]{\citeauthor*{#1}, \citeyear{#1}, #2}

%-----------------------------------------------------------------------------%
% Ubah Istilah Penulisan
%-----------------------------------------------------------------------------%
%
% Beberapa istilah yang tepat untuk digunakan dalam laporan.
% 
% 
\renewcommand{\contentsname}{Daftar Isi}
% 
% 
\renewcommand{\listfigurename}{Daftar Gambar}
% 
% 
\renewcommand{\listtablename}{Daftar Tabel}
% 
% 

\@ifclassloaded{report}
{
\renewcommand{\chaptername}{BAB}
}
{

}
% 
% 
\renewcommand{\figurename}{\bo{Gambar}}
% 
% 
\renewcommand{\tablename}{\bo{Tabel}}
% 
% 
\newcommand{\pic}{Gambar}
% 
% 
\newcommand{\tab}{Tabel}
% 
% 
\newcommand{\equ}{Persamaan}
%
%
%%% Merubah comment menjadi biru pada perintah algorthm
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\SetCommentSty{mycommfont}
\SetKwInput{KwInput}{Masukan}                % Set the Input
\SetKwInput{KwOutput}{Keluaran}              % set the Output
\SetKwFor{For}{Untuk}{Lakukan}{}
\SetAlgorithmName{Algoritme}{\autoref}{Daftar Algoritme}