Skip to content

Instantly share code, notes, and snippets.

@ahoy-jon
Created September 13, 2010 13:44
Show Gist options
  • Save ahoy-jon/577292 to your computer and use it in GitHub Desktop.
Save ahoy-jon/577292 to your computer and use it in GitHub Desktop.
% Initial Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
% Copyright (c) 2008, Gael Varoquaux
% License: BSD Style.
% Author : Alexis Guéganno
% Author : Jonathan Winandy
%%%%%%%%% RST2NEW-LATEX STYLESHEET %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For ltxgrid to work.
%\makeatletter
%\newcommand{\class@name}{gael}
%\makeatother
\newcommand{\DSearly}{%
% For smaller font size.
\providecommand{\Ddocumentoptions}{a4paper,fontsize=12pt}
\usepackage{pslatex}
\usepackage{geometry}
\usepackage[english]{babel}
\geometry{a4paper, left=2.9cm, right=2.3cm, top=3cm, bindingoffset=0cm,
textheight=22.7cm}
%\usepackage{ltxgrid}
}
\newcommand{\DSlate}{%
\usepackage{picins}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{fancyhdr}
\usepackage{fancybox}
\usepackage{setspace}
\usepackage{pdfpages}
\usepackage{float}
\usepackage{pygments-default}
%\usepackage{verbatim}
\definecolor{SkoleBrown}{RGB}{150,100,50}
\definecolor{SkoleYellow}{RGB}{232,183,3}
\definecolor{SkoleOrange}{RGB}{252,135,36}
\colorlet{SkoleLightBrown}{SkoleBrown!50!SkoleYellow}
\colorlet{codeblockcolorbase}{SkoleLightBrown!80!black}
\colorlet{mycodeblockcolor}{codeblockcolorbase!08}
\colorlet{bluecolor}{blue!50!black}
\colorlet{sidebarcolor}{bluecolor!20}
\definecolor{darkred}{rgb}{0.4, 0, 0}
\definecolor{darkgrey}{rgb}{0.2,0.2,0.2}
\definecolor{darkgreen}{rgb}{0.20,0.40,0}
\colorlet{titlecolor}{darkred}
\colorlet{deeptitlecolor}{darkgreen}
\renewcommand\familydefault{\sfdefault}
\newlength{\rtitleident}
\setlength\rtitleident{0cm}
\leftskip = 0 cm
\rightskip = 0cm
\rtitleident = -0.7cm
\newcommand\customauthor{}
\newcommand\dcustomauthor[1]{%
\renewcommand{\customauthor}{##1}%
}
% Distance between two columns
\setlength\columnsep{4em}
\setcounter{page}{1}%
\fancyhf{} %delete the current section for header and footer
% \fancyfoot[LE,RO]{\sffamily\bfseries\thepage}
% \fancyfoot[LO]{\bfseries\rightmark}
% \fancyfoot[RE]{\bfseries\leftmark}
\lfoot{\customauthor}
\rfoot{\thepage}
\cfoot{}
%\newcommand{\headwidth}{}
\headwidth = 0cm
\addtolength{\headwidth}{\linewidth}%-2\rightskip
%\addtolength{\headwidth}{-1.0\rtitleident}
\fancyhfoffset[L]{-\rtitleident}
\newcommand{\mycustomrightmark}{}
\newcommand{\mycustomleftmark}{}
\rhead{\mycustomrightmark}
\lhead{\mycustomleftmark}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
%\pagestyle{fancy}
\thispagestyle{empty}%
% Override the LaTeX positioning parameters
\def\textfraction{0.01}
\def\topfraction{0.9}
\def\floatpagefraction{0.9}
\flushbottom
\setstretch{1.3}
\setlength\parindent{0cm}
% \setlength\parskip{1cm}
\setlength{\parskip}{0.5\baselineskip}
\color{darkgrey}
}
\newcommand{\Dparagraphspace}{\vspace{0.5cm}\par}
\newenvironment{MyVerbatim}%
{\begin{Sbox}
\par\hspace{-1.2cm}\begin{minipage}[T]{1\linewidth}\scriptsize}%
{\vspace{0.3cm}\end{minipage}
\end{Sbox}
\def\FrameCommand{\mycolorbox}%
{%
\setlength\hsize{0.95\linewidth}%
%\advance\hsize -\leftmargin
\par\vspace*{-1.4em}%
\MakeFramed {\FrameRestore}%
\raggedright\noindent\nohyphens{%
\textnhtt{\scriptsize%
\TheSbox}}\hspace*{\leftsidespace}%
\endMakeFramed%
}%
\par}
\providecommand{\DNimageAuri}[5]{%
% Insert image. We treat the URI like a path here.
\renewcommand{\Dimagepath}{\Dimagebase#3}%
\Difdefined{DEVcurrentNimageAscale} {
\newcounter{myscale}%
\setcounter{myscale}{\DEVcurrentNimageAscale}%
\Dscaleimage{0.\DEVcurrentNimageAscale}{\Dimagepath}%
}{%
\Difdefined{DEVcurrentNimageAwidth}{%
\Dwidthimage{\DEVcurrentNimageAwidth}{\Dimagepath}%
}{%
\Dsimpleimage{\Dimagepath}%
}%
}%
}
\providecommand{\Dmywidthimage}[2]{%
% Image with specified width.
% Parameters:
% 1. Image width.
% 2. Image path.
% Need to make bottom-alignment dependent on align attribute (add
% functional test first). Need to observe height attribute.
%\begin{minipage}[b]{#1}%
%\end{minipage}%
}
\providecommand{\Dcurrentimagemaxwidth}{}
\providecommand{\Dscaleimage}[2]{%
% Image with specified width.
% Parameters:
% 1. Image width.
% 2. Image path.
% Need to make bottom-alignment dependent on align attribute (add
% functional test first). Need to observe height attribute.
%\begin{minipage}[b]{#1}%
\settowidth{\Dcurrentimagewidth}{\includegraphics[scale=#1]{#2}}
\ifthenelse{\equal{\Dinsidehalign}{true}}{%
\renewcommand{\Dcurrentimagemaxwidth}{\Dfloatimagemaxwidth}%
}{%
\renewcommand{\Dcurrentimagemaxwidth}{\Dimagemaxwidth}%
}%
\ifthenelse{\lengthtest{\Dcurrentimagewidth>\Dcurrentimagemaxwidth}}{%
\includegraphics[width=\Dcurrentimagemaxwidth,keepaspectratio]{#2}%
}{%
\includegraphics[scale=#1]{#2}%
}%
%\end{minipage}%
}
%
% \providecommand{\DNimageAwidth}[5]{%
% \Dsimpleimage{\Dimagepath}%
% Plouf
% \Dwidthimage{#3}{\Dimagepath}%
% }
% \providecommand{\DNtopic}[1]{%
% \ifthenelse{\equal{\DcurrentNtopicAcontents}{1}}{%
% \newpage
% \setlength\parskip{0.1cm}%
% \addtocounter{Dtoclevel}{1}%
% \par\noindent%
% #1%
% \addtocounter{Dtoclevel}{-1}%
% %\setlength\parskip{0.5cm}%
% }{%
% \par\noindent%
% \Dmakebox{#1}%
% }%
% }
\providecommand{\DNadmonition}[1]{%
\
\definecolor{MyGray}{rgb}{0.97,0.97,0.97}%
\begin{figure*}[htb!]%
\vspace{1cm}%
\colorbox{MyGray}{
\begin{minipage}[h]{0.97\linewidth}
\vspace{0.5cm}
\begin{center}
\begin{minipage}[h]{0.95\linewidth}
#1
\end{minipage}%
\end{center}
\vspace{0.5cm}
\end{minipage}%
}
\end{figure*}%
}
\newlength\leftsidespace
\def\mycolorbox#1{%
\setlength\leftsidespace{\textwidth}
\advance\leftsidespace -\linewidth
\begin{minipage}{\textwidth}
\mbox{
\begin{minipage}{.37\leftsidespace}
~
\end{minipage}
\fcolorbox{black!50}{mycodeblockcolor!50}{#1}
}
\end{minipage}
}
\providecommand{\DNtable}[1]{
\begin{figure*}[htb!]
\begin{minipage}{0.95\linewidth}
#1
\end{minipage}
\end{figure*}
}
\providecommand{\DNsidebar}[1]{%
\begin{figure}
\hspace*{-0.1\linewidth}
\fcolorbox{black!80}{sidebarcolor}{
\begin{minipage}{1.1\linewidth}
\small #1
\end{minipage}
}
\end{figure}
}
\providecommand{\DNfigure}[1]{%
\begin{figure}[htb]
\begin{minipage}[T]{1\linewidth}
#1
\end{minipage}
\end{figure}
}
\newcounter{myfigcounter}
\providecommand{\DNcaption}[1]{%
\vspace{-0.5em}
\noindent\rule{\linewidth}{0.05cm}
\addtocounter{myfigcounter}{1}
{\sffamily\small{\bfseries Figure \arabic{myfigcounter}:} #1}
}
\providecommand{\DNnote}[1]{%
{%
\hyphenpenalty=1
\tolerance=10
\sffamily\bfseries\slshape #1}
}
\newcommand{\DNliteralblock}[1]{%
\def\FrameCommand{\mycolorbox}%
{%
\setlength\hsize{0.95\linewidth}%
%\advance\hsize -\leftmargin
\par\vspace*{-1.4em}%
\MakeFramed {\FrameRestore}%
\raggedright\noindent\nohyphens{%
\textnhtt{\scriptsize%
#1}}\hspace*{\leftsidespace}%
\endMakeFramed%
}%
}%
% Titles
\newcommand{\Ddocumenttitle}[1]{%
\begin{center}{\Huge\sffamily\bfseries\textcolor{titlecolor}{#1}}\end{center}%
\providecommand{\Dhassubtitle}{\DEVhassubtitle}%
\ifthenelse{\equal{\Dhassubtitle}{true}}{\vspace{0.1cm}}{
%\twocolumngrid
\vspace{1.5cm}}%
%\newpage
}
%--------------------------------
\newcommand{\Dsectiontitlei}[1]{%
% \renewcommand{\mycustomleftmark}{#1}%
\clearpage{}
\pagebreak[5]
\newpage{}
\vbox{
\vskip 2em plus 1.5em minus 0.5em%
\noindent\textcolor{titlecolor}{\begin{center}\LARGE\bfseries\sffamily
\hyphenpenalty=1000
\tolerance=500
\noindent#1%
\end{center}%
%\\[-.5em]\noindent\rule{\linewidth}{0.2ex}
}
}
\vskip 2em plus 2em minus 0.5em
}
\newcommand{\Dsectiontitleii}[1]{%
%\renewcommand{\mycustomrightmark}{#1}%
\widowpenalty=50%
\clubpenalty=50%
\vskip 2em plus 3em minus 0.5em%
\pagebreak[3]
\begin{minipage}{\linewidth}
{\setlength\parindent{\rtitleident}%
\Large\indent\textcolor{titlecolor}{\Large\bfseries\sffamily
#1%
\addtolength{\linewidth}{-1.0\rtitleident}%
\\[-0.5em]\indent\rule{\linewidth}{0.2ex}}%
}
\end{minipage}
\vskip 0.5em plus 0.5em minus .2em%
}
\newcommand{\Dsectiontitleiii}[1]{
\vskip 1em plus 1em minus 0.5em%
\pagebreak[2]
{\setlength\parindent{\rtitleident}%
\Large\indent\color{darkgreen}{\bfseries\sffamily #1 }%
%\\[-1em]\hrule
}%
\vskip .5em plus 0.5em minus .2em%
}
%-------
% \newcommand{\Dsectiontitleiiii}[1]{
% \vskip 0.5em plus 1em minus 0.5em%
% \pagebreak[2]
% {\setlength\parindent{\rtitleident}%
% \large\indent\color{red}{\bfseries\sffamily #1 }%
% %\\[-1em]\hrule
% }%
% \vskip .5em plus .5em minus .2em%
% }
%
%
% \newcommand{\Dsectiontitleiiiii}[1]{
% \vskip 0.5em plus 1em minus 0.5em%
% \pagebreak[2]
% {\setlength\parindent{\rtitleident}%
% \large\indent\color{red}{\bfseries\sffamily #1 }%
% %\\[-1em]\hrule
% }%
% \vskip .5em plus .5em minus .2em%
% }
\newcommand{\Ddeepsectiontitle}[1]{
\vskip 0.5em plus 1em minus 0.5em%
\pagebreak[2]
{\setlength\parindent{\rtitleident}%
\indent\color{darkgreen}}{\bfseries\sffamily #1 }%
%\\[-1em]\hrule
}%
\vskip .5em plus 0em minus .2em%
}
\newcommand{\Dsetlistrightmargin}{%
\setlength{\rightmargin}{0pt}%
}%
\newcommand{\Dformatblockquote}[1]{%
{#1}%
}
\newcommand{\Dexplicitreferencecolor}{titlecolor}
% Default role.
\newcommand{\DNtitlereference}[1]{
{%
\begin{flushright}%
\begin{minipage}{0.9\linewidth}
\color{black}
\indent \emph{#1}
\end{minipage}%
\end{flushright}%
}}
\newcommand{\DNparagraph}[1]{
% I want proper hyphenation!
%\hyphenpenalty 1
%\exhyphenpenalty 1
\tolerance 1000
%\emergencystretch 5em%
%\hfuzz 0pt
%\vfuzz\hfuzz
%\widowpenalty=10000
#1
}
\newcommand{\DECdepartdocument}{
\end{document}
}
\newcommand{\DNcitation}[1]{
\small {
\setlength{\parskip}{0.1\baselineskip}
#1
\setlength{\parskip}{0.5\baselineskip}
}
\par
}
\providecommand{\Dformatcitationlabel}[1]{{[}{\bfseries #1}{]}{ }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment