\documentclass[DIV=12,%
               BCOR=10mm,%
               headinclude=false,%
               footinclude=false,open=any,%
               fontsize=11pt,%
               twoside,%
               paper=a5]%
               {scrbook}



\usepackage[noautomatic]{imakeidx}



\usepackage{microtype}
\usepackage{graphicx}
\usepackage{alltt}
\usepackage{verbatim}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\def\hsout{\bgroup \ULdepth=-.55ex \ULset}
% https://tex.stackexchange.com/questions/22410/strikethrough-in-section-title
% Unclear if \protect \hsout is needed. Doesn't looks so
\DeclareRobustCommand{\sout}[1]{\texorpdfstring{\hsout{#1}}{#1}}
\usepackage{wrapfig}

% avoid breakage on multiple <br><br> and avoid the next [] to be eaten
\newcommand*{\forcelinebreak}{\strut\\*{}}

\newcommand*{\hairline}{%
  \bigskip%
  \noindent \hrulefill%
  \bigskip%
}

% reverse indentation for biblio and play

\newenvironment*{amusebiblio}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newenvironment*{amuseplay}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newcommand*{\Slash}{\slash\hspace{0pt}}


% http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\PassOptionsToPackage{hyphens}{url}\usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref}
\usepackage{bookmark}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont{LinLibertine_R.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/fonts/opentype/linux-libertine/,%
 BoldFont=LinLibertine_RB.otf,%
 BoldItalicFont=LinLibertine_RBI.otf,%
 ItalicFont=LinLibertine_RI.otf]
\setmonofont{cmuntt.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmuntb.ttf,%
 BoldItalicFont=cmuntx.ttf,%
 ItalicFont=cmunit.ttf]
\setsansfont{cmunss.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmunsx.ttf,%
 BoldItalicFont=cmunso.ttf,%
 ItalicFont=cmunsi.ttf]
\newfontfamily\englishfont{LinLibertine_R.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/fonts/opentype/linux-libertine/,%
 BoldFont=LinLibertine_RB.otf,%
 BoldItalicFont=LinLibertine_RBI.otf,%
 ItalicFont=LinLibertine_RI.otf]



\renewcommand*{\partpagestyle}{empty}


% global style

\pagestyle{plain}




\usepackage{indentfirst}

% remove the numbering
\setcounter{secnumdepth}{-2}

% remove labels from the captions
\renewcommand*{\captionformat}{}
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\KOMAoption{captions}{belowfigure,nooneline}
\addtokomafont{caption}{\centering}







\deffootnote[3em]{0em}{4em}{\textsuperscript{\thefootnotemark}~}


\addtokomafont{disposition}{\rmfamily}
\addtokomafont{descriptionlabel}{\rmfamily}


\frenchspacing
% avoid vertical glue
\raggedbottom

% this will generate overfull boxes, so we need to set a tolerance
% \pretolerance=1000
% pretolerance is what is accepted for a paragraph without
% hyphenation, so it makes sense to be strict here and let the user
% accept tweak the tolerance instead.
\tolerance=200
% Additional tolerance for bad paragraphs only
\setlength{\emergencystretch}{30pt}

% (try to) forbid widows/orphans
\clubpenalty=10000
\widowpenalty=10000





% given that we said footinclude=false, this should be safe
\setlength{\footskip}{2\baselineskip}

\title{Recompiling the formats}
\date{}
\author{}
\subtitle{}




% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={Recompiling the formats},%
pdfauthor={},%
pdfsubject={},%
pdfkeywords={}%
}


\begin{document}






  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge Recompiling the formats\par}}%
  \vskip 1em
  
  \vskip 2em
  
  \vskip 1.5em



   
   \vfill



  
    \strut\par
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage



\tableofcontents
% start a new right-handed page

\cleardoublepage



\section{Introduction}


