fix children books in toc
[librarian.git] / librarian / pdf / wl.cls
index c9305ca..ff6e2b0 100644 (file)
@@ -6,11 +6,13 @@
 %
 % nofootnotes - disable generation of footnotes
 % nothemes - disable generation of themes
+% defaultleading - default leading
 % onehalfleading - leading of 1.5 (interlinia)
 % doubleleading - double leading (interlinia)
 % a4paper,... - paper size as required by LaTeX
 % nowlfont - don't use customized WL font
 
+\RequirePackage{fixltx2e}
 \RequirePackage{setspace}
 \RequirePackage{type1cm}
 \DeclareOption{13pt}{%
@@ -39,6 +41,7 @@
 
 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
 
+\DeclareOption{defaultleading}{}
 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
 
@@ -57,6 +60,9 @@
 \newif\ifenablewlfont \enablewlfonttrue
 \DeclareOption{nowlfont}{\enablewlfontfalse}
 
+\newif\ifshowtoc \showtoctrue
+\DeclareOption{notoc}{\showtocfalse}
+
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
 \ProcessOptions\relax
 \LoadClass[a4paper,oneside]{book}
 \usepackage{xunicode}
 \usepackage{xltxtra}
 
+\usepackage{longtable}
+\usepackage{tabu}
+\usepackage{unicode-math}
+\setmathfont{Latin Modern Math}
+
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
 
+\newfontfamily\alien[
+SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
+Numbers=OldStyle,
+Scale=0.85,
+LetterSpace=-1.0
+] {DejaVu Serif}
+
 \ifenablewlfont
 \setmainfont [
 %ExternalLocation,
@@ -89,14 +107,6 @@ Scale=1.04,
 LetterSpace=-1.0
 ] {JunicodeWL}
 
-\newfontfamily\alien[
-SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
-Numbers=OldStyle,
-Scale=0.85,
-LetterSpace=-1.0
-] {DejaVu Serif}
-
-
 \defaultfontfeatures{
 SizeFeatures={
   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
@@ -124,6 +134,8 @@ Letters={SmallCaps,UppercaseSmallCaps}
 
 \pagestyle{plain}
 \usepackage{fancyhdr}
+\usepackage{marginnote}
+
 
 \makeatletter
 
@@ -213,6 +225,11 @@ Letters={SmallCaps,UppercaseSmallCaps}
         \vspace{.5em}
     \fi
 
+    \ifdefined\thanknote
+        \thanknote
+        \vspace{.5em}
+    \fi
+
     Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
     przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
 
@@ -231,6 +248,13 @@ Letters={SmallCaps,UppercaseSmallCaps}
     \color{theme}
     \noindent \rule{\linewidth}{0.4pt}
 
+    \ifdefined\sponsors
+        \marginnote{%
+            \centering%
+            \sponsors%
+        }
+    \fi
+
     \rightsinfo
     \vspace{.6em}
 
@@ -239,13 +263,49 @@ Letters={SmallCaps,UppercaseSmallCaps}
     \vspace{.6em}
     \sourceinfo
 
+    \publisherinfo
+
     \description
     \vspace{.6em}
 
     \editors
 
+    \ifdefined\funders
+        \vspace{.6em}
+        \funders
+    \fi
+
+    \ifdefined\coverby
+        \vspace{.6em}
+        \coverby
+    \fi
+
+    \ifdefined\isbn
+        \vspace{.6em}
+        \isbn
+    \fi
+
+    \vspace{.6em}
+    \emph{Wesprzyj Wolne Lektury!}
+
+    Wolne Lektury to projekt fundacji Nowoczesna Polska – organizacji
+    pożytku publicznego działającej na rzecz wolności korzystania
+    z dóbr kultury.
+
+    Co roku do domeny publicznej przechodzi twórczość kolejnych autorów.
+    Dzięki Twojemu wsparciu będziemy je mogli udostępnić wszystkim bezpłatnie.
+
     \vspace{.6em}
-    \coverby
+    \emph{Jak możesz pomóc?}
+
+    Przekaż 1\% podatku na rozwój Wolnych Lektur:
+    Fundacja Nowoczesna Polska, KRS 0000070056.
+
+    Pomóż uwolnić konkretną książkę, wspierając
+    \href{http://www.wolnelektury.pl/wesprzyj/}{zbiórkę na stronie wolnelektury.pl}.
+
+    Przekaż darowiznę na konto:
+    \href{http://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/}{szczegóły na stronie Fundacji}.
 
     \color{black}
   }
@@ -275,24 +335,49 @@ Letters={Uppercase}
 }
 
 
+\DeclareRobustCommand\authortoctext[1]{%
+{\addvspace{10pt}\nopagebreak\leftskip0em\relax
+\rightskip \@tocrmarg\relax
+\noindent\itshape#1\par}}
+
+\newcommand\authortoc[1]{%
+  \gdef\chapterauthor{#1}%
+  \addtocontents{toc}{\authortoctext{#1}}}
+
+
 \newcommand{\tytul}[1]{%
 #1%
 \vspace{1em}%
 }
 
-\newcommand{\nazwapodutworu}[1]{%
+\newcommand{\nazwapodutworu}[2]{%
+\vspace{5ex}%
 \section*{\typosection{#1}}%
+\addcontentsline{toc}{section}{#2}%
+}
+
+\newcommand{\nazwanadpodutworu}[2]{%
+\authortoc{}%
+\nazwapodutworu{#1}{#2}%
+\authortoc{}%
 }
 
 \newcommand{\autorutworu}[1]{%
 \subsection*{\typosubsection{#1}}%
 }
 
+\newcommand{\autorpodutworu}[1]{%
+\vspace{5ex}%
+\subsection*{\typosubsection{#1}}%
+\authortoc{#1}%
+}
+
 \newcommand{\dzielonadrzedne}[1]{%
 \subsection*{\typosubsubsection{#1}}%
 }
 
 \newcommand{\nazwautworu}[1]{%
+\vspace{5ex}%
 \section*{\typosection{#1}}%
 }
 
@@ -314,7 +399,8 @@ Letters={Uppercase}
 \newcommand{\dramatwspolczesny}[1]{#1}
 
 \newcommand{\nota}[1]{%
-\par{#1}%
+\par{\raggedleft \emph{#1}}%
+\vspace{5ex}%
 }
 
 \newcommand{\dedykacja}[1]{%
@@ -325,6 +411,75 @@ Letters={Uppercase}
 \end{em}%
 }
 
+\newlength{\fboxhsep}
+\newlength{\fboxvsep}
+
+\newlength{\fboxtoprule}
+\newlength{\fboxbottomrule}
+\newlength{\fboxleftrule}
+\newlength{\fboxrightrule}
+
+\setlength{\fboxhsep}{5\fboxsep}
+\setlength{\fboxvsep}{20\fboxsep}
+
+\setlength{\fboxtoprule}{\fboxrule}
+\setlength{\fboxleftrule}{\fboxrule}
+\setlength{\fboxrightrule}{\fboxrule}
+\setlength{\fboxbottomrule}{\fboxrule}
+
+
+
+\def\@frameb@xother#1{%
+  \@tempdima\fboxtoprule
+  \advance\@tempdima\fboxvsep
+  \advance\@tempdima\dp\@tempboxa
+  \hbox{%
+    \lower\@tempdima\hbox{%
+      \vbox{%
+        \hrule\@height\fboxtoprule
+        \hbox{%
+          \vrule\@width\fboxleftrule
+          #1%
+          \vbox{%
+            \vskip\fboxvsep
+            \box\@tempboxa
+            \vskip\fboxvsep}%
+          #1%
+          \vrule\@width\fboxrightrule}%
+        \hrule\@height\fboxbottomrule}%
+    }%
+  }%
+}
+
+
+\long\def\fboxother#1{%
+  \leavevmode
+  \setbox\@tempboxa\hbox{%
+    \color@begingroup
+    \kern\fboxhsep{#1}\kern\fboxhsep
+    \color@endgroup}%
+  \@frameb@xother\relax}
+
+\newcommand{\myfbox}[3]{%
+  \begingroup
+  \setlength{\fboxhsep}{#1}
+  \setlength{\fboxvsep}{#2}
+  \fboxother{#3}
+
+  \endgroup
+}
+
+\newcommand{\ramka}[1]{%
+\par\vspace{1em}%
+\edef\myindent{\the\parindent}%
+\noindent\myfbox{1em}{1em}{%
+\parbox{\dimexpr \textwidth - 2\fboxhsep - 2\fboxrule\relax}{%
+\setlength{\parindent}{\myindent}%
+#1%
+}}%
+\vspace{1em}%
+}
+
 \newcommand{\dlugicytat}[1]{%
 \begin{quotation}%
 #1%
@@ -353,37 +508,46 @@ Letters={Uppercase}
 }
 
 \newcommand{\listaosoba}[1]{%
-\item{#1}%
+\item[]{#1}%
 }
 
 \newcommand{\kwestia}[1]{%
 \par{#1}%
 }
 
-\newcommand{\naglowekakt}[1]{%
+\newcommand{\naglowekakt}[2]{%
 \pagebreak
-\subsection*{\typosubsection{#1}}%
+\subsection*{\typosubsection{\huge #1}}%
+\addcontentsline{toc}{subsection}{#2}%
+\vspace{5ex}%
 }
-\newcommand{\naglowekczesc}[1]{%
+\newcommand{\naglowekczesc}[2]{%
 \pagebreak
-\subsection*{\typosubsection{#1}}%
+\subsection*{\typosubsection{\huge #1}}%
+\addcontentsline{toc}{subsection}{#2}%
+\vspace{5ex}%
 }
 \newcommand{\srodtytul}[1]{%
 \subsection*{\typosubsection{#1}}%
 }
 
-\newcommand{\naglowekscena}[1]{%
-\subsubsection*{\typosubsubsection{#1}}%
+\newcommand{\naglowekscena}[2]{%
+\subsubsection*{\typosubsubsection{\LARGE #1}}%
+\addcontentsline{toc}{subsubsection}{#2}%
+\vspace{5ex}%
 }
-\newcommand{\naglowekrozdzial}[1]{%
-\subsubsection*{\typosubsubsection{#1}}%
+\newcommand{\naglowekrozdzial}[2]{%
+\subsubsection*{\typosubsubsection{\LARGE #1}}%
+\addcontentsline{toc}{subsubsection}{#2}%
+\vspace{5ex}%
 }
 
 \newcommand{\naglowekosoba}[1]{%
-\par{\textsc{#1}}\nopagebreak%
+\medskip%
+\par{\textsc{\MakeLowercase{#1}}}\nopagebreak%
 }
 \newcommand{\naglowekpodrozdzial}[1]{%
-\par{#1}\nopagebreak%
+\vspace{5ex}\par{#1}\nopagebreak%
 }
 
 \newcommand{\miejsceczas}[1]{%
@@ -393,14 +557,32 @@ Letters={Uppercase}
 \par{\emph{#1}}%
 }
 
+\usepackage{intcalc}
+\usepackage{color}
+\definecolor{gray}{RGB}{200,200,200}
+%\newcounter{parnum}
+\newlength{\parnumwidth}
+\setlength{\parnumwidth}{3em}
+\newcommand{\N}{%
+  \leavevmode\refstepcounter{parnum}\reversemarginpar%
+  \marginnote{\textcolor{gray}{\small{\theparnum}}}%
+  \reversemarginpar}
+\newcommand{\Nw}{%
+  \leavevmode\refstepcounter{parnum}\reversemarginpar%
+  \ifnum\intcalcMod{\value{parnum}}{5}=0%
+  \marginnote{\textcolor{gray}{\small{\theparnum}}}%
+  \fi\reversemarginpar}
+\renewcommand{\N}{}
+\renewcommand{\Nw}{}
+
 \newcommand{\akap}[1]{%
-\par{#1}%
+\par{\N#1}%
 }
 \newcommand{\akapdialog}[1]{%
-\par{#1}%
+\par{\N#1}%
 }
 \newcommand{\akapcd}[1]{%
-\par{#1}%
+\par{\N#1}%
 }
 
 \newcommand{\mottopodpis}[1]{%
@@ -415,23 +597,26 @@ Letters={Uppercase}
 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 }
 
-\newcommand{\wers}[1]{#1}
+\newcommand{\wers}[1]{\Nw#1}
 
 \newcommand{\wersakap}[1]{%
-\hspace*{1em}#1%
+\Nw\hspace*{1em}#1%
 }
 \newcommand{\werscd}[1]{%
-\hspace*{8em}#1%
+\Nw\hspace*{8em}#1%
 }
 \newcommand{\werswciety}[2][1em]{%
-\hspace*{#1}#2%
+\Nw\hspace*{#1}#2%
+}
+\newcommand{\wersdoprawej}[1]{%
+\Nw\hspace*{\fill}#1%
 }
 
 \ifshowfootnotes
   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
-  \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
-  \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
-  \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
+  \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1 [przypis edytorski]}}}
+  \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1 [przypis redakcyjny]}}}
+  \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1 [przypis tłumacza]}}}
 \else
   \newcommand{\pa}[1]{}
   \newcommand{\pe}[1]{}
@@ -453,9 +638,17 @@ Letters={Uppercase}
 \newcommand{\wyroznienie}[1]{%
 \emph{#1}%
 }
+\newcommand{\indeksdolny}[1]{%
+\textsubscript{#1}%
+}
+\newcommand{\wiekszeodstepy}[1]{%
+\spaceskip 3\fontdimen2\font plus 3\fontdimen3\font minus 3\fontdimen4\font \relax%
+#1%
+\spaceskip \fontdimen2\font plus \fontdimen3\font minus \fontdimen4\font \relax%
+}
 
 \newcommand{\osoba}[1]{%
-#1%
+{\scshape \MakeLowercase{#1}}%
 }
 
 \newcommand{\sekcjaswiatlo}{%
@@ -488,3 +681,8 @@ Letters={Uppercase}
 \fi
 }
 
+\newcommand{\ilustr}[2]{%
+\vspace{1em}%
+\par{\noindent\includegraphics[width=\linewidth]{#1}}%
+\vspace{1em}
+}