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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 \usepackage[MeX]{polski}
28 \usepackage[xetex]{graphicx}
29 \usepackage[silent]{fontspec} % silent - no warnings, quiet - warn only to log
32 %\usepackage{trimspaces} % imported by something else?
34 \usepackage[overload]{textcase}
36 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
37 %\usepackage{hyperref}
43 \usepackage[stable]{footmisc}
45 %http://tex.stackexchange.com/questions/40510/set-first-paragraph-no-indentation-after-re-definition-of-section#40512
48 \counterwithout{footnote}{chapter}
50 \usepackage[explicit]{titlesec}
51 \usepackage{microtype}
53 \usepackage[landscape]{geometry}
60 \emergencystretch=30pt
65 %%%%%%%%%%%%%%%%%%%%%%% Paper size
66 %\setlength\baselineskip{7.14pt}
70 %% paperheight=225mm,%
71 %% text={117mm,162mm},%
75 %% right=30mm]{geometry}%
78 %% top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
79 %% headsep=3\baselineskip,
84 %% textheight=\dimexpr7.14pt*(32*2+1)\relax,%
85 %% includehead]{geometry}
88 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
91 ItalicFont = Lato-Italic,
93 BoldItalicFont = Lato-BoldItalic,
94 Ligatures={Common, Contextual},
95 SmallCapsFont = Lato-Regular,
96 SmallCapsFeatures={Letters=SmallCaps},
99 \newfontface\headfont{LeagueGothic-Regular}
102 \setlength{\parindent}{3mm}
103 \setlength{\parskip}{0mm}
105 % \normalsize – normalny tekst
106 % \large - normalny tekst headingowy (nie wiem czy jest inny niz normalsize?)
107 % \Large - troche większy tekst headingowy (spis treści)
108 % \huge - pagina tytuł rozdziału
109 % \Huge - naglowek na szarym tle
111 %% \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
112 %% \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0,Letters=Uppercase}\selectfont} % srodtytul
113 %% \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
114 %% \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
115 %% \renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
116 %% \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
117 %% \renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
121 % • • • • • • • • • COLORS • •
122 \definecolor{stoK}{cmyk}{0,0,0,1}
123 \definecolor{theme}{gray}{.3}
124 \definecolor{headcolor}{HTML}{EA5F21}
125 \definecolor{graybg}{HTML}{737372}
128 % • • • • • • • • METADATA • •
131 \newcommand{\@address}{}
132 \newcommand{\address}[1]{\renewcommand{\@address}{#1}}
135 % • • • • • • • • HEADINGS • •
136 %% this will go to \leftmark
141 \renewcommand{\chaptermark}[1]{\markboth{\MakeTextUppercase{#1}}{}}
142 % on the odd right : chapter title
143 \fancyhead[LE,RO]{{\color{headcolor}\headfont\huge\leftmark}}
144 \fancyfoot[LE,RO]{{\headfont\Large\thepage}}
145 \fancyfoot[LO]{{\headfont\normalfont\MakeTextUppercase{\@title}}}
146 \fancyfoot[RE]{{\headfont\normalfont\MakeTextUppercase{\@address}}}
148 \renewcommand{\headrulewidth}{0pt}
149 \renewcommand{\footrulewidth}{0pt}
152 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
154 \fancypagestyle{plain}{%
156 \fancyfoot[LE,RO]{{\headfont\Large\thepage}}
157 \fancyfoot[LO]{{\headfont\normalfont\MakeTextUppercase{\@title}}}
161 % • • • • • • • • TITLES • • •
162 % no chapter numbers and no ``Rozdział'' word
163 %\renewcommand{\thechapter}{}
164 %\renewcommand{\chaptername}{}
167 \makeatletter\newenvironment{chaptertitlebox}{%
168 \begin{lrbox}{\@tempboxa}\begin{minipage}[t][\dimexpr\textheight-0.5cm\relax]{\dimexpr\linewidth-0.5\columnsep\relax}}{\end{minipage}\end{lrbox}%
169 \colorbox{graybg}{\raisebox{1cm}{\usebox{\@tempboxa}}}
172 \titleformat{\chapter}[block]%
173 {\begin{chaptertitlebox}}%
176 [\end{chaptertitlebox}]
178 \titlespacing*{\chapter}{0pt}{0pt}{0pt}
182 \titleformat{\section}[runin]%
184 {}{0pt}{\makebox[\linewidth][l]{\color{headcolor}\raggedright{}#1}%
185 % this is just to make the spacing between section and following
186 % text right (newlines produce strange amount of space
187 \\\makebox[\linewidth][l]{~}}%
189 %\titlespacing*{\section}{0pt}{0pt}{2\baselineskip}
192 %% \titleformat{\chapter}[block]%
193 %% {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
194 %% {}{0pt}{\parbox{80mm}{\raggedright#1}}
195 %% \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
196 %% \setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
197 %% \setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
198 %% \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
201 %% \titleformat{\section}%
202 %% {\addfontfeature{LetterSpace=0.3}\large}%
203 %% {\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
204 %% \renewcommand{\thesection}{\Roman{section}}
205 %% \titlespacing*{\section}{0pt}{\baselineskip}{0em}
207 %% \titleformat{\subsection}[block]%
209 %% {\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
211 %% \renewcommand{\thesubsection}{\Alph{subsection}}
212 %% \titlespacing*{\subsection}{0pt}{\baselineskip}{0em}
214 %% \newcommand{\typosubsubsection}[1]{%
219 %%%%% Footnotes (works with footmisc) %%%%%%%%
220 \newlength{\footnoteindent}\newlength{\footnoteprespace}
221 \setlength{\footnoteindent}{8mm}%{3.5mm}
222 \setlength{\footnoteprespace}{0em}
225 \renewcommand\@makefnmark{%
226 \hspace{\footnoteprespace}
227 \hbox{{\normalfont \@thefnmark}}%
229 \renewcommand\thefootnote{[\arabic{footnote}]}
231 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
232 \renewcommand\footnotelayout[1]{%
233 \setlength{\leftskip}{\footnoteindent}#1}
235 %% \long\def\@makefntext#1{%
236 %% \setlength{\leftskip}{\footnoteindent}%
237 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
238 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
240 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
244 \newlength{\myendnoteprespace}\setlength{\myendnoteprespace}{.5em}
245 \newlength{\myendnoteindent}\setlength{\myendnoteindent}{14mm+.5em}
247 \renewcommand\theendnote{[\roman{endnote}]}
248 \renewcommand\makeenmark{\hspace{\myendnoteprespace}\theenmark}
249 \renewcommand{\notesname}{}
250 \newcommand{\authornotes}{
253 \chapter{Przypisy autora}
254 \setlength{\parindent}{0pt}
255 \def\enotesize{\normalsize}
258 %% \newcommand{\@makeentext}[1]{%
259 %% \noindent\theenmark\hspace{\footnoteindent}#1
262 %% \def\enoteformat{\rightskip\z@ \parindent=0em
263 %% \makebox[\myendnoteindent][l]{\makeenmark}} % 12.4mm - measured biggest endnote marker (in Moglen text [xxxviii])
264 \def\enoteformat{\rightskip\z@ \setlength{\leftskip}{\myendnoteindent-\myendnoteprespace} \parindent=0em
265 \leavevmode\llap{\makebox[\myendnoteindent][l]{\makeenmark}}}
269 \def\trimspace#1{\trim@spaces{#1}}
273 %%%%%%%%%%%%%%%%%%%%%% Wyimki
274 %% \floatstyle{plain}
275 %% \newfloat{wyimekbox}{p}{wmk}
276 %% \floatname{wyimekbox}{Wyimek}
278 \NewEnviron{wyimek}{%
281 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
285 \begin{minipage}[t][\textheight][c]{70mm}
294 %% wyimek that doesn't leave text in text flow
295 %% TODO: reduce code duplication
296 \NewEnviron{wyimekextra}{%
299 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
303 \begin{minipage}[t][\textheight][c]{70mm}
314 %%%%%%%%%%%%%%%%%%%%%%%%%%
320 \doublehyphendemerits=9000
321 \finalhyphendemerits=6000
324 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
325 \newsavebox{\ximagebox}\newlength{\ximageheight}
326 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
327 \newcommand{\xbox}[1]
328 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
329 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
330 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
331 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
333 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
336 \newcommand{\makecover}{
340 %% \paperheight=210mm
342 \newgeometry{paperwidth=297mm,paperheight=210mm}
346 \thispagestyle{empty}
347 \newlength{\PictHOffset}
348 \newlength{\PictVOffset}
349 \setlength{\PictHOffset}{1in}
350 \addtolength{\PictHOffset}{\hoffset}
351 \addtolength{\PictHOffset}{\oddsidemargin}
353 \setlength{\PictVOffset}{1in}
354 \addtolength{\PictVOffset}{\voffset}
355 \addtolength{\PictVOffset}{\topmargin}
356 \addtolength{\PictVOffset}{\headheight}
357 \addtolength{\PictVOffset}{\headsep}
358 \addtolength{\PictVOffset}{\topskip}
360 \addtolength{\PictVOffset}{-\paperheight}
362 \noindent\hspace*{-\PictHOffset}%
363 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
364 \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
372 \renewcommand{\maketitle}{
373 %\vspace{\paperheight}
374 \thispagestyle{empty}
377 \thispagestyle{empty}
382 \Huge \noindent \thetitle
387 \vspace{\baselineskip}
398 %\indent\emph{You made this book possible.}
399 \vspace{7\baselineskip}
402 \includegraphics[scale=.2]{logo.eps}
408 \newcommand{\editorialsection}{
410 \thispagestyle{empty}
412 \setlength{\parindent}{0mm}
418 \renewcommand*\contentsname{Spis treści}
419 \newcommand{\spistresci}{
422 \setcounter{tocdepth}{0}
431 \newcommand{\tytul}[1]{%
436 \newcommand{\nazwapodutworu}[1]{%
440 \newcommand{\autorutworu}[1]{%
442 %\subsection*{\typosubsection{#1}}%
445 \newcommand{\dzielonadrzedne}[1]{%
449 \newcommand{\nazwautworu}[1]{%
453 \newcommand{\podtytul}[1]{%
454 \subsection*{\typosubsubsection{#1}}%
457 \newcommand{\podtytulpodutworu}[1]{%
458 \subsection*{\typosubsubsection{#1}}%
461 \newcommand{\translator}[1]{%
462 \subsection*{\typosubsubsection{tłum. #1}}%
464 \newcommand{\translatorsline}[1]{%
468 \newcommand{\powiesc}[1]{#1}
469 \newcommand{\opowiadanie}[1]{#1}
470 \newcommand{\lirykal}[1]{#1}
471 \newcommand{\lirykalp}[1]{#1}
472 \newcommand{\dramatwierszowanyl}[1]{#1}
473 \newcommand{\dramatwierszowanylp}[1]{#1}
474 \newcommand{\dramatwspolczesny}[1]{#1}
477 \newcommand{\dedykacja}[1]{%
485 \newcommand{\dlugicytat}[1]{%
487 \noindent{}\ignorespaces#1%
492 \newcommand{\poezjacyt}[1]{%
497 \newcommand{\motto}[1]{%
502 \newcommand{\listaosob}[2]{%
509 \newcommand{\nagloweklisty}[1]{%
510 \typosubsubsection{#1}%
513 \newcommand{\listaosoba}[1]{%
517 \newcommand{\kwestia}[1]{%
521 \newcommand{\naglowekakt}[1]{%
523 \subsection*{\typosubsection{#1}}%
525 \newcommand{\naglowekczesc}[1]{%
529 \newcommand{\srodtytul}[1]{%
533 \newcommand{\naglowekscena}[1]{%
534 \subsubsection*{\typosubsubsection{#1}}%
537 \newcommand{\theautorrozdzialu}{}
539 \newcommand{\autorrozdzialu}[1]{%
540 \renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\normalsize\it #1}}}
544 \newcommand{\naglowekrozdzial}[1]{%
545 \chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
546 \renewcommand{\theautorrozdzialu}{}%
549 \newcommand{\naglowekosoba}[1]{%
550 \par{\textsc{#1}}\nopagebreak%
552 \newcommand{\naglowekpodrozdzial}[1]{%
553 \section{#1}\nopagebreak%
556 \newcommand{\miejsceczas}[1]{%
559 \newcommand{\didaskalia}[1]{%
563 \newcommand{\akap}[1]{%
566 % newline here needed, we don't use \par cause it ignores \noindent before
568 \newcommand{\akapdialog}[1]{%
571 \newcommand{\akapcd}[1]{%
575 \newcommand{\mottopodpis}[1]{%
583 \newcommand{\strofa}[1]{%
584 #1\vspace{\baselineskip}%
587 \newcommand{\wers}[1]{#1}
589 \newcommand{\wersakap}[1]{%
592 \newcommand{\werscd}[1]{%
595 \newcommand{\werswciety}[2][1em]{%
600 \newcommand{\mat}[1]{$#1$}
602 \newcommand{\didasktekst}[1]{%
605 \newcommand{\slowoobce}[1]{%
610 \newif\ifinnota \innotafalse
612 \newcommand{\tytuldziela}[1]{%
621 \newcommand{\wyroznienie}[1]{%
625 \newcommand{\nota}[1]{%
630 \noindent{}\small{}#1%
637 \newcommand{\osoba}[1]{%
641 \newcommand{\sekcjaswiatlo}{%
642 \vspace{\baselineskip}%
645 \newcommand{\sekcjaasterysk}{%
646 \vspace{\baselineskip}%
652 \newcommand{\separatorlinia}{%
658 \newcommand{\ilustrscale}[0]{1}
659 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
661 \newcommand{\ilustr}[3][]{
663 \ifthenelse{\isempty{#1}}%
664 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
665 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
670 \newcommand{\lista}[1]{%
672 %\setlength{\parskip}{\parindent}
677 \newcommand{\punkt}[1]{%
680 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
682 \newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}