[TYPO3-doc] reST and PDF [typo3manual.cls]

Xavier Perseguers xavier at typo3.org
Fri Oct 14 23:41:43 CEST 2011


Here is the class I used. Converted Share font has to be prepared using 
this article as inspiration:

http://devnotcorp.wordpress.com/2011/06/10/use-truetype-font-with-pdflatex/

Please note that some variants of the Share fonts are not freely 
accessible but this is not a problem if we do the PDF conversion on some 
official typo3.org server.

Next step would be to provide some service online where people could 
easily "compile" their reST manual into an "official" PDF. What do you 
think? It should be feasible for me to host this service for the time 
being, as a proof of concept and to easily allow fine-tuning if needed.

What do you think?

Cheers
Xavier

%%
%% This is file `typo3manual.cls'
%%
%% Copyright (c) October 2011 Xavier Perseguers <xavier at typo3.org>
%%
%%  $Id: typo3manual.cls 36 2011-10-14 11:39:47Z xp $
%%
\ProvidesClass{typo3manual}[2011/10/14 v.0.1
   TYPO3 Manual]
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\LoadClass[a4paper,11pt,twoside]{article}
\RequirePackage{graphicx,geometry,tabularx,multicol,colortbl}
\RequirePackage[english]{babel}
\RequirePackage{fancyhdr}

\ProcessOptions

%% Setting proper dimensions
\geometry{margin=2.5cm}

%% TYPO3 font
\newcommand\sharefont{\fontfamily{typo3share}\selectfont}

\pagestyle{fancy}
%% with this we ensure that the chapter and section
%% headings are in lowercase.
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhf{}          % delete current setting for header and footer
\fancyhead[LE,RO]{\sharefont\bfseries\thepage}
\fancyhead[LO]{\sharefont\bfseries\hspace{-0em}\rightmark}
\fancyhead[RE]{\sharefont\bfseries\leftmark}
\fancyfoot[LE]{\origincludegraphics[height=.4cm]{typo3_logo_color}}
\fancyfoot[RO]{%
	\sharefont inspiring people to \textbf{\emph{share}}.%
	\quad%
	\origincludegraphics[height=.4cm]{typo3_logo_color}%
}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{2.34pt} % make space for the rule
\fancypagestyle{plain}{
   \fancyhead{}      % get rid of headers on plain pages
   \renewcommand{\headrulewidth}{0pt} % and the line
}

%% Change font for sections
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
	{-3.5ex \@plus -1ex \@minus -.2ex}%
	{2.3ex \@plus.2ex}%
	{\normalfont\sharefont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
	{-3.25ex\@plus -1ex \@minus -.2ex}%
	{1.5ex \@plus .2ex}%
	{\normalfont\sharefont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
	{-3.25ex\@plus -1ex \@minus -.2ex}%
	{1.5ex \@plus .2ex}%
	{\normalfont\sharefont\normalsize\bfseries}}
\makeatother

% Automatically scale down graphics if too large
\makeatletter
\def\maxwidth{%
   \ifdim\Gin at nat@width>\linewidth
     \linewidth
   \else
     \Gin at nat@width
   \fi
}
\makeatother
\let\origincludegraphics=\includegraphics
\renewcommand{\includegraphics}[1]{\origincludegraphics[width=\maxwidth]{#1}}

%% Do not \vfill on pages that LaTeX cannot fill properly
\raggedbottom

%% Make sure not to show too many nested levels
\setcounter{tocdepth}{2}
\makeatletter
\renewcommand{\tableofcontents}{%
	\section*{\contentsname}
	\begin{multicols}{2}
	\small
	\@starttoc{toc}%
	\end{multicols}
}
\makeatother

\endinput
%%
%% End of file `typo3manual.cls'.


More information about the TYPO3-project-documentation mailing list