Debian Codegraph @

texmf-dist/source/latex/fullminipage/fullminipage.dtx

raw
1 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % \iffalse meta-comment
3 %
4 % DocStrip file for fullminipage package
5 %
6 % Copyright 2012 Christian Schneider <software(at)chschneider(dot)eu>
7 %
8 % This file is part of fullminipage.
9 %
10 % fullminipage is free software: you can redistribute it and/or modify
11 % it under the terms of the GNU General Public License version 3 as
12 % published by the Free Software Foundation, not any later version.
13 %
14 % fullminipage is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 % GNU General Public License for more details.
18 %
19 % You should have received a copy of the GNU General Public License
20 % along with fullminipage. If not, see <http://www.gnu.org/licenses/>.
21 %
22 % WARNING: THIS IS ALPHA SOFTWARE AND MAY CONTAIN SERIOUS BUGS!
23 %
24 % \fi
25 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 %
27 % \iffalse
28 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
29 %<package>\ProvidesPackage{fullminipage}
30 %<package> [2014/07/06 v0.1.1 fullpage minipage environment]
31 %<*driver>
32 \documentclass[a4paper]{ltxdoc}
33 \usepackage{fullminipage}
34 \usepackage{hyperref}
35 \usepackage{units}
36 \EnableCrossrefs
37 \CodelineIndex
38 \RecordChanges
39 %
40 % modified description environment
41 \newcommand{\listmark}{$\bullet$}
42 \newcommand{\listlengths}{%
43 \setlength{\parsep}{0pt}%
44 \setlength{\itemsep}{0pt}%
45 \setlength{\leftmargin}{10.5em}%
46 \setlength{\rightmargin}{0pt}%
47 \setlength{\labelsep}{1em}%
48 \setlength{\labelwidth}{9.5em}}
49 \newenvironment{mydescription}{%
50 \begin{list}{\listmark}{\listlengths}%
51 }{%
52 \end{list}%
53 }
54 %
55 \begin{document}
56 \DocInput{fullminipage.dtx}
57 \end{document}
58 %</driver>
59 % \fi
60 %
61 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %
63 % \changes{v0.1.0}{2014/06/22}{initial public version}
64 % \changes{v0.1.1}{2014/07/06}{corrected README file; no \LaTeX{} changes}
65 %
66 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %
68 % \CheckSum{151}
69 %
70 % \CharacterTable
71 % {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
72 % 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
73 % Digits \0\1\2\3\4\5\6\7\8\9
74 % Exclamation \! Double quote \" Hash (number) \#
75 % Dollar \$ Percent \% Ampersand \&
76 % Acute accent \' Left paren \( Right paren \)
77 % Asterisk \* Plus \+ Comma \,
78 % Minus \- Point \. Solidus \/
79 % Colon \: Semicolon \; Less than \<
80 % Equals \= Greater than \> Question mark \?
81 % Commercial at \@ Left bracket \[ Backslash \\
82 % Right bracket \] Circumflex \^ Underscore \_
83 % Grave accent \` Left brace \{ Vertical bar \|
84 % Right brace \} Tilde \~}
85 %
86 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 %
88 % \GetFileInfo{fullminipage.sty}
89 %
90 % \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
91 % \DoNotIndex{\@ne}
92 % \DoNotIndex{\advance,\begingroup,\catcode,\closein}
93 % \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
94 %
95 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96 %
97 % \title{The \textsf{fullminipage} package\thanks{This document corresponds
98 % to \textsf{fullminipage}~\fileversion, dated~\filedate. Copyright
99 % 2012,2014 Christian Schneider
100 % \texttt{<software(at)chschneider(dot)eu>}, \url{http://chschneider.eu}.}}
101 % \author{Christian Schneider\\ \texttt{<software(at)chschneider(dot)eu>}}
102 %
103 % \maketitle
104 %
105 % \tableofcontents
106 % \clearpage
107 %
108 % \begin{abstract}
109 % This package provides the environment |fullminipage|, which generates a
110 % |minipage| spanning a new, complete page with page style |empty|.
111 % The environment provides options to set margins around the |minipage| and
112 % configure the background.
113 % \end{abstract}
114 %
115 % \section{Usage}
116 %
117 % \subsection{The Environment}
118 %
119 % \DescribeEnv{fullminipage}
120 % The environment |fullminipage| generates a new page with page style |empty|,
121 % which is spanned by a |minipage|.
122 % The available horizontal and vertical sizes are |\hsize| and |\vsize|,
123 % respectively.
124 %
125 % Caveat: The clearing of the page before/after the |fullminipage| might not
126 % be done correctly in certain circumstances, in particular, multi-column
127 % documents.
128 % Please refer to the |pagebreak| option for details.
129 %
130 % \subsection{Options}
131 %
132 % The environment |fullminipage| has an optional argument, which accepts
133 % a comma-separated list of \meta{key}|=|\meta{value} pairs:
134 % \begin{mydescription}
135 % \item[\textsf{left}] left margin (default: $\unit[0]{pt}$)
136 % \item[\textsf{right}] right margin (default: $\unit[0]{pt}$)
137 % \item[\textsf{top}] top margin (default: $\unit[0]{pt}$)
138 % \item[\textsf{bottom}] bottom margin (default: $\unit[0]{pt}$).
139 % Note that content exceeding the vertical size of the minipage will not be
140 % ``stopped'' by the bottom margin.
141 % The value is rather used to calculate the vertical size of the minipage.
142 % \item[\textsf{alignment}] the vertical alignment inside the minipage (one
143 % of |tcb|; default: |t|)
144 % \item[\textsf{bgcolor}] color of the background (except for the
145 % margins, empty by default).
146 % Omitting the \meta{value} will lead to a black background.
147 % A blue background can, for example, be generated with |bgcolor=blue|.
148 % \item[\textsf{background}] arbitrary macro for the background (empty by
149 % default).
150 % This allows, for example, to put an image into the background with
151 % |background=\includegraphics{<file>}|.
152 % The image will be aligned in the lower left corner of the minipage.
153 % Note that |background| is put on top of the background color defined by
154 % |bgcolor|.
155 % \item[\textsf{pagebreak}] macro for clearing page before and after inserting
156 % the |fullminipage|.
157 % By default, |\newpage| will be used in single-column documents and
158 % |\clearpage|, if a multi-column style is detected.
159 % This detection, however, might fail and the user might want to explicitly
160 % set |pagebreak=\clearpage|.
161 % Note that |\clearpage| has the side-effect of flushing all pending floats.
162 % \end{mydescription}
163 %
164 % \section{License}
165 %
166 % \textsf{fullminipage} is free software: you can redistribute it and/or
167 % modify it under the terms of the GNU General Public License version~3 as
168 % published by the Free Software Foundation, not any later version.
169 %
170 % \textsf{fullminipage} is distributed in the hope that it will be useful,
171 % but WITHOUT ANY WARRANTY; without even the implied warranty of
172 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
173 % Public License for more details.
174 %
175 % You should have received a copy of the GNU General Public License along with
176 % fullminipage. If not, see \texttt{<http://www.gnu.org/licenses/>}.
177 %
178 % \section{Bugs, problems, and suggestions}
179 %
180 % Please report bugs and problems or send suggestions for this package to
181 % Christian Schneider.
182 %
183 % \StopEventually{\PrintChanges\PrintIndex}
184 %
185 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 %
187 % \section{Implementation}
188 %
189 % The implementation is briefly described in this section. First of all, we
190 % need the \textsf{keyval} package for \meta{key}|=|\meta{value} options.
191 % The \textsf{color} package will only be required, if the background color
192 % needs to be defined.
193 % \begin{macrocode}
194 \RequirePackage{keyval}
195 \RequirePackage{color}
196 % \end{macrocode}
197 %
198 % Next, the \meta{key}s are defined:
199 % \begin{macrocode}
200 \define@key{fullminipage}{left}{\def\fullminipage@left{#1}}
201 \define@key{fullminipage}{right}{\def\fullminipage@right{#1}}
202 \define@key{fullminipage}{top}{\def\fullminipage@top{#1}}
203 \define@key{fullminipage}{bottom}{\def\fullminipage@bottom{#1}}
204 \define@key{fullminipage}{alignment}{\def\fullminipage@alignment{#1}}
205 \define@key{fullminipage}{bgcolor}[black]{\def\fullminipage@bgcolor{#1}}
206 \define@key{fullminipage}{background}{\def\fullminipage@background{#1}}
207 \define@key{fullminipage}{pagebreak}{\def\fullminipage@pagebreak{#1}}
208 % \end{macrocode}
209 %
210 % Finally, the environment is defined:
211 % \begin{macrocode}
212 \newenvironment{fullminipage}[1][]{%
213 \begingroup
214 % \end{macrocode}
215 %
216 % The \meta{key}|=|\meta{value} pairs are evaluated and a simple detection
217 % for two-column layout is performed.
218 % \begin{macrocode}
219 \setkeys{fullminipage}{left=\z@,right=\z@,top=\z@,bottom=\z@,%
220 alignment=t,background={},pagebreak=\newpage}%
221 \@ifundefined{twocolumn@sw}{}%
222 {\twocolumn@sw{\setkeys{fullminipage}{pagebreak=\clearpage}}{}}%
223 \if@twocolumn\setkeys{fullminipage}{pagebreak=\clearpage}\fi%
224 \setkeys{fullminipage}{#1}%
225 % \end{macrocode}
226 %
227 % A new page is started with pagestyle |empty|.
228 % \begin{macrocode}
229 \fullminipage@pagebreak
230 \thispagestyle{empty}%
231 % \end{macrocode}
232 %
233 % The top position is calculated and the top (vertical) position adjusted
234 % with |\vspace*|.
235 % \begin{macrocode}
236 \@tempdima=-1in
237 \advance\@tempdima by-\voffset
238 \advance\@tempdima by-\topmargin
239 \advance\@tempdima by-\headheight
240 \advance\@tempdima by-\headsep
241 \@tempdimb=\@tempdima
242 \advance\@tempdima by-\parskip
243 \advance\@tempdima by-\topskip
244 \advance\@tempdima by\fullminipage@top
245 \vspace*{\@tempdima}%
246 % \end{macrocode}
247 %
248 % The bottom position is calculated and the current page size enlarged
249 % accordingly with |\enlargethispage|.
250 % \begin{macrocode}
251 \@tempdima=\paperheight
252 \advance\@tempdima by\@tempdimb
253 \advance\@tempdima by-\textheight
254 \advance\@tempdima by-\fullminipage@bottom
255 \enlargethispage{\@tempdima}%
256 % \end{macrocode}
257 %
258 % The position corresponding to the left margin is calculated.
259 % \begin{macrocode}
260 \leftmargin=-1in
261 \advance\leftmargin by-\hoffset
262 \if@twoside
263 \ifodd\value{page}%
264 \advance\leftmargin by-\oddsidemargin
265 \else
266 \advance\leftmargin by-\evensidemargin
267 \fi
268 \else
269 \advance\leftmargin by-\oddsidemargin
270 \fi
271 \advance\leftmargin by\fullminipage@left
272 % \end{macrocode}
273 %
274 % The length of a line is calculated and the margins are set with
275 % |\parshape|.
276 % \begin{macrocode}
277 \linewidth=\paperwidth
278 \advance\linewidth by-\fullminipage@left
279 \advance\linewidth by-\fullminipage@right
280 \parshape \@ne \leftmargin \linewidth
281 % \end{macrocode}
282 %
283 % Prepare output without extra spaces.
284 % \begin{macrocode}
285 \nointerlineskip
286 \noindent
287 % \end{macrocode}
288 %
289 % The value of |\vsize| is calculated and set. (If it is set before the
290 % |\noindent| above, it will be overwritten in some cases.)
291 % \begin{macrocode}
292 \vsize=\paperheight
293 \advance\vsize by-\fullminipage@top
294 \advance\vsize by-\fullminipage@bottom
295 % \end{macrocode}
296 %
297 % A zero-sized |picture| environment containing the background is output and the
298 % |minipage| is started.
299 % \begin{macrocode}
300 \begin{picture}(0,0)
301 \@ifundefined{fullminipage@bgcolor}{}{%
302 \put(0,0){\makebox(0,0)[bl]%
303 {\color{\fullminipage@bgcolor}{\rule{\linewidth}{\vsize}}}%
304 }%
305 }%
306 \put(0,0){\makebox(0,0)[bl]%
307 {\fullminipage@background}%
308 }%
309 \end{picture}%
310 \begin{minipage}[b][\vsize][\fullminipage@alignment]{\linewidth}
311 }%
312 % \end{macrocode}
313 %
314 % The |minipage| is closed and a new page is started.
315 % \begin{macrocode}
316 {%
317 \end{minipage}%
318 \parfillskip=\z@
319 \fullminipage@pagebreak
320 \endgroup
321 }
322 % \end{macrocode}
323 %
324 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325 %
326 % \Finale
327 %
328 \endinput