summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ebook/ebook.sty
blob: 4b2cb7ab17db5faa3a6efcc16e09c18d33a3cb39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Jørgen Steensgaard",
%%%     version         = "1",
%%%     date            = "1 March 2013",
%%%     time            = "20:50:55 BST",
%%%     filename        = "ebook.sty",
%%%     email           = "jsm@steensgaard.org",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "LaTeX, page layout for PDF-ebooks",
%%%     supported       = "no",
%%%     docstring       = "Page description etc. suitable for writing
%%%                        PDF-documents intended to be read on a 
%%%                        ebook renderers.
%%%                        Uses packages moreverb, graphics and hyperref.
%%%                        Sets \family- and seriesdefault.
%%%                        Removes display of chapter numbers (ToC incl.)
%%%                        Provides \ebook as a command that includes
%%%                        details needed in the document section. 
%%%                       "
%%%  }
%%% ====================================================================
%
% This file, ebook.sty, is in the public domain
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}
\usepackage[         % Page description: 
                     %    common alternatives are a4paper, a5paper etc.
   paperwidth=12cm,  % horizontal screen size
   paperheight=16cm, % vertical ditto
   scale=0.9         % derive other layout details
]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{moreverb}

\renewcommand{\familydefault}{cmss}
\renewcommand{\seriesdefault}{sbc}
\sffamily   % sans-serif for readability
\mdseries   % extra font weight
\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{2}
\pagestyle{empty}


\providecommand{\pagefill}[1][0.001mm]{
\vfill\noindent
\rule{#1}{#1}
\newpage\noindent
}

\providecommand{\ebook}{
\sffamily   % sans-serif for readability
\mdseries   % extra font weight
\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{2}
\pagestyle{empty}
\Large
}

\makeatletter
\renewcommand{\@chapter}[2][]{%
  \thispagestyle{empty}
  \ifnum \c@secnumdepth >\m@ne
       \refstepcounter{chapter}%
       % \typeout{\@chapapp\space\thechapter.}%
       \addcontentsline{toc}{chapter}{#1}%
                 % {\protect\numberline{}#1}%
  \else
    \addcontentsline{toc}{chapter}{#2}%
  \fi
  \chaptermark{#1}%
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \@makechapterhead{#2}%
  \@afterheading
}
\renewcommand{\@makechapterhead}[1]{%
  % \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\renewcommand{\@makeschapterhead}[1]{%
  % \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother