

% My LaTeX-settings to be used with python-docutils and reStructuredText

% NOTE: Those font settings for chapter, section etc. titles do not
% work as intended, yet. See FIXMEs.

% Author:
% Juhapekka Tolvanen
% http://iki.fi/juhtolv
% juhtolv (at) iki (dot) fi

% This file is public domain. There is no warranty.

% This makes stfloats or fix2col obsolete. This loads fixltx2e.
%% "When the new output routine for LaTeX3 is done, this package will
%% be obsolete. The sooner the better..."
\RequirePackage{dblfloatfix}
% This makes type1cm and type1ec obsolete:
\RequirePackage{fix-cm}


%%% NOTE: If next line is in the end of the preamble, my bug will show up
\KOMAoptions{headings=big}

\setlength{\parindent}{1.5cm}
\usepackage{indentfirst}


% To ease checking pdf(la)tex with if-statements
\RequirePackage{ifpdf}

\RequirePackage{typearea}

%\setcounter{secnumdepth}{3}
\setcounter{secnumdepth}{7}

%%%%%%%%%%%%%%%%%%%%%
% Packages

\usepackage{slantsc}

%%% For some reason this is no more needed:
%\renewcommand{\encodingdefault}{U}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts
%

%%% Obsolete:
%\usepackage[utf8]{inputenc}
%\usepackage[EU1,T1]{fontenc}

% Most special chars, also copyleft
\usepackage{textcomp}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts in XeLaTeX way:

\usepackage{lmodern}

\RequirePackage{fontspec}
\RequirePackage{xltxtra}
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}

%%% http://www.alice-dsl.net/ralfstubner/fplneu-otf.html
%%% This is the old name for \setmainfont, retained for backwards compatibility.
%\setromanfont[Numbers=Lowercase]{FPL Neu}
 \setmainfont[Numbers=Lowercase]{FPL Neu}

%%% http://home.vr-web.de/was/x/FPL/
%%%\setromanfont{FPL Neu}
%%%\setmainfont{FPL Neu}


%%% http://www.ellak.gr/pub/fonts/mgopen/index.en.html
%\setsansfont{MgOpen Cosmetica}

%%% http://myria.math.aegean.gr/labs/dt/fonts-en.html
%%% FIXME: I’d like to use this this font, but it is buggy:
%%% WARNING ** Obsolete four arguments of "endchar" will be used for Type 1 "seac" operator.
%%% ** ERROR ** This font using the "seac" command for accented characters...
%%%\setsansfont{Epigrafica}

%%% http://en.wikipedia.org/wiki/Linux_Libertine
%%% http://www.linuxlibertine.org/
\setsansfont{Linux Biolinum O}

%%% http://en.wikipedia.org/wiki/Inconsolata
%%% http://www.levien.com/type/myfonts/inconsolata.html
%\setmonofont{Inconsolata}

%%% %%% http://dejavu-fonts.org/
\setmonofont{DejaVu Sans Mono}

%%% FIXME: I just can not make this to work:
%\renewcommand{\ttdefault}{txtt}


%%% http://en.wikipedia.org/wiki/M%2B_Fonts
%%% http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html
\newfontface\mytitlefont{M+ 1p black}
\newfontface\mysubtitlefont{M+ 1p heavy}

\newfontface\mysectionfont{M+ 1p black}
\newfontface\mysubsectionfont{M+ 1p heavy}
\newfontface\mysubsubsectionfont{M+ 1p bold}
\newfontface\myparagraphfont{M+ 1p medium}
\newfontface\mysubparagraphfont{M+ 1p regular}


% Now use that \mytitlefont .
\addtokomafont{title}{\mytitlefont\Huge}
\addtokomafont{subtitle}{\mysubtitlefont\huge}

% Not used in certain document classes
%\addtokomafont{part}{}
%\addtokomafont{partnumber}{}
%\addtokomafont{chapter}{}


\addtokomafont{section}{\mysectionfont\LARGE}
\addtokomafont{subsection}{\mysubsectionfont\Large}
\addtokomafont{subsubsection}{\mysubsubsectionfont\large}
\addtokomafont{paragraph}{\myparagraphfont\normalsize}
\addtokomafont{subparagraph}{\mysubparagraphfont\normalsize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% cmap: "Make the PDF files generated by pdflatex "searchable and copyable"
% in Adobe (Acrobat) Reader and other compliant PDF viewers."
% (Must be before fontenc-package)
\ifpdf % Some people may have buggy cmap.
\usepackage{cmap}
\fi

\ifpdf
\usepackage[protrusion=true,expansion=true,verbose=true,final=true]{microtype}
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%\usepackage{setspace}
%\singlespacing
%\onehalfspacing
%\spacing{1.7} % This causes bugs like this: (\end occurred inside a group at level 1) 
%\doublespacing


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% typearea -settings

%%% These can be defined in docutils.conf , too. Puncher makes holes
%%% 15 mm near the edge of A4-paper. Therefore BCOR has value 15 mm.
%%% If value of DIV is too small, you get Overfull \hbox -warnings
%%% very easily. If value of DIV is too big, you will find warnings
%%% like these from log-file:

%%% Package typearea Warning: Bad type area settings!
%%% (typearea)                The detected line width is about 20%
%%% (typearea)                larger than the heuristically detected line width.
%%% (typearea)                You should e.g. decrease DIV, increase fontsize
%%% (typearea)                or change papersize.

%%% On the other hand, if DIV is too big, lines become too long to be
%%% readable and the layout in general start to look stupid. LaTeX in
%%% general is about professional-looking layout, after all.


%\KOMAoptions{BCOR=15mm,DIV=23}
%\recalctypearea

% You do not need \recalctypearea after this:
\typearea[15mm]{23}




