moglen work in progress
[librarian.git] / librarian / pdf / wlpub.cls
index 5c2265e..7ace19d 100644 (file)
@@ -13,6 +13,7 @@
 % nowlfont - don't use customized WL font
 
 %\RequirePackage{geometry}
+
 \RequirePackage{setspace}
 \RequirePackage{type1cm}
 \RequirePackage{amssymb}
@@ -20,6 +21,8 @@
 \RequirePackage{paralist}
 \RequirePackage[normalem]{ulem}
 \RequirePackage{xifthen}
+\RequirePackage{environ} % environments with \BODY, for wyimek
+
 %\DeclareOption{13pt}{%
 %\AtEndOfClass{%
 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
 \usepackage{fontspec}
 \usepackage{xunicode}
 \usepackage{xltxtra}
-\usepackage{trimspaces}
+%\usepackage{trimspaces} % imported by something else?
 \usepackage{color}
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
 \usepackage{fancyhdr}
 \usepackage[explicit]{titlesec}
-\usepackage{fnpos}
+%\usepackage{fnpos}
 \usepackage{printlen}
 \usepackage{calc}
+\usepackage[stable]{footmisc}
+
+%% Wyimki - placing them on correct pages
+\usepackage{changepage}
+%\usepackage{fltpage}
+\usepackage{float}
+
 \pagestyle{plain}
 % bottom figure below footnotes
-\makeFNabove
+%\makeFNabove
 
 
 %%%%%%%%%%%%%%%%%%%%%%% Paper size
@@ -151,14 +161,14 @@ Mapping=tex-text
 }
 \makeatother
 
-\setlength{\parindent}{4mm}
+\setlength{\parindent}{3mm}
 \setlength{\parskip}{0mm}
 
 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont} % srodtytul
 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=0.5}\selectfont} % paginy
 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.1}\selectfont} % tytuł rozdziału
-\renewcommand{\huge}{\fontsize{18}{21.6}\addfontfeature{LetterSpace=0.1}\selectfont} % wyimek
+\renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=0.1}\selectfont} % wyimek
 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
 \renewcommand{\footnotesize}{\fontsize{9}{10.74}\selectfont}
 
@@ -203,14 +213,16 @@ Mapping=tex-text
 %% Sections
 \titleformat{\section}%
 {\addfontfeature{LetterSpace=0.3}\large}%
