summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/bidi/bidituftetitle.sty
blob: 3d27b24e367d179778f4bf3f22d6c67d646c1a53 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
%%
%% This is file `bidituftetitle.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `table,bidituftetitle.sty')
%% 
%%   __________________________________________________
%%   Copyright (c) 2009--2018  Vafa Khalighi
%% 
%%   It may be distributed and/or modified under the LaTeX Project Public License,
%%   version 1.3c or higher (your choice). The latest version of
%%   this license is at: http://www.latex-project.org/lppl.txt
%% 
%%   This work is “author-maintained” (as per LPPL maintenance status)
%%   by Vafa Khalighi.
%% 
%% 
%% \CheckSum{50072}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bidituftetitle}[2011/06/18 v0.1
bidi implementation of tufte title]
\RequirePackage{biditools}
%%
\newboolean{@bidituftetitle@titlepage}
\DeclareOption{titlepage}{\setboolean{@bidituftetitle@titlepage}{true}}
\DeclareOption{notitlepage}{\setboolean{@bidituftetitle@titlepage}{false}}
\@ifclassloaded{book}{%
\ExecuteOptions{titlepage}}{%
\@ifclassloaded{article}{%
\ExecuteOptions{notitlepage}}%
{}}
\ProcessOptions
%%
\newcommand{\plaintitle}{}%     plain-text-only title
\newcommand{\plainauthor}{}%    plain-text-only author
\newcommand{\plainpublisher}{}% plain-text-only publisher
\newcommand{\thanklesstitle}{}%     full title text minus \thanks{}
\newcommand{\thanklessauthor}{}%    full author text minus \thanks{}
\newcommand{\thanklesspublisher}{}% full publisher minus \thanks{}
\newcommand{\@publisher}{}% full publisher with \thanks{}
\newcommand{\thedate}{\today}
\bidi@patch@AfterPackage{bidi}{%
\renewcommand{\thanks}[1]{\footnote{#1}}
\renewcommand{\LTRthanks}[1]{\LTRfootnote{#1}}
\renewcommand{\RTLthanks}[1]{\RTLfootnote{#1}}
}
\renewcommand{\title}[2][]{%
  \gdef\@title{#2}%
  \begingroup%
    % TODO store contents of \thanks command
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
    \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
    \protected@xdef\thanklesstitle{#2}%
  \endgroup%
  \ifthenelse{\isempty{#1}}%
    {\renewcommand{\plaintitle}{\thanklesstitle}}% use thankless title
    {\renewcommand{\plaintitle}{#1}}% use provided plain-text title
  \@ifundefined{hypersetup}%
    {}% hyperref is not loaded; do nothing
    {\hypersetup{pdftitle={\plaintitle}}}% set the PDF metadata title
}
\let\@author\@empty% suppress default latex.ltx ``no author'' warning
\renewcommand{\author}[2][]{%
  \ifthenelse{\isempty{#2}}{}{\gdef\@author{#2}}%
  \begingroup%
    % TODO store contents of \thanks command
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
    \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
    \protected@xdef\thanklessauthor{#2}%
  \endgroup%
  \ifthenelse{\isempty{#1}}%
    {\renewcommand{\plainauthor}{\thanklessauthor}}% use thankless author
    {\renewcommand{\plainauthor}{#1}}% use provided plain-text author
  \@ifundefined{hypersetup}%
    {}% hyperref is not loaded; do nothing
    {\hypersetup{pdfauthor={\plainauthor}}}% set the PDF metadata author
}
\renewcommand{\date}[1]{%
  \gdef\@date{#1}%
  \begingroup%
    % TODO store contents of \thanks command
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
    \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
    \protected@xdef\thedate{#1}%
  \endgroup%
}
%%
\newcommand{\publisher}[2][]{%
  \gdef\@publisher{#2}%
  \begingroup%
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \renewcommand{\LTRthanks}[1]{}% swallow \LTRthanks contents
    \renewcommand{\RTLthanks}[1]{}% swallow \RTLthanks contents
    \protected@xdef\thanklesspublisher{#2}%
  \endgroup%
  \ifthenelse{\isempty{#1}}
    {\renewcommand{\plainpublisher}{\thanklesspublisher}}% use thankless publisher
    {\renewcommand{\plainpublisher}{#1}}% use provided plain-text publisher
}
%%
\newcommand{\maketitlepage}[0]{%
  \cleardoublepage%
  {%
  \bfseries%
  \begin{fullwidth}%
  \fontsize{18}{20}\selectfont\par\noindent\thanklessauthor%
  \vspace{11.5pc}%
  \fontsize{36}{40}\selectfont\par\noindent\thanklesstitle%
  \vfill%
  \fontsize{14}{16}\selectfont\par\noindent\thanklesspublisher%
  \end{fullwidth}%
  }
  \thispagestyle{empty}%
  \clearpage%
}
%%
\bidi@AfterEndPreamble{%
\renewcommand{\maketitle}{%
  \newpage%
  \global\@topnum\z@% prevent floats from being placed at the top of the page
  \begingroup%
    \setlength{\parindent}{0pt}%
    \setlength{\parskip}{4pt}%
    \let\@@title\@empty%
    \let\@@author\@empty%
    \let\@@date\@empty%
      \gdef\@@title{\LARGE\itshape\@title\par}%
      \gdef\@@author{\Large\itshape\@author\par}%
      \gdef\@@date{\Large\itshape\@date\par}%
    \@@title%
    \@@author%
    \@@date%
  \endgroup%
  \thispagestyle{plain}% suppress the running head
}%
}
%%
\bidi@AfterEndPreamble{%
\ifthenelse{\boolean{@bidituftetitle@titlepage}}
  {\renewcommand{\maketitle}{\maketitlepage}}
  {}
}
%%
\def\cleardoublepage{\clearpage\if@twoside\ifodd\c@page\else
  \hbox{}
  %\vspace*{\fill}
  %\begin{center}
  %  This page intentionally contains only this sentence.
  %\end{center}
  %\vspace{\fill}
  \thispagestyle{empty}
  \newpage
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\endinput
%%
%% End of file `bidituftetitle.sty'.