The texts stored on the libraries are formatted with a dialect of the
Emacs Muse markup, which is described in deep details in the \href{http://amusewiki.org/library/manual}{manual}.


The files are pure plain text (with the popular and ubiquitous UTF-8
encoding), and you can edit them with any editor.


The following how-to explains how to install on your very own machine
the needed code to generate the HTML, EPUB and PDF (imposed and not)
formats, starting from a \texttt{muse} formatted plain text file.
You can retrieve those files for any text on the library downloading
the “plain text source” file from the list of available downloads.

\section{Installation}


The programs are written in Perl. Every GNU\Slash{}Linux operating system
comes with Perl installed. They are supposed to work on Mac and
Windows too, but you have to find your way to get Perl installed
(together with a way to install modules from CPAN, the repository of
Perl code, usually the program called \texttt{App::cpanminus},
which is invoked with the command \texttt{cpanm}).


Given that Debian and Ubuntu are the most used distributions around,
the following tutorial will assume that the user run one of them.

\subsection{Essentials}


Install \texttt{cpanm} to retrieve the modules from CPAN and the
template engine. Please become root before proceeding (Ubuntu:
\texttt{sudo su -}, Debian: \texttt{su -}, please note the dash,
it’s part of the command).


\begin{alltt}
\# apt-get install perl-modules perl-doc \textbackslash{}
          cpanminus libtemplate-tiny-perl \textbackslash{}
          libcam-pdf-perl libpdf-api2-perl
\end{alltt}


Then install the needed code from CPAN:


\begin{alltt}
\# cpanm Text::Amuse::Compile
\end{alltt}

\subsection{Full-featured installation (PDF)}


To produce PDFs you need TeXlive. In theory, only a subset is needed,
but here for brevity we install the full version. Ok, it’s 1 gigabyte
and half of download, about 3 as installed size, but nowadays disk
space is cheap.\footnote{If you manage to strip down the installation to the minimum, please let me know, and I’ll update the tutorial.} Keep in mind that you can still get EPUB and HTML
without this.


\begin{alltt}
\# apt-get install texlive-full fonts-sil-charis
\end{alltt}


This will install the executable \texttt{muse-compile.pl} which by default will
get you all the formats provided by the library.


\begin{alltt}

\$wget http://theanarchistlibrary.org/library/john-zerzan-tonality-and-totality.muse
--2014-05-17 23:28:41--  http://theanarchistlibrary.org/library/john-zerzan-tonality-and-totality.muse
Resolving theanarchistlibrary.org (theanarchistlibrary.org)... 192.235.78.154
 Connecting to theanarchistlibrary.org (theanarchistlibrary.org)\textbar{}192.235.78.154\textbar{}:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 49128 (48K) [text/plain]
Saving to: ‘john-zerzan-tonality-and-totality.muse’

100\%[=======================================>] 49,128       107K/s   in 0.4s

2014-05-17 23:28:42 (107 KB/s) — ‘john-zerzan-tonality-and-totality.muse’ saved [49128/49128]

\$ muse-compile.pl --pdf --epub --html --a4-pdf \textbackslash{}
           john-zerzan-tonality-and-totality.muse
Using Text::Amuse 0.43, Text::Amuse::Compiler 0.43, PDF::Imposition 0.14
Working on john-zerzan-tonality-and-totality.muse file in /tmp
* Created john-zerzan-tonality-and-totality.html
* Created john-zerzan-tonality-and-totality.epub
* Created john-zerzan-tonality-and-totality.a4.pdf
* Created john-zerzan-tonality-and-totality.tex
* Created john-zerzan-tonality-and-totality.pdf
\end{alltt}


Please see \texttt{muse-compile.pl --help} for more information.



\begin{flushright}

-- Marco (marco -AT- theanarchistlibrary.org)


\end{flushright}







% begin final page

\clearpage


% if we are on an odd page, add another one, otherwise when imposing
% the page would be odd on an even one.
\ifthispageodd{\strut\thispagestyle{empty}\clearpage}{}


% new page for the colophon

\thispagestyle{empty}

\begin{center}

The Anarchist Library



\smallskip
Anti-Copyright



\bigskip
\includegraphics[width=0.25\textwidth]{logo-en}
\bigskip

\end{center}

\strut

\vfill

\begin{center}




Recompiling the formats






\bigskip



   

       

       

       

       

       
   



\bigskip
\textbf{theanarchistlibrary.org}


\end{center}

% end final page with colophon


\end{document}




