% Title: Perl 5 Tutorial
% Author: Chan Bernard Ki Hong

% Filename: macros.tex
% Description: Macros
% Last Updated on 14/06/2002

% General shortcuts
\newcommand{\bs}{\textbackslash}

% Inline monospace text
\newcommand{\mono}[1]{\texttt{#1}}

\definecolor{CodeBackground}{rgb}{0.8,0.8,0.8}

% Itemized list (Bullet points)
\renewcommand{\labelitemi}{\Large $\star$}
\setlength{\labelsep}{16pt}

% Box widths and margins
\setlength{\fboxsep}{1mm}
\setlength{\fboxrule}{1.5pt}

% A paragraph
\newcommand{\p}[1]{#1 \vspace{\baselineskip}}

% superscript
\newcommand{\super}{\textsuperscript}

% terms 
\newcommand{\term}[1]{\textbf{#1}\index{#1}}

% a URL hyperlink
\definecolor{LinkColor}{rgb}{0,0,1}
\newcommand{\link}[2]{\textcolor{LinkColor}{\href{#1}{#2}}}

% Example headings
\definecolor{exampleBg}{rgb}{0.5,0,0}
\newlength{\cwidth}
\addtolength{\cwidth}{\textwidth}
\addtolength{\cwidth}{-2mm}
\addtolength{\cwidth}{-3pt}
\newcommand{\head}[2]{\addtocounter{examplectr}{1}
\fcolorbox{exampleBg}{exampleBg}{\parbox[t]{\cwidth}{ %
\textcolor{white}{\fontfamily{phv} \textbf{#1 \thechapter.\theexamplectr \hspace{0.6cm} #2}} %
}}
}

% Notes, Terminology
\definecolor{boxBg}{rgb}{0.75, 0.75, 0.75}
\newcommand{\specialbox}[2]{%
%\setlength{\FrameRule}{2pt}
\begin{table}[htbp]\begin{center}
\fcolorbox{black}{boxBg}{\setlength{\fboxsep}{1cm} \parbox[t]{13cm}{ %
%\MakeFramed {\FrameRestore}{\setlength{\FrameSep}{1cm} \parbox[t]{13cm}{ %
\textbf{#1} \vspace{0.5cm} \\%
\small #2 
%}}\endMakeFramed
}}
\end{center}\end{table}
}

% Different font in captions (http://www.fysik.dtu.dk/~schiotz/comp/latextips/)
\newcommand{\captionfonts}{\small \em}

\makeatletter  % Allow the use of @ in command names
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{{\captionfonts #1: #2}}%
  \ifdim \wd\@tempboxa >\hsize
    {\captionfonts #1: #2\par}
  \else
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\makeatother   % Cancel the effect of \makeatletter

% Images
\newcommand{\image}[6]{
\begin{figure}[#1]\centering \resizebox{#2}{#3}{\includegraphics{#4}}
\caption{#5} \label{#6}\end{figure}
}

\definecolor{optionalargs}{rgb}{0,0.6,0}
\newcommand{\br}{\vspace{0.5\baselineskip}}

\newenvironment{summary}{
\renewcommand{\labelitemi}{\Rectsteel} 
\renewcommand{\labelitemii}{$\bullet$} 
\begin{itemize}
\setlength{\itemsep}{0cm}
}{\end{itemize}}


