1 % -*- coding: utf-8 -*-
2 \NeedsTeXFormat{LaTeX2e}
3 \ProvidesClass{fnprep}[2011/11/28 Modern Poland Foundation Report style]
6 %\RequirePackage{geometry}
7 \RequirePackage{setspace}
8 \RequirePackage{type1cm}
9 \RequirePackage{amssymb}
10 \RequirePackage{amsmath}
11 \RequirePackage{paralist}
12 \RequirePackage[normalem]{ulem}
13 \RequirePackage{xifthen}
14 \RequirePackage{environ} % environments with \BODY, for wyimek
17 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 \usepackage[landscape]{geometry}
24 \usepackage[explicit]{titlesec}
27 \usepackage[MeX]{polski}
33 \usepackage[xetex]{graphicx}
34 \usepackage[silent]{fontspec} % silent - no warnings, quiet - warn only to log
37 %\usepackage{trimspaces} % imported by something else?
39 \usepackage[overload]{textcase}
41 \usepackage[colorlinks=false,linkcolor=white,pdfborder={0,0,0},setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
42 %\usepackage{hyperref}
47 \usepackage[stable]{footmisc}
49 %http://tex.stackexchange.com/questions/40510/set-first-paragraph-no-indentation-after-re-definition-of-section#40512
52 \counterwithout{footnote}{chapter}
53 \usepackage{microtype}
59 \emergencystretch=30pt
64 %%%%%%%%%%%%%%%%%%%%%%% Paper size
65 %\setlength\baselineskip{7.14pt}
69 %% paperheight=225mm,%
70 %% text={117mm,162mm},%
74 %% right=30mm]{geometry}%
77 %% top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
78 %% headsep=3\baselineskip,
83 %% textheight=\dimexpr7.14pt*(32*2+1)\relax,%
84 %% includehead]{geometry}
87 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
90 ItalicFont = Lato-Italic,
92 BoldItalicFont = Lato-BoldItalic,
93 Ligatures={Common, Contextual},
94 SmallCapsFont = Lato-Regular,
95 SmallCapsFeatures={Letters=SmallCaps},
98 \newfontface\headfont{LeagueGothic-Regular}
101 \setlength{\parindent}{3mm}
102 \setlength{\parskip}{0mm}
104 % \normalsize – normalny tekst
105 % \large - normalny tekst headingowy (nie wiem czy jest inny niz normalsize?)
106 % \Large - troche większy tekst headingowy (spis treści)
107 % \huge - pagina tytuł rozdziału
108 % \Huge - naglowek na szarym tle
110 %% \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
111 %% \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0,Letters=Uppercase}\selectfont} % srodtytul
112 %% \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
113 %% \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
114 %% \renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
115 %% \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
116 %% \renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
120 % • • • • • • • • • COLORS • •
121 \definecolor{stoK}{cmyk}{0,0,0,1}
122 \definecolor{theme}{gray}{.3}
123 \definecolor{headcolor}{HTML}{EA5F21}
124 \definecolor{graybg}{HTML}{737372}
127 % • • • • • • • • METADATA • •
130 \newcommand{\@address}{}
131 \newcommand{\address}[1]{\renewcommand{\@address}{#1}}
134 % • • • • • • • • HEADINGS • •
135 %% this will go to \leftmark
140 \renewcommand{\chaptermark}[1]{\markboth{\MakeTextUppercase{#1}}{}}
141 % on the odd right : chapter title
142 \fancyhead[LE,RO]{{\color{headcolor}\headfont\huge\leftmark}}
143 \fancyfoot[LE,RO]{{\headfont\Large\thepage}}
144 \fancyfoot[LO]{{\headfont\normalfont\MakeTextUppercase{\@title}}}
145 \fancyfoot[RE]{{\headfont\normalfont\MakeTextUppercase{\@address}}}
147 \renewcommand{\headrulewidth}{0pt}
148 \renewcommand{\footrulewidth}{0pt}
151 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
153 \fancypagestyle{plain}{%
155 \fancyfoot[LE,RO]{{\headfont\Large\thepage}}
156 \fancyfoot[LO]{{\headfont\normalfont\MakeTextUppercase{\@title}}}
160 % • • • • • • • • TITLES • • •
161 % no chapter numbers and no ``Rozdział'' word
162 %\renewcommand{\thechapter}{}
163 %\renewcommand{\chaptername}{}
165 % • chapter • • • • • • • • • •
166 \makeatletter\newenvironment{chaptertitlebox}{ \begin{lrbox}{\@tempboxa}\begin{minipage}[t][\dimexpr\textheight-0.5cm\relax]{\dimexpr\linewidth-0.5\columnsep\relax}}{\end{minipage}\end{lrbox}%
167 \colorbox{graybg}{\raisebox{1cm}{\usebox{\@tempboxa}}}
170 \newcommand{\nochapternumbers}{
171 \renewcommand{\thesection}{\@arabic \c@section .}
176 \startcontents[chapter]
177 \titleformat{\chapter}[block]%
178 {\begin{chaptertitlebox}}%
180 {\Huge{}\headfont\color{white}#1%
181 \newline\printcontents[chapter]{}{1}{}%
183 [\end{chaptertitlebox}]
185 \titlespacing*{\chapter}{0pt}{0pt}{0pt}
188 % • section • • • • • • • • • • • • • • •
189 \titleformat{\section}[runin]%
190 {\large\headfont%\nochapternumbers
192 {}{0pt}{\makebox[\linewidth][l]{\color{headcolor}\raggedright{}\thesection
194 % this is just to make the spacing between section and following
195 % text right (newlines produce strange amount of space
196 \\\makebox[\linewidth][l]{~}}%
198 \titlecontents{section}[0pt]{\headfont\large\color{white}}%
199 {\thecontentslabel}{\contentsmargin{0pt}}%
200 {\hfill\color{white}{\thecontentspage }}
203 % \fboxsep=0pt % for framebox
204 % ramki wkokół elementów \fbox{}
205 %\titlespacing*{\section}{0pt}{0pt}{2\baselineskip}
208 %% \titleformat{\chapter}[block]%
209 %% {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
210 %% {}{0pt}{\parbox{80mm}{\raggedright#1}}
211 %% \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
212 %% \setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
213 %% \setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
214 %% \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
217 %% \titleformat{\section}%
218 %% {\addfontfeature{LetterSpace=0.3}\large}%
219 %% {\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
220 %% \renewcommand{\thesection}{\Roman{section}}
221 %% \titlespacing*{\section}{0pt}{\baselineskip}{0em}
223 %% \titleformat{\subsection}[block]%
225 %% {\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
227 %% \renewcommand{\thesubsection}{\Alph{subsection}}
228 %% \titlespacing*{\subsection}{0pt}{\baselineskip}{0em}
230 %% \newcommand{\typosubsubsection}[1]{%
235 %%%%% Footnotes (works with footmisc) %%%%%%%%
236 \newlength{\footnoteindent}\newlength{\footnoteprespace}
237 \setlength{\footnoteindent}{8mm}%{3.5mm}
238 \setlength{\footnoteprespace}{0em}
241 \renewcommand\@makefnmark{%
242 \hspace{\footnoteprespace}
243 \hbox{{\normalfont \@thefnmark}}%
245 \renewcommand\thefootnote{[\arabic{footnote}]}
247 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
248 \renewcommand\footnotelayout[1]{%
249 \setlength{\leftskip}{\footnoteindent}#1}
251 %% \long\def\@makefntext#1{%
252 %% \setlength{\leftskip}{\footnoteindent}%
253 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
254 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
256 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
260 \newlength{\myendnoteprespace}\setlength{\myendnoteprespace}{.5em}
261 \newlength{\myendnoteindent}\setlength{\myendnoteindent}{14mm+.5em}
263 \renewcommand\theendnote{[\roman{endnote}]}
264 \renewcommand\makeenmark{\hspace{\myendnoteprespace}\theenmark}
265 \renewcommand{\notesname}{}
266 \newcommand{\authornotes}{
269 \chapter{Przypisy autora}
270 \setlength{\parindent}{0pt}
271 \def\enotesize{\normalsize}
274 %% \newcommand{\@makeentext}[1]{%
275 %% \noindent\theenmark\hspace{\footnoteindent}#1
278 %% \def\enoteformat{\rightskip\z@ \parindent=0em
279 %% \makebox[\myendnoteindent][l]{\makeenmark}} % 12.4mm - measured biggest endnote marker (in Moglen text [xxxviii])
280 \def\enoteformat{\rightskip\z@ \setlength{\leftskip}{\myendnoteindent-\myendnoteprespace} \parindent=0em
281 \leavevmode\llap{\makebox[\myendnoteindent][l]{\makeenmark}}}
285 \def\trimspace#1{\trim@spaces{#1}}
289 %%%%%%%%%%%%%%%%%%%%%% Wyimki
290 %% \floatstyle{plain}
291 %% \newfloat{wyimekbox}{p}{wmk}
292 %% \floatname{wyimekbox}{Wyimek}
294 \NewEnviron{wyimek}{%
297 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
301 \begin{minipage}[t][\textheight][c]{70mm}
310 %% wyimek that doesn't leave text in text flow
311 %% TODO: reduce code duplication
312 \NewEnviron{wyimekextra}{%
315 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
319 \begin{minipage}[t][\textheight][c]{70mm}
330 %%%%%%%%%%%%%%%%%%%%%%%%%%
336 \doublehyphendemerits=9000
337 \finalhyphendemerits=6000
340 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
341 \newsavebox{\ximagebox}\newlength{\ximageheight}
342 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
343 \newcommand{\xbox}[1]
344 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
345 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
346 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
347 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
349 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
352 \newcommand{\makecover}{
356 %% \paperheight=210mm
358 \newgeometry{paperwidth=297mm,paperheight=210mm}
362 \thispagestyle{empty}
363 \newlength{\PictHOffset}
364 \newlength{\PictVOffset}
365 \setlength{\PictHOffset}{1in}
366 \addtolength{\PictHOffset}{\hoffset}
367 \addtolength{\PictHOffset}{\oddsidemargin}
369 \setlength{\PictVOffset}{1in}
370 \addtolength{\PictVOffset}{\voffset}
371 \addtolength{\PictVOffset}{\topmargin}
372 \addtolength{\PictVOffset}{\headheight}
373 \addtolength{\PictVOffset}{\headsep}
374 \addtolength{\PictVOffset}{\topskip}
376 \addtolength{\PictVOffset}{-\paperheight}
378 \noindent\hspace*{-\PictHOffset}%
379 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
380 \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
388 \renewcommand{\maketitle}{
389 %\vspace{\paperheight}
390 \thispagestyle{empty}
393 \thispagestyle{empty}
398 \Huge \noindent \thetitle
403 \vspace{\baselineskip}
414 %\indent\emph{You made this book possible.}
415 \vspace{7\baselineskip}
418 \includegraphics[scale=.2]{logo.eps}
424 \newcommand{\editorialsection}{
426 \thispagestyle{empty}
428 \setlength{\parindent}{0mm}
434 \renewcommand*\contentsname{Spis treści}
435 \newcommand{\spistresci}{
438 \setcounter{tocdepth}{0}
447 \newcommand{\tytul}[1]{%
452 \newcommand{\nazwapodutworu}[1]{%
456 \newcommand{\autorutworu}[1]{%
458 %\subsection*{\typosubsection{#1}}%
461 \newcommand{\dzielonadrzedne}[1]{%
465 \newcommand{\nazwautworu}[1]{%
469 \newcommand{\podtytul}[1]{%
470 \subsection*{\typosubsubsection{#1}}%
473 \newcommand{\podtytulpodutworu}[1]{%
474 \subsection*{\typosubsubsection{#1}}%
477 \newcommand{\translator}[1]{%
478 \subsection*{\typosubsubsection{tłum. #1}}%
480 \newcommand{\translatorsline}[1]{%
484 \newcommand{\powiesc}[1]{#1}
485 \newcommand{\opowiadanie}[1]{#1}
486 \newcommand{\lirykal}[1]{#1}
487 \newcommand{\lirykalp}[1]{#1}
488 \newcommand{\dramatwierszowanyl}[1]{#1}
489 \newcommand{\dramatwierszowanylp}[1]{#1}
490 \newcommand{\dramatwspolczesny}[1]{#1}
493 \newcommand{\dedykacja}[1]{%
501 \newcommand{\dlugicytat}[1]{%
503 \noindent{}\ignorespaces#1%
508 \newcommand{\poezjacyt}[1]{%
513 \newcommand{\motto}[1]{%
518 \newcommand{\listaosob}[2]{%
525 \newcommand{\nagloweklisty}[1]{%
526 \typosubsubsection{#1}%
529 \newcommand{\listaosoba}[1]{%
533 \newcommand{\kwestia}[1]{%
537 \newcommand{\naglowekakt}[1]{%
539 \subsection*{\typosubsection{#1}}%
541 \newcommand{\naglowekczesc}[1]{%
545 \newcommand{\srodtytul}[1]{%
549 \newcommand{\naglowekscena}[1]{%
550 \subsubsection*{\typosubsubsection{#1}}%
553 \newcommand{\theautorrozdzialu}{}
555 \newcommand{\autorrozdzialu}[1]{%
556 \renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\normalsize\it #1}}}
560 \newcommand{\naglowekrozdzial}[1]{%
561 \startcontents[chapter]
563 \chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}%
564 \renewcommand{\theautorrozdzialu}{}%
567 \newcommand{\naglowekosoba}[1]{%
568 \par{\textsc{#1}}\nopagebreak%
570 \newcommand{\naglowekpodrozdzial}[1]{%
571 \section{#1}\nopagebreak%
574 \newcommand{\miejsceczas}[1]{%
577 \newcommand{\didaskalia}[1]{%
581 \newcommand{\akap}[1]{%
584 % newline here needed, we don't use \par cause it ignores \noindent before
586 \newcommand{\akapdialog}[1]{%
589 \newcommand{\akapcd}[1]{%
593 \newcommand{\mottopodpis}[1]{%
601 \newcommand{\strofa}[1]{%
602 #1\vspace{\baselineskip}%
605 \newcommand{\wers}[1]{#1}
607 \newcommand{\wersakap}[1]{%
610 \newcommand{\werscd}[1]{%
613 \newcommand{\werswciety}[2][1em]{%
618 \newcommand{\mat}[1]{$#1$}
620 \newcommand{\didasktekst}[1]{%
623 \newcommand{\slowoobce}[1]{%
628 \newif\ifinnota \innotafalse
630 \newcommand{\tytuldziela}[1]{%
639 \newcommand{\wyroznienie}[1]{%
643 \newcommand{\nota}[1]{%
648 \noindent{}\small{}#1%
655 \newcommand{\osoba}[1]{%
659 \newcommand{\sekcjaswiatlo}{%
660 \vspace{\baselineskip}%
663 \newcommand{\sekcjaasterysk}{%
664 \vspace{\baselineskip}%
670 \newcommand{\separatorlinia}{%
676 \newcommand{\ilustrscale}[0]{1}
677 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
679 \newcommand{\ilustr}[3][]{
681 \ifthenelse{\isempty{#1}}%
682 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
683 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
688 \newcommand{\lista}[1]{%
690 %\setlength{\parskip}{\parindent}
695 \newcommand{\punkt}[1]{%
698 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
700 \newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}