summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
blob: 6913806e9e271c9456c4bea154573ae11aaad715 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
% \iffalse meta-comment
%
% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de>
% -----------------------------------------------------------------
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008/05/04 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Martin Scharrer.
%
% This work consists of the files adjustbox.dtx, adjustbox.ins
% and the derived file adjustbox.sty.
%
% $Id: adjustbox.dtx 2372 2011-03-20 12:01:30Z martin $
% \fi
%
% \iffalse
%<package>\ProvidesPackage{adjustbox}
%<de>\ProvidesFile{adjustbox-de.tex}
%<*driver>
\ProvidesFile{adjustbox.dtx}
%</driver>
  [2011/03/20 v0.3 Adjusting TeX boxes (trim, clip, ...)]
%<*driver>
\expandafter\ifx\csname ifenglish\endcsname\relax
    \expandafter\newif\csname ifenglish\endcsname
    \englishtrue
\fi
\ifenglish
    \RequirePackage[english]{babel}
\else
    \RequirePackage[ngerman]{babel}
\fi

%\PassOptionsToPackage{ngerman}{hyperref}
%\RequirePackage[ngerman]{babel}
\documentclass{ydoc}[2011/03/19]
\GetFileInfo{adjustbox.dtx}
\usepackage[utf8]{inputenc}
\usepackage{adjustbox}[\filedate]
\normalmarginpar

\newcommand\babelfiledate{%
    \expandafter\babelfileDate\filedate\relax
}
\def\babelfileDate#1/#2/#3\relax{%
    \begingroup
    \year#1
    \month#2
    \day#3
    \today
    \endgroup
}

%\EnableCrossrefs
%\CodelineIndex
%\RecordChanges
%\OnlyDescription
\renewcommand{\bottomfraction}{0.5}
\begin{document}
  \DocInput{adjustbox.dtx}
  \PrintChanges
  %\newpage\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{184}