-{\thesection}{.5em}{\MakeUppercase{#1}}
+{\thesection{}.}{.5em}{\MakeUppercase{#1}}
 
 \renewcommand{\thesection}{\Roman{section}}
 
-\titleformat{\subsection}%
+\titleformat{\subsection}[runin]%
 {}%
-{\thesubsection}{0pt}{\fakesc{#1}}
+{\thesubsection{}.}{.5em}{\MakeUppercase{#1}.}[]
 
+\renewcommand{\thesubsection}{\Alph{subsection}}
+\titlespacing*{\subsection}{0pt}{0pt}{.5em}
 
 \newcommand{\typosubsubsection}[1]{%
 {\textsc{#1}}
@@ -227,29 +239,62 @@ Mapping=tex-text
 }
 %%%%%%%%%%%%%%%%%% ^^
 
-%%%%% Footnotes %%%%%%%%
+%%%%% Footnotes (works with footmisc) %%%%%%%%
 \newlength{\footnoteindent}\newlength{\footnoteprespace}
 \setlength{\footnoteindent}{6mm}%{3.5mm}
-\setlength{\footnoteprespace}{.3em}
+\setlength{\footnoteprespace}{0em}
 \makeatletter
 
 \renewcommand\@makefnmark{%
-\hspace{\footnoteprespace}\hbox{{\normalfont \@thefnmark}}%
+\hspace{\footnoteprespace}
+\hbox{{\normalfont \@thefnmark}}%
 }
 \renewcommand\thefootnote{[\arabic{footnote}]}
 
-\long\def\@makefntext#1{%
-\setlength{\leftskip}{\footnoteindent}%
-\setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
-\hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
-{\@makefnmark}#1
-%  \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
-}
+\setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
+\renewcommand\footnotelayout[1]{%
+  \setlength{\leftskip}{\footnoteindent}#1}
+
+%% \long\def\@makefntext#1{%
+%% \setlength{\leftskip}{\footnoteindent}%
+%% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
+%% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
+%% {\@makefnmark}#1
+%% %  \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
+%% }
 
+% make public
 \def\trimspace#1{\trim@spaces{#1}}
 
 \makeatother
 
+%%%%%%%%%%%%%%%%%%%%%% Wyimki
+%% \floatstyle{plain}
+%% \newfloat{wyimekbox}{p}{wmk}
+%% \floatname{wyimekbox}{Wyimek}
+
+\NewEnviron{wyimek}{%
+  \checkoddpage
+  \ifoddpage
+    \PackageWarning{wlpub}{Wyimek on odd page, omitting it.}
+  \else
+    \begin{figure}[tp]
+      \begin{center}
+        \begin{minipage}[t][\textheight][c]{70mm}
+          \huge\it\BODY
+        \end{minipage}
+      \end{center}
+    \end{figure}
+  \fi
+  \BODY
+}
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 
 \clubpenalty=100000
 \widowpenalty=100000
@@ -259,7 +304,7 @@ Mapping=tex-text
 \newsavebox{\ximagebox}\newlength{\ximageheight}
 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 \newcommand{\xbox}[1]
-{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
+{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
@@ -267,8 +312,7 @@ Mapping=tex-text
 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 
-\newcommand{\makecover}[2]{
-
+\newcommand{\makecover}{
   %\pdfpagewidth=#1
   %\pdfpageheight=#2
 
@@ -292,15 +336,11 @@ Mapping=tex-text
   \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
       \includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
 
-  
   }
 
-
-
 \renewcommand{\maketitle}{
-  \newpage
   %\vspace{\paperheight}
-
+  \newpage
   \thispagestyle{empty}
   \begin{center}
   \intro
@@ -311,28 +351,31 @@ Mapping=tex-text
   }
   \end{center}
 
-  \vspace{2em}
+  \vspace{\baselineskip}
   
   \begin{center}
     \intro
     {
-    \huge \noindent \theauthor
+      \huge \noindent 
+      \theauthor
+      
     }
   \end{center}
                   %\emph{\thankyou}\\
                   %\indent\emph{You made this book possible.}
-  \vspace{16em}
+  \vspace{7\baselineskip}
 
   \begin{center}
     \includegraphics[scale=.2]{logo.eps}
   \end{center}
-
+  
 }
 
 
 \newcommand{\editorialsection}{
   \newpage
   \thispagestyle{empty}
+  \input{editorial}
 }
 
 \renewcommand*\contentsname{Table of Contents}
@@ -395,9 +438,9 @@ Mapping=tex-text
 
 \newcommand{\nota}[1]{%
 \begin{em}%
-\begin{flushright}%
-#1%
-\end{flushright}%
+\begin{flushleft}%
+\noindent #1%
+\end{flushleft}%
 \end{em}%
 }
 
@@ -453,7 +496,7 @@ Mapping=tex-text
 \part{#1}%
 }
 \newcommand{\srodtytul}[1]{%
-\subsection*{\typosubsection{#1}}%
+\subsection{#1}%
 }
 
 \newcommand{\naglowekscena}[1]{%
@@ -463,7 +506,7 @@ Mapping=tex-text
 \newcommand{\theautorrozdzialu}{}
 
 \newcommand{\autorrozdzialu}[1]{%
-\renewcommand{\theautorrozdzialu}{\newline\newline#1}
+\renewcommand{\theautorrozdzialu}{\newline{}{\normalfont by}\newline#1}
 }
 
 \newcommand{\naglowekrozdzial}[1]{%
@@ -604,5 +647,5 @@ Mapping=tex-text
 }
 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
 
-\newcommand{\www}[1]{{\normalfont\small\url{#1}}}
+\newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}