prawie koniec
[librarian.git] / librarian / pdf / wlpub.cls
index 5c2265e..37965a9 100644 (file)
@@ -20,6 +20,8 @@
 \RequirePackage{paralist}
 \RequirePackage[normalem]{ulem}
 \RequirePackage{xifthen}
 \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/
 %\DeclareOption{13pt}{%
 %\AtEndOfClass{%
 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
 \usepackage[MeX]{polski}
 \usepackage{icomma}
 \usepackage[xetex]{graphicx}
 \usepackage[MeX]{polski}
 \usepackage{icomma}
 \usepackage[xetex]{graphicx}
-\usepackage{fontspec}
+\usepackage[silent]{fontspec} % silent - no warnings, quiet - warn only to log
 \usepackage{xunicode}
 \usepackage{xltxtra}
 \usepackage{xunicode}
 \usepackage{xltxtra}
-\usepackage{trimspaces}
+%\usepackage{trimspaces} % imported by something else?
 \usepackage{color}
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
 \usepackage{color}
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
-\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
+\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
+%\usepackage{hyperref}
 \usepackage{fancyhdr}
 \usepackage{fancyhdr}
-\usepackage[explicit]{titlesec}
-\usepackage{fnpos}
+
+%\usepackage{fnpos}
 \usepackage{printlen}
 \usepackage{calc}
 \usepackage{printlen}
 \usepackage{calc}
+\usepackage[stable]{footmisc}
+
+\usepackage{chngcntr}
+\counterwithout{footnote}{chapter}
+
+\usepackage[explicit]{titlesec}
+\usepackage{microtype}
+
+%% Wyimki - placing them on correct pages
+\usepackage[strict]{changepage}
+%\usepackage{fltpage}
+%\usepackage{float}
+
 \pagestyle{plain}
 % bottom figure below footnotes
 \pagestyle{plain}
 % bottom figure below footnotes
-\makeFNabove
+%\makeFNabove
+
+%%% Hyphenation opts:
+%\pretolerance=10000
+\tolerance=2600
+\emergencystretch=30pt
 
 
 %%%%%%%%%%%%%%%%%%%%%%% Paper size
 
 
 %%%%%%%%%%%%%%%%%%%%%%% Paper size
   \usepackage[%
     paperwidth=160mm,%
     paperheight=225mm,%
   \usepackage[%
     paperwidth=160mm,%
     paperheight=225mm,%
-    text={117mm,162mm},% 
-    top=30mm,% 
+    text={117mm,162mm},%
+    top=30mm,%
     headsep=8mm,%
     left=23mm,%
     right=30mm]{geometry}%
 \else
   \usepackage[%
     headsep=8mm,%
     left=23mm,%
     right=30mm]{geometry}%
 \else
   \usepackage[%
-    top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt) 
+    top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
     headsep=3\baselineskip,
     headheight=16pt,
     bottom=26.3mm,%
     headsep=3\baselineskip,
     headheight=16pt,
     bottom=26.3mm,%
@@ -151,16 +172,16 @@ Mapping=tex-text
 }
 \makeatother
 
 }
 \makeatother
 
-\setlength{\parindent}{4mm}
+\setlength{\parindent}{3mm}
 \setlength{\parskip}{0mm}
 
 \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{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
+\renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0,Letters=Uppercase}\selectfont} % srodtytul
+\renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
+\renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
+\renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
-\renewcommand{\footnotesize}{\fontsize{9}{10.74}\selectfont}
+\renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
 
 
 
 
 
 
@@ -178,8 +199,8 @@ Mapping=tex-text
 %%%%%%%%%% Nagłówek normalny
 \cfoot{}
 % this will go to \leftmark
 %%%%%%%%%% Nagłówek normalny
 \cfoot{}
 % this will go to \leftmark
-\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
-\fancyhead[CE]{{\small\MakeUppercase{\@title}}}
+\renewcommand{\chaptermark}[1]{\markboth{\MakeTextUppercase{#1}}{}}
+\fancyhead[CE]{{\small\MakeTextUppercase{\@author, \@title}}}
 \fancyhead[CO]{{\small\leftmark}}
 \fancyhead[LE,RO]{{\small\intro\thepage}}
 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
 \fancyhead[CO]{{\small\leftmark}}
 \fancyhead[LE,RO]{{\small\intro\thepage}}
 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
@@ -194,23 +215,25 @@ Mapping=tex-text
 %% Chapters
 \titleformat{\chapter}[block]%
 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
 %% Chapters
 \titleformat{\chapter}[block]%
 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
-{}{0pt}{\parbox{80mm}{\raggedright\MakeUppercase{#1}}}
+{}{0pt}{\parbox{80mm}{\raggedright#1}}
 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
-\setlength{\chapterposcorrection}{-\headsep-2\baselineskip}
-\setlength{\chapterspaceafter}{14\baselineskip-14pt}%\f@size of large
+\setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
+\setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
 
 %% Sections
 \titleformat{\section}%
 {\addfontfeature{LetterSpace=0.3}\large}%
 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
 
 %% Sections
 \titleformat{\section}%
 {\addfontfeature{LetterSpace=0.3}\large}%
-{\thesection}{.5em}{\MakeUppercase{#1}}
+{\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
 
 \renewcommand{\thesection}{\Roman{section}}
 
 
 \renewcommand{\thesection}{\Roman{section}}
 
-\titleformat{\subsection}%
+\titleformat{\subsection}[runin]%
 {}%
 {}%
-{\thesubsection}{0pt}{\fakesc{#1}}
+{\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
 
 
+\renewcommand{\thesubsection}{\Alph{subsection}}
+\titlespacing*{\subsection}{0pt}{\baselineskip}{.5em}
 
 \newcommand{\typosubsubsection}[1]{%
 {\textsc{#1}}
 
 \newcommand{\typosubsubsection}[1]{%
 {\textsc{#1}}
@@ -218,7 +241,7 @@ Mapping=tex-text
 
 %% XXX delete them
 \newcommand{\typosubsection}[1]{%
 
 %% XXX delete them
 \newcommand{\typosubsection}[1]{%
-{\MakeUppercase{#1}}
+{\MakeTextUppercase{#1}}
 }
 
 \newcommand{\typosection}[1]{%
 }
 
 \newcommand{\typosection}[1]{%
@@ -227,39 +250,72 @@ Mapping=tex-text
 }
 %%%%%%%%%%%%%%%%%% ^^
 
 }
 %%%%%%%%%%%%%%%%%% ^^
 
-%%%%% Footnotes %%%%%%%%
+%%%%% Footnotes (works with footmisc) %%%%%%%%
 \newlength{\footnoteindent}\newlength{\footnoteprespace}
 \newlength{\footnoteindent}\newlength{\footnoteprespace}
-\setlength{\footnoteindent}{6mm}%{3.5mm}
-\setlength{\footnoteprespace}{.3em}
+\setlength{\footnoteindent}{8mm}%{3.5mm}
+\setlength{\footnoteprespace}{0em}
 \makeatletter
 
 \renewcommand\@makefnmark{%
 \makeatletter
 
 \renewcommand\@makefnmark{%
-\hspace{\footnoteprespace}\hbox{{\normalfont \@thefnmark}}%
+\hspace{\footnoteprespace}
+\hbox{{\normalfont \@thefnmark}}%
 }
 \renewcommand\thefootnote{[\arabic{footnote}]}
 
 }
 \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
 
 \def\trimspace#1{\trim@spaces{#1}}
 
 \makeatother
 
+%%%%%%%%%%%%%%%%%%%%%% Wyimki
+%% \floatstyle{plain}
+%% \newfloat{wyimekbox}{p}{wmk}
+%% \floatname{wyimekbox}{Wyimek}
 
 
-\clubpenalty=100000
-\widowpenalty=100000
+\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=400
+\widowpenalty=400
 
 
 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 \newsavebox{\ximagebox}\newlength{\ximageheight}
 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 \newcommand{\xbox}[1]
 
 
 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 \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}}}%}%
 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
@@ -267,10 +323,15 @@ Mapping=tex-text
 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 
 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 
-\newcommand{\makecover}[2]{
+\newcommand{\makecover}{
+  %% \paperwidth=297mm
+
 
 
-  %\pdfpagewidth=#1
-  %\pdfpageheight=#2
+  %% \paperheight=210mm
+
+  \newgeometry{paperwidth=297mm,paperheight=210mm}
+  \pdfpageheight=210mm
+  \pdfpagewidth=297mm
 
   \thispagestyle{empty}
   \newlength{\PictHOffset}
 
   \thispagestyle{empty}
   \newlength{\PictHOffset}
@@ -290,17 +351,19 @@ Mapping=tex-text
 
   \noindent\hspace*{-\PictHOffset}%
   \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
 
   \noindent\hspace*{-\PictHOffset}%
   \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
-      \includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
-
-  
-  }
+      \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
 
 
+  \restoregeometry
+  \pdfpageheight=210mm
+  \pdfpagewidth=148mm
 
 
+  }
 
 \renewcommand{\maketitle}{
 
 \renewcommand{\maketitle}{
-  \newpage
   %\vspace{\paperheight}
   %\vspace{\paperheight}
-
+  \thispagestyle{empty}
+  \cleardoublepage
+  \setcounter{page}{1}
   \thispagestyle{empty}
   \begin{center}
   \intro
   \thispagestyle{empty}
   \begin{center}
   \intro
@@ -311,17 +374,19 @@ Mapping=tex-text
   }
   \end{center}
 
   }
   \end{center}
 
-  \vspace{2em}
-  
+  \vspace{\baselineskip}
+
   \begin{center}
     \intro
     {
   \begin{center}
     \intro
     {
-    \huge \noindent \theauthor
+      \huge \noindent
+      \theauthor
+
     }
   \end{center}
                   %\emph{\thankyou}\\
                   %\indent\emph{You made this book possible.}
     }
   \end{center}
                   %\emph{\thankyou}\\
                   %\indent\emph{You made this book possible.}
-  \vspace{16em}
+  \vspace{7\baselineskip}
 
   \begin{center}
     \includegraphics[scale=.2]{logo.eps}
 
   \begin{center}
     \includegraphics[scale=.2]{logo.eps}
@@ -331,11 +396,15 @@ Mapping=tex-text
 
 
 \newcommand{\editorialsection}{
 
 
 \newcommand{\editorialsection}{
-  \newpage
+  \clearpage
   \thispagestyle{empty}
   \thispagestyle{empty}
+  {
+    \setlength{\parindent}{0mm}
+  \input{editorial}
+  }
 }
 
 }
 
-\renewcommand*\contentsname{Table of Contents}
+\renewcommand*\contentsname{Spis treści}
 \newcommand{\spistresci}{
 {
   \intro
 \newcommand{\spistresci}{
 {
   \intro
@@ -395,9 +464,9 @@ Mapping=tex-text
 
 \newcommand{\nota}[1]{%
 \begin{em}%
 
 \newcommand{\nota}[1]{%
 \begin{em}%
-\begin{flushright}%
-#1%
-\end{flushright}%
+\begin{flushleft}%
+\noindent #1%
+\end{flushleft}%
 \end{em}%
 }
 
 \end{em}%
 }
 
@@ -411,7 +480,7 @@ Mapping=tex-text
 
 \newcommand{\dlugicytat}[1]{%
 \begin{quotation}%
 
 \newcommand{\dlugicytat}[1]{%
 \begin{quotation}%
-#1%
+\noindent{}\ignorespaces#1%
 \end{quotation}%
 }
 
 \end{quotation}%
 }
 
@@ -453,7 +522,7 @@ Mapping=tex-text
 \part{#1}%
 }
 \newcommand{\srodtytul}[1]{%
 \part{#1}%
 }
 \newcommand{\srodtytul}[1]{%
-\subsection*{\typosubsection{#1}}%
+\subsection{#1}%
 }
 
 \newcommand{\naglowekscena}[1]{%
 }
 
 \newcommand{\naglowekscena}[1]{%
@@ -463,11 +532,13 @@ Mapping=tex-text
 \newcommand{\theautorrozdzialu}{}
 
 \newcommand{\autorrozdzialu}[1]{%
 \newcommand{\theautorrozdzialu}{}
 
 \newcommand{\autorrozdzialu}[1]{%
-\renewcommand{\theautorrozdzialu}{\newline\newline#1}
+\renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\normalsize\it #1}}}
 }
 
 }
 
+
 \newcommand{\naglowekrozdzial}[1]{%
 \newcommand{\naglowekrozdzial}[1]{%
-\chapter[#1]{#1\theautorrozdzialu{}}\renewcommand{\theautorrozdzialu}{}%
+\chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
+\renewcommand{\theautorrozdzialu}{}%
 }
 
 \newcommand{\naglowekosoba}[1]{%
 }
 
 \newcommand{\naglowekosoba}[1]{%
@@ -485,7 +556,9 @@ Mapping=tex-text
 }
 
 \newcommand{\akap}[1]{%
 }
 
 \newcommand{\akap}[1]{%
-\par{#1}%
+#1
+
+% newline here needed, we don't use \par cause it ignores \noindent before
 }
 \newcommand{\akapdialog}[1]{%
 \par{#1}%
 }
 \newcommand{\akapdialog}[1]{%
 \par{#1}%
@@ -550,7 +623,7 @@ Mapping=tex-text
 }
 
 \newcommand{\sekcjaswiatlo}{%
 }
 
 \newcommand{\sekcjaswiatlo}{%
-\vspace{30pt}%
+\vspace{\baselineskip}%
 }
 
 \newcommand{\sekcjaasterysk}{%
 }
 
 \newcommand{\sekcjaasterysk}{%
@@ -595,6 +668,7 @@ Mapping=tex-text
 
 \newcommand{\lista}[1]{%
 \begin{compactitem}
 
 \newcommand{\lista}[1]{%
 \begin{compactitem}
+\setlength{\parskip}{\parindent}
 #1
 \end{compactitem}
 }
 #1
 \end{compactitem}
 }
@@ -604,5 +678,4 @@ Mapping=tex-text
 }
 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
 
 }
 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
 
-\newcommand{\www}[1]{{\normalfont\small\url{#1}}}
-
+\newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}