%% Copyright (c) 2002, 2010 Sam Williams
%% Copyright (c) 2010 Richard M. Stallman
%% Permission is granted to copy, distribute and/or modify this
%% document under the terms of the GNU Free Documentation License,
%% Version 1.3 or any later version published by the Free Software
%% Foundation; with no Invariant Sections, no Front-Cover Texts, and
%% no Back-Cover Texts. A copy of the license is included in the
%% file called ``gfdl.tex''.

\documentclass[10pt]{book}
\usepackage{url}
\usepackage[Lenny]{fncychap}
\clubpenalty=10000
\widowpenalty=10000

\usepackage{polyglossia}
\setmainlanguage{russian}
\setotherlanguage{english}
\setkeys{russian}{babelshorthands=true}

\usepackage{fontspec}
\setmainfont{Liberation Serif}
\newfontfamily{\cyrillicfonttt}{Liberation Mono}
\setsansfont{Liberation Sans}
\setmonofont{Liberation Mono}

\usepackage{csquotes}

%% PDF setup
\usepackage{hyperref}
\hypersetup{colorlinks=true, 
           citecolor=blue,
           filecolor=blue,
           linkcolor=blue,
           urlcolor=blue,
           bookmarksopen=true,
           pdftitle=Ричард Столлман и революция свободного программного обеспечения,
           pdfauthor=Ричард Столлман и Сэм Вильямс,
           pdftex}

%% Index
\usepackage{makeidx}
\makeindex

%% Photos
\usepackage{graphicx}
\usepackage[labelformat=empty,font={small,it}, width=3.75in]{caption}

%% Paper size
\usepackage{geometry}
\geometry{papersize={6in,9in}}

\setcounter{errorcontextlines}{10}

% Header and Footer
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

%%%% Header Settings
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\fancyhead[CE,CO]{}

% Footer Settings
\fancyfoot[C]{\thepage}

% Redefining headrule
\makeatletter
\renewcommand{\headrule}{\hrule height 0pt}

\begin{document}
\title{Ричард Столлман и революция свободного программного обеспечения}
\author{Сэм Вильямс \\ Второе издание с правками от Ричарда Мэттью Столлмана}
\date{}

\maketitle
\thispagestyle{empty}
\frontmatter
\include{copyright}
\thispagestyle{empty}
\tableofcontents
\include{rms-preface}
\include{preface-williams}

\mainmatter
\include{chap01}
\include{chap02}
\include{chap03}
\include{chap04}
\include{chap05}
\include{chap06}
\include{chap07}
\include{chap08}
\include{chap09}
\include{chap10}
\include{chap11}
\include{chap12}
\include{chap13}

\backmatter

\renewcommand{\chaptermark}[1]{%
\markboth{\MakeUppercase{#1}}{}}

\include{epilogue}
\include{appendix}
\include{gfdl}
\printindex
\end{document}

% Initial LaTeX formatting by John Sullivan at the FSF, 2010