%
% \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         \~}
%
%
% \changes{v0.1}{2011/01/24}{First internal version}
% \changes{v0.2}{2011/01/27}{First released version}
% \changes{v0.3}{2011/03/20}{Bug fix for wrong baseline placed on the bottom}
%
% \GetFileInfo{adjustbox.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
%
% \ifenglish\else
%   \title{Das \pkgtitle{adjustbox} Paket}
% \fi
% \author{Martin Scharrer}
% \email{martin@scharrer-online.de}
% \ydocpdfsettings
% \maketitle
%
% \makeatletter
% \def\LATeX{\texorpdfstring{(L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts
%  \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em)\TeX}{(La)TeX}}
% \makeatother
%
% \ifenglish
% \begin{abstract}
%  This package provides macros missing in \pkg{graphics} to trim, clip and generally adjust boxed \LaTeX{} material.
%  The macros allow for verbatim content. Equivalent environments are also provided. The trim and clip operation
%  are implemented using the \pkg{pgf} package, which supports both DVI/PS and PDF output.
%  \\
%  \textcolor{red}{This package is new and the implementation might change in upcoming releases!}
% \end{abstract}
% \else
% \begin{abstract}
%  Dieses Paket stellt einige Makros zur Verfügung die im \pkg{graphics} Paket vermisst werden
%  und \LaTeX{} Material zu beschneiden (\emph{trim}, \emph{clip}) oder allgemein zu modifizieren.
%  Die Makros erlauben Inhalt das im \emph{verbatim} Modus gesetzt ist.
%  Ebenfalls werden passende Umgebungen für die Makros bereitgestellt.
%  Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht,
%  dass sowohl das PS und PDF Ausgabeformat unterstützt.\\
%  \textcolor{red}{Dieses Paket ist noch neu und seine Implementieren kann sich in zukünftigen Versionen noch ändern!}
% \end{abstract}
% \fi
%
% \ifenglish
% \section{Introduction}
% The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro \Macro\includegraphics[<options>]{<file name>} which can
% be used to include graphic files. Several options can be used to scale, resize, rotate, trim and/or clip the graphic.
% The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding 
% operation on \LATeX{} material, which is subsequently placed inside a \Macro\hbox.
% However no macros are provided to trim or clip \LATeX{} material, most likely because this operations
% are not done by \TeX{} but by the output format, i.e. using PostScript (PS) or PDF operations.
% 
% This package provides the missing macros \Macro\clipbox and \Macro\trimbox
% as well as the general \Macro\adjustbox macro. The clipping and trimming operations are implemented using
% a \env{pgfpicture} environment from the \pkg{pgf} package which supports both PS and PDF output.
% \else
% \section{Einleitung}
% Das \LaTeX{} Paket \pkg{graphicx} (die erweiterte Version von \pkg{graphics}) stellt das Macro \Macro\includegraphics[<Optionen>]{<Dateiname>} zur Verfügung
% mit dem Bilddateien eingebunden werden können. Zahlreiche Optionen können benutzt werden um das Bild zu skalieren, an eine vorgegebene Größe anzupassen, es zu rotieren 
% oder den Rand zu beschneiden.
% Ebenfalls stellt das Paket die Makros \Macro\scalebox\relax (skalieren), \Macro\resizebox\relax (Größe ändern) und \Macro\rotatebox\relax (rotieren) zur Verfügung um \LATeX{} Material,
% z.B.\ normalen Text, entsprechend anzupassen. Dies wird dazu in eine horizontale Box (\Macro\hbox) gesetzt.
% Allerdings fehlen Makros um \LATeX{} Material zu beschneiden, wobei der abgeschnittenen Rand entweder sichtbar bleibt (engl.: \emph{trim}) oder ausgeblendet wird (engl. \emph{clip}).
% Dies ist wahrscheinlich der Fall, weil diese Operationen nicht von \TeX{} selbst vorgenommen werden, sondern von dem verwendeten Ausgabeformat, z.B.\ durch PostScript (PS)
% oder PDF Operationen.
%
% Das \textsf{adjustbox} Paket definiert die Makros \Macro\clipbox und \Macro\trimbox, sowie das allgemeine \Macro\adjustbox Macro (engl.: \emph{adjust} = anpassen).
% Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht, dass sowohl das PS und PDF Ausgabeformat unterstützt.
% \fi
% \optionaloff
%
% \ifenglish
% \def\llx{llx}
% \def\lly{lly}
% \def\urx{urx}
% \def\ury{ury}
% \def\text{text}
% \def\height{height}
% \def\width{width}
% \def\totalheight{totalheight}
% \def\depth{depth}
% \def\factor{factor}
% \def\xfactor{x-factor}
% \def\yfactor{y-factor}
% \def\Angle{angle}
% \def\options{options}
% \else
% \def\llx{lux}
% \def\lly{luy}
% \def\urx{orx}
% \def\ury{ory}
% \def\text{Text}
% \def\height{Höhe}
% \def\width{Weite}
% \def\totalheight{Totale Höhe}
% \def\depth{Tiefe}
% \def\factor{Faktor}
% \def\xfactor{X-Faktor}
% \def\yfactor{Y-Faktor}
% \def\Angle{Winkel}
% \def\options{Optionen}
% \fi
%
% \ifenglish
% \section{Usage}
% This section describes the usage of the provided macros, which are outlined in \autoref{sec:boxmacros}.
% Possible advanced values for the macro arguments are mentioned in \autoref{sec:argval}. The existing verbatim support
% is explained in \autoref{sec:verbatim}. Finally \autoref{sec:alternatives} compares the existing macros with the 
% corresponding options of \Macro\djustbox.
% See the example \autoref{sec:example} for examples of this macros.
%
% It is recommended to also read the \emph{Graphics Guide} (|grfguide|, i.e.~the manual of the |graphics|/|x| packages),
% to understand the existing options for \Macro\includegraphics. 
% \else
% \newpage
% \section{Anleitung}
% Dieser Abschnitt beschreibt die Verwendung der Makros dieses Pakets. Diese werden zuerst im \autoref{sec:boxmacros} beschrieben.
% \autoref{sec:argval} erklärt welche Werte in den Makroargumenten verwendet werden können. Die Makros unterstützen sogenannten
% \emph{verbatim} (engl.: wortgetreu) Inhalt was im \autoref{sec:verbatim} erleutert wird.
% Schlussendlich wird im \autoref{sec:alternatives} die exisitierenden Makros mit den entsprechendem Optionen von \Macro\adjustbox
% verglichen. Beispiele für die beschriebenen Makros befinden sich im folgendem \autoref{sec:example}.
%
% Dem Leser wird darüberhinaus die Lektüre der Anleitung der |graphic|/|x| Pakete, der \emph{Graphics Guide}, empfohlen wo
% die möglichen Optionen für das Makro \Macro\includegraphics gelistet sind, die auch für \Macro\adjustbox verwendet werden.
% \fi
%
% \ifenglish
% \Needspace*{7\baselineskip}
% \subsection{Box Modification Macros}\label{sec:boxmacros}
% \else
% \subsection{Makros zur Modifikation von {\LaTeX} Material}\label{sec:boxmacros}
% \fi
%
% \ifenglish
% \subsubsection*{Trim Box Content}
% \else
% \subsubsection*{Rand beschneiden ohne Überhang auszublenden}
% \fi
% \vskip-\lastskip
% \DescribeMacro\trimbox*{<\llx>~<\lly>~<\urx>~<\ury>}{<\text>}
% \ifenglish
% \subsubsection*{Trim Box Content}
% The macro \Macro\trimbox trims the given amount from the lower left (ll) and the upper right (ur) corner of
% the box. This means that the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and
% \meta{urx} and \meta{ury} from the right and top of the box, respectively.
% Trimming means that the official size of the box is reduced, but no material
% is actual removed. The material in the trimmed areas simply swaps over the official border.
%
% If the starred version is used the four coordinates are taken as the |viewport| instead, i.e. the box
% is trimmed to the rectangle described by the coordinates.
% \else
% Das Makro \Macro\trimbox setzt den \meta{Text} in eine \TeX{} Box und reduziert dessen offizielle Größe
% (\emph{bounding box}, engl.: begrenzende Box), so dass \TeX{} annimmt es wäre entsprechend kleiner. Überstehendes Material
% ragt deswegen in den umgebenden Text hinein.
% Die angegebenen Werte im ersten Argument stehen für die Beträge die von der unteren linken (lu) und der oberen rechten (or)
% Ecke entfernt werden. Das heisst, dass der Wert \meta{lux} vom linken Rand, \meta{lly} vom unterem Rand und \meta{orx} und \meta{ory}
% von rechten bzw. oberen Rand abgezogen werden.
% Wird das Makro allerdings in der Sternvariante aufgerufen, stehen die vier Werte für den Darstellungsbereich (\emph{viewport}) und 
% alles ausserhalb wird von der offiziellen Größe abgeschnitten.
% \fi
%
%
% \DescribeEnv[<\text>]{trimbox}*{<\llx>~<\lly>~<\urx>~<\ury>}
% \vspace{-\baselineskip}
% \DescribeEnv[<\text>]{trimbox*}{<\llx>~<\lly>~<\urx>~<\ury>}
% \ifenglish
% The \env{trimbox} and \env{trimbox*} environments do the same as the corresponding macros.
% Special care is taken so that the macros and the environments can have the same name.
% Because of this the star can be either part of the name or an optional argument.
% Also the plain\TeX{} syntax for environments (|\trimbox ... \endtrimbox|) can not be used
% because it will trigger \Macro\trimbox as a macro. 
% \else
% Die Umgebungen \env{trimbox} und \env{trimbox*} erzeugen den selben Effekt wie die gleichnamigen Makros.
% Ein spezieller Trick wird verwendet, damit der selbe Name für ein Makro und für eine Umgebung verwendet werden kann,
% was normallerweise nicht der Fall ist. Aufgrund dessen akzeptier die \env{trimbox} Umgebung auch einen optionallen Stern.
% Die plain\TeX{} Schreibweise für Umgebungen (|\trimbox ... \endtrimbox|) kann allerdings nicht verwendet werden,
% da es \Macro\trimbox als Makro aufrufen würde.
% \fi
%
%
% \ifenglish
% \subsubsection*{Clip Box Content}
% \else
% \subsubsection*{Rand beschneiden und Überhang ausblenden}
% \fi
% \vskip-\lastskip
% \DescribeMacro\clipbox*{<\llx>~<\lly>~<\urx>~<\ury>}{<\text>}
% \ifenglish
% The \Macro\clipbox macro works like the \Macro\trimbox and trims the given amounts from the \meta{text}.
% However, in addition the trimmed material is also clipped, i.e. it is not shown in the final document.
% Note that the material will still be part of the output file but is simply not shown.
% It might be exported using special tools, so using \Macro\clipbox\relax (or \Macro\includegraphics[clip,trim=...])
% to censor classified information would be a bad idea.
% The starred version will again use the given coordinates as |viewport|. 
% \else
% Das \Macro\clipbox Makro arbeiten ähnlich wie \Macro\trimbox nur, dass der entfernte Rand auch wirklich
% ausgeblendet wird. Allerdings bleibt dieses Material Teil der Ausgabedatei und könnte durch spezielle Software exportiert werden.
% Von der Verwendung von \Macro\clipbox\relax (oder \Macro\includegraphics'[clip,trim=...]') um vertrauliche Informationen zu zensieren
% kann deswegen nur abgeraten werden.
% Die Sternvariante verwendet die angegebenen Werte als den zu darstellenden Bereich wie bei \Macro\trimbox'*'.
% \fi
%
% \DescribeEnv[<\text>]{clipbox}*{<\llx>~<\lly>~<\urx>~<\ury>}
% \vspace{-\baselineskip}
% \DescribeEnv[<\text>]{clipbox*}{<\llx>~<\lly>~<\urx>~<\ury>}
% \iffalse
% The environment versions of \Macro\clipbox and \Macro\clipbox*. The same rules as for the trimming environments apply.
% \else
% Die obigen Makros als Umgebungen. Es gelten die gleichen Regeln wie bei den \env{trimbox} Umgebungen.
% \fi
%
%
% \ifenglish
% \subsubsection*{Adjust Box Content}
% \else
% \subsubsection*{Allgemeine Manipulationen von \LaTeX{} Material}
% \fi
% \vskip-\lastskip
% \DescribeMacro\adjustbox{<includegraphics \options>}{<\text>}
% \ifenglish
% The \Macro\adjustbox macro is the general form of all box modifying macros mentioned in the introduction.
% It can be thought as an \Macro\includegraphics for \LATeX{} material.
% It supports the same set of \meta{options}, however they are provided as a mandatory not as an optional argument.
% An \Macro\adjustbox without options would not make sense and can be replaced by a simple \Macro\mbox.
% There is no starred version of this macro. See also \autoref{tab:alternatives} for a comparison of \Macro\adjustbox
% with the other macros.
% \else
% Mit Hilfe des \Macro\adjustbox Makros (engl.\ \emph{adjust} = anpassen, justieren) ist es möglich die selben Optionen
% die \Macro\inludegraphics für Bilder zur Verfügung stellt auch auf beliebiges \LATeX{} Material anzuwenden.
% Die \meta{Optionen} sind dabei allerdings nicht optional, da \Macro\adjustbox ohne jegliche Optionen einem \Macro\mbox
% gleich käme. Eine Sternvariante existiert für dieses Makro nicht.
% Es kann dazu verwendet werden Kombinationen von anderen ähnlichen Makros zu ersetzen, was in \autoref{tab:alternatives} dargestellt wird.
% \fi
%
% \DescribeEnv[<\text>]{adjustbox}{<includegraphics \options>}
% \ifenglish
% The environment version of \Macro\adjustbox.
% \else
% Wie für die anderen Makros gibt es auch für \Macro\adjustbox eine passende Umgebung.
% \fi
%
% \ifenglish
% \subsection{Argument Values}\label{sec:argval}
% The\marginpar{Parsing} argument values are parsed by versatile \Macro\pgfmathparse of the already used |pgf| package.
% This allows very complex arithmetic expressions as any of the trim/clip coordinates or other numeric options.
% See the |pgfmanual| for detailed information.
% Note\marginpar{Space=Separator} that the four values for \Macro\trimbox and \Macro\clipbox as well as for the |trim| and |viewport| option of \Macro\adjustbox
% are separated by spaces. If the expression of any of this values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces `|{ }|'.
% \else
% \newpage
% \subsection{Erlaubte Werte für Makroargumente}\label{sec:argval}
% Die numerischen Werte für die Makros werden durch das vielseitige \Macro\pgfmathparse Makro des sowieso schon verwendeten \pkg{pgf} Paketes
% eingelesen. Dies erlaubt die Verwendung von einfachen oder komplizierten Formeln.
% Eine genaue Beschreibung der unterstützten mathematischen Operationen befindet sich im Handbuch des \pkg{pgf} Paketes.
% Dabei muss beachtet werden das die vier Werte für die \Macro\trimbox und \Macro\clipbox Makros sowie für die |trim| und |viewport| Optionen von \Macro\adjustbox
% durch Leerzeichen getrennt werden müssen. Komplizierte Angaben die ein Leerzeichen enthalten oder auf ein Makro enden (entfernt nachfolgende Leerzeichen) müssen
% deswegen in geschweifte Klammern `|{ }|' gesetzt werden.
% \fi
%
%
% \DescribeMacros
%    \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
% \endDescribeMacros
% \ifenglish
% This \LaTeX{} lengths hold the original dimension of \meta{text} and can be used as part of the arguments to \Macro\adjustbox, \Macro\trimbox and \Macro\clipbox.
% The totalheight is the height plus depth.
% \else
% Diese \LaTeX{} Längen enthalten die Weite, Höhe, Tiefe bzw.\ die totale Höhe (Höhe + Tiefe) des \meta{\text} Arguments bzw.\ des Inhalts der Umgebung.
% Diese Längen können in den ersten Argument von \Macro\adjustbox, \Macro\trimbox und \Macro\clipbox verwendet werden um relative Änderungen vorzunehmen.
% \fi
%
% If\marginpar{Default unit} no unit is provided for of the bounding box coordinates (\llx, \lly, \urx, \ury) then PostScript points
% (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour
% of the |trim| and |viewport| ptions of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx} converts all values, independent if a unit is provided or not,
% internally to bp, because graphics where traditionally stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt.
% Because the |adjustbox| package macros target \LATeX{} material and users will mostly use pt values this internal conversion to bp got disabled for them to 
% avoid unnecessary rounding errors.
%
%
% \subsubsection*{Examples for Argument Values}
% \codeline{\AlsoMacro\trimbox{'{.5\width} 10 {log10(10)/sin(45) + 1} 10pt'}{<\text>}}
% will trim half the original amount from the left, 10\,bp from the bottom and 
% 2.42328\,bp from the right (bp, because no unit was used in the formula; change e.g. `|+ 1|' to `|+ 1pt|' to get 2.42328\,pt),
% as well as 10\,pt from the top.
%
% \subsection{Verbatim Support}\label{sec:verbatim}
% The macros read the \meta{text} as \TeX{} \Macro\hbox and not as an macro argument in order to support verbatim content.
% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
% \begin{macroquote}
%   \trimbox{1 2 3 4}\AlsoMacro\bgroup~<\text>\AlsoMacro\egroup
% \end{macroquote}
% Special care is taken to allow the \meta{text} to be a single macro (except \Macro\bgroup) without any braces:
% \begin{macroquote}
%   \clipbox{1 2 3 4}\AlsoMacro\somemacro
% \end{macroquote}
% This is to support the questionable habit of some \LaTeX{} users to drop the braces for single token arguments.
% All environments support verbatim content.
%
% \ifenglish
% \subsection{Alternatives for existing Macros}\label{sec:alternatives}
% The flexible \Macro\adjustbox can also be used as an alternative to existing macros from the \pkg{graphics} package as shown by Table~\ref{tab:alternatives}.
% Because it is longer then the originals this is only of benefit if combinations are to be replaced or verbatim text must be supported.
% \else
% \subsection{Alternativen für existierende Makros}\label{sec:alternatives}
% Das flexible \Macro\adjustbox Makro kann auch als Alternative für die vorhandenen Makros des \pkg{graphics} Paketes verwenden werden.
% Dies ist in Tabelle~\ref{tab:alternatives} dargestellt.
% Die dies allerdings mehr Schreibarbeit darstellt ist es nur dann von Vorteil, falls mehrere Operationen verknüpft werden sollen
% oder wenn der entsprechende Text im \emph{verbatim} Modus eingelesen werden soll.
% \fi
%
% \ifenglish
% \begin{table}[!hb]
% \else
% \begin{table}[!hb]
% \fi
% \belowcaptionskip\abovecaptionskip
% \colorlet{optional}{black}
% \ifenglish
% \caption{Alternatives for existing Macros}
% \else
% \caption{Alternativen für existierende Makros}
% \fi
% \label{tab:alternatives}
% \hbox to \linewidth{\hss
% \begin{tabular}{ll}
%   \toprule
%   \ifenglish
%   Original Macro (w/o text argument)  &  Alternative  (w/o text argument) \\
%   \else
%   Originales Makro (ohne Text Argument)  &  Alternative  (ohne Text argument) \\
%   \fi
%   \midrule
%   \Macro\rotatebox{<\Angle>}    &   \Macro\adjustbox{'angle='<\Angle>}  \\
%   \Macro\scalebox{<\factor>}    &   \Macro\adjustbox{'scale='<\factor>}  \\
%   \Macro\scalebox{<\xfactor>}[<\yfactor>]    &   \Macro\adjustbox{'width='<\xfactor>\AlsoMacro\width',height='<\yfactor>\AlsoMacro\height}  \\
%   \Macro\reflectbox            &   \Macro\adjustbox{'width=-'\AlsoMacro\width',height='\AlsoMacro\height}  \\
%   \Macro\resizebox{<\width>}{<\height>}    &   \Macro\adjustbox{'width='<\width>',height='<\height>}  \\
%   \Macro\resizebox*{<\width>}{<\totalheight>}    &   \Macro\adjustbox{'width='<\width>',totalheight='<\totalheight>}  \\
%   \Macro\trimbox{<\llx>~<\lly>~<\urx>~<\ury>}    &   \Macro\adjustbox{'trim='<\llx>~<\lly>~<\urx>~<\ury>}  \\
%   \Macro\trimbox*{<\llx>~<\lly>~<\urx>~<\ury>}    &   \Macro\adjustbox{'viewport='<\llx>~<\lly>~<\urx>~<\ury>}  \\
%   \Macro\clipbox{<\llx>~<\lly>~<\urx>~<\ury>}    &   \Macro\adjustbox{'trim='<\llx>~<\lly>~<\urx>~<\ury>,clip}  \\
%   \Macro\clipbox*{<\llx>~<\lly>~<\urx>~<\ury>}    &   \Macro\adjustbox{'viewport='<\llx>~<\lly>~<\urx>~<\ury>,clip}  \\
%   \bottomrule
% \end{tabular}%
% \hss}%
% \end{table}
%
% \clearpage
% \ifenglish
% \section{Examples}\label{sec:example}
% The following examples show the application of the package macros on an example text.
% The result is placed in a tight, colored frame box to show the resulting dimensions.
% \else
% \section{Beispiele}\label{sec:example}
% Die folgenden Beispiele zeigen die Anwendung der Makros dieses Packets auf einen Beispieltext (\Macro\example).
% Das Ergebnis wird mit einer engen, farbigen Umrandung dargestellt um die entgültigen Dimensionen sichtbar zu machen.
% \fi
%
% \begingroup
% \def\examplecontent{\begin{tabular}{@{}|c|c|@{}}
%       \hline
%       A & B \\
%       \hline
%       C & D \\
%       \hline
%   \end{tabular}^^A
% }
% \fboxsep=0pt%
% \def\Fbox{\fcolorbox{red}{white}}%
% \def\X{\vspace*{20pt}}%
% \par\bigskip\noindent
% \begin{tabular}{@{}lc}
%   \X\Macro\example      & \Fbox{\examplecontent} \\
%   \X\Macro\trimbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\trimbox{10 5 10 5}{\examplecontent}} \\
%   \X\Macro\clipbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\clipbox{10 5 10 5}{\examplecontent}} \\
%   \X\Macro\trimbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\trimbox*{15 5 25 30}{\examplecontent}} \\
%   \X\Macro\clipbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\clipbox*{15 5 25 30}{\examplecontent}} \\
%   \X\Macro\adjustbox{trim=10 5 10 5,angle=45}{\AlsoMacro\example} & \Fbox{\adjustbox{trim=10 5 10 5,angle=45}{\examplecontent}} \\
%   \X\Macro\adjustbox{scale=1.5}{\AlsoMacro\example} & \Fbox{\adjustbox{scale=1.5}{\examplecontent}} \\
%   \X\Macro\adjustbox{width=180pt,height=20pt}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt}{\examplecontent}} \\
%   \X\Macro\adjustbox{width=180pt,height=20pt,keepaspectratio}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt,keepaspectratio}{\examplecontent}} \\
% \end{tabular}
%
% \ifenglish
% \subsubsection*{Environment example:}
% \else
% \subsubsection*{Beispiel mit Umgebung:}
% \fi
% \noindent
% \Macro\begin{adjustbox}{angle=2}:\\
% \begin{adjustbox}{angle=2}
%    | verbatim inside \begin{adjustbox}{angle=2} ... \end{adjustbox} |
% \end{adjustbox}
% \endgroup
%
% \StopEventually{}
% \clearpage
% \iffalse
%<*package>
% \fi
% \section{Implementation}
% \ifenglish\else
% Die Dokumentation des Quellcodes ist nur auf Englisch verfügbar.
% \fi
%
%    \begin{macrocode}
\RequirePackage{graphicx}[1999/02/16]
\RequirePackage{pgf}
%    \end{macrocode}
%
% \begin{environment}{clipbox}
% \begin{macro}{\clipbox}
%    \begin{macrocode}
\newcommand\clipbox{%
    \begingroup
    \def\adjustbox@name{clipbox}%
    \@ifstar
        {\adjustbox@{clip,viewport=}}%
        {\adjustbox@{clip,trim=}}%
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\endclipbox{%
    \endadjustbox
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{clipbox*}
%    \begin{macrocode}
\newenvironment{clipbox*}
    {\begin{clipbox}*}
    {\end{clipbox}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{trimbox}
% \begin{macro}{\trimbox}
%    \begin{macrocode}
\newcommand\trimbox{%
    \begingroup
    \def\adjustbox@name{trimbox}%
    \@ifstar
        {\adjustbox@{viewport=}}%
        {\adjustbox@{trim=}}%
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\endtrimbox{%
    \endadjustbox
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{trimbox*}
%    \begin{macrocode}
\newenvironment{trimbox*}
    {\begin{trimbox}*}
    {\end{trimbox}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{adjustbox}
% \begin{macro}{\adjustbox}
%    \begin{macrocode}
\newcommand\adjustbox{%
    \begingroup
    \def\adjustbox@name{adjustbox}%
    \adjustbox@{}%
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\endadjustbox{%
    \unskip
    \egroup
    \color@endgroup
    \egroup
    \adjustbox@@
}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\adjustbox@}
%    \begin{macrocode}
\def\adjustbox@#1#2{%
    \def\adjustbox@setkeys{\setkeys{Gin}{#1#2}}%
    \ifx\@currenvir\adjustbox@name
        \edef\@currenvir{\@currenvir\noexpand\empty}%
        \def\next{%
            \setbox\@tempboxa\hbox\bgroup
                \color@setgroup\bgroup
                \ignorespaces
        }%
    \else
        \def\next{%
            \setbox\@tempboxa\hbox\bgroup%0
                \color@setgroup\bgroup%
                \aftergroup\color@endgroup
                \aftergroup\egroup%
                \aftergroup\adjustbox@@
                \@ifnextchar\bgroup
                    {\let\@let@token=}%
                    {\adjust@box}%
        }%
    \fi
    \next
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjust@box}
%    \begin{macrocode}
\def\adjust@box#1{%
    #1\egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustbox@@}
%    \begin{macrocode}
\def\adjustbox@@{%
%    \end{macrocode}
% Set the box dimension macros.
%    \begin{macrocode}
    \def\width{\wd\@tempboxa}%
    \def\height{\ht\@tempboxa}%
    \def\depth{\dp\@tempboxa}%
    \@tempdimc=\ht\@tempboxa
    \advance\@tempdimc by \dp\@tempboxa\relax
    \def\totalheight{\@tempdimc}%
%    \end{macrocode}
% Locally redefine \Macro\Gin@defaultbp to use \Macro\pgfmathsetmacro
% with |bp| as the default unit.
% This should yield the same results (apart of smaller rounding errors) if values
% are given without unit but avoids the internal conversion to |bp| of values with
% units.
%    \begin{macrocode}
    \def\pgfmathresultunitscale{1bp}%
    \let\pgfmathpostparse\pgfmathscaleresult
    \let\Gin@defaultbp\pgfmathsetmacro
    \let\setlength\pgfmathsetlength
%    \end{macrocode}
% The rest of the code was adapted from the \Macro\Gin@ii macro from the |graphicx| package.
% The \emph{temp switch a} is set to |true| to indicate to |graphicx| that the
% scaling should be done internal, so this package doesn't have to do it.
% The content including macro \Macro\adjustbox@@@ is but into place,
% the saved options are activated and the final size is set.
% The typesetting of the content is finally done by executing the token register.
%    \begin{macrocode}
    \@tempswatrue
    \toks@{{\adjustbox@@@}}%
    \adjustbox@setkeys
    \Gin@esetsize
    \the\toks@
    \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\adjustbox@@@}
%    \begin{macrocode}
\def\adjustbox@@@{%
    \def\Gin@llx{0}%
    \Gin@defaultbp\Gin@lly{+-\dp\@tempboxa}%
    \Gin@defaultbp\Gin@urx{+\wd\@tempboxa}%
    \Gin@defaultbp\Gin@ury{+\ht\@tempboxa}%
    \Gin@viewport@code
    \begin{pgfpicture}%
        \pgfpathmoveto{\pgfqpoint{\Gin@llx pt}{\Gin@lly pt}}%
        \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@lly pt}}%
        \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@ury pt}}%
        \pgfpathlineto{\pgfqpoint{\Gin@llx pt}{\Gin@ury pt}}%
        \pgfpathclose
        \expandafter\pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi\relax
        \pgfset{inner sep=\z@,outer sep=\z@}%
        \pgfnode{rectangle}{base west}{\box\@tempboxa}{ADJUSTBOX@NODE}{}%
        \pgfsetbaselinepointnow{\pgfpointanchor{ADJUSTBOX@NODE}{base}}%
    \end{pgfpicture}%
}
%    \end{macrocode}
% \end{macro}
%
% \Finale
% \iffalse
%</package>
%<*de>
%% Wrapper to set language to German and jobname to 'adjustbox-de'.
%% Does not have to be included in distributions or placed on CTAN.
\expandafter\newif\csname ifenglish\endcsname
\englishfalse
\input{adjustbox.dtx}
%</de>
% \fi