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
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
|
% \LaTeX-Main\
% !TeX encoding=UTF-8
%% The LaTeX package incgraph - version 1.3.0 (2024/03/14)
%% incgraph.tex: Manual
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2012-2024 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\documentclass[a4paper,11pt]{ltxdoc}
\usepackage{incgraph-doc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{center}
\vspace*{5mm}
\begin{tcolorbox}[enhanced,
center upper,width=10cm,boxrule=0.4pt,
colback=white,colframe=black!50!yellow,drop fuzzy midday shadow=black!50!yellow]
{\bfseries\LARGE The \texttt{incgraph} package\par}\medskip
{\large Manual for version \version\ (\datum)\par}
\end{tcolorbox}\bigskip
{\large Thomas F.~Sturm%
\footnote{Prof.~Dr.~Dr.~Thomas F.~Sturm, Institut f\"{u}r Mathematik und Informatik,
University of the Bundeswehr Munich, D-85577 Neubiberg, Germany;
email: \href{mailto:thomas.sturm@unibw.de}{thomas.sturm@unibw.de}}\par\medskip
\normalsize\url{https://www.ctan.org/pkg/incgraph}\par
\url{https://github.com/T-F-S/incgraph}
}
\end{center}
\bigskip
\begin{absquote}
\begin{center}\bfseries Abstract\end{center}
|incgraph| provides tools for including graphics on full paper size.
The graphics can be centered for a given paper format or the paper may be
resized to the graphics dimensions.
The main use case for the package |incgraph| is to transform one or many scans
or taken pictures to a PDF document. It can also be applied for full paper size
\LaTeX\ created graphics.
The package |incgraph| provides a tool box with basic macros and a
convenience user interface which wraps the well-known |includegraphics|.
Also, bookmarking is especially supported.
\end{absquote}
\enlargethispage*{1cm}
\tableofcontents
\begin{inctext}[paper=graphics]
\begin{tcolorbox}[title={Caveat\hfill --- Page \thepage\ ---},
colframe=red!65!black,colback=red!10!white,fonttitle=\Large\bfseries,
fontupper=\large,arc=0mm,outer arc=0mm]
This documentation contains a lot of effects which can only be seen
when viewed on a computer screen. If you read this text on paper, you
will not notice the paper resizing and the bookmarks. Also, pages in landscape may probably
be rotated by your printer.
\end{tcolorbox}
\end{inctext}
%--------------------------------------
\section{Introduction}
\subsection{Motivation}
The main purpose of this package is to include one or more graphics on full
paper size. This means that a graphic is either centered on a blank page
presumable of the given document paper size or the page is resized
to the dimensions of the graphic.
For the graphics, JPG files or PDF files or other supported formats may be
used by inclusion. Alternatively, the graphics (or whatever) can be produced
by \LaTeX\ code.
An important use case for the package |incgraph| is to transform one or many scans
or taken pictures to a PDF document. Optionally, the included graphics can
be commented with bookmarks for the resulting PDF document.
The well-known |graphicx| package \cite{carlisle:graphics} allows the inclusion
of several types of external graphics files. The convenience user interface
of |incgraph| described in Section \ref{sec:interface} relies on this package and adds
assistance for the described purpose. Note that the package is designed for and
tested with |pdflatex| to produce PDF directly. Also, the package is
intended to harmonize with |lualatex|.
Some features like the paper
resizing may not be applicable for other work-flows.
Many of the features of the convenience user interface can be used directly
with various basic macros. These are collected and described
as a 'basic tool box' in Section \ref{sec:basictoolbox}.
If this package does not aid your intended purpose, you may take a look
at the |pdfpages| package \cite{matthias:pdfpages} which also supports the insertion of
external multi-page PDF documents.
\subsection{Loading the Package}
|incgraph| is loaded in the usual manner in the preamble:
\begin{dispListing}
\usepackage{incgraph}
\end{dispListing}
The package |incgraph| loads the package
|pgfkeys| \cite{tantau:tikz}. If no options are given, it also
loads the packages |pgf|, |pgffor| \cite{tantau:tikz},
the package |graphicx| \cite{carlisle:graphics}, and the
package |bookmark| \cite{oberdiek:bookmark}.
The following package options are available:
%-------------------------------------------------------------------------------
\begin{docPackageOptions}
{
{
doc name = pgf,
doc description = {no value, initially set},
},
{
doc name = nopgf,
doc description = {no value, initially unset},
},
}
The option |nopgf| prevents the loading of |pgf| and |pgffor|.\\
The opposite option |pgf| resets to loading the packages.
\end{docPackageOptions}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
\begin{docPackageOptions}
{
{
doc name = graphicx,
doc description = {no value, initially set},
},
{
doc name = nographicx,
doc description = {no value, initially unset},
},
}
The option |nographicx| prevents the loading of |graphicx|.\\
The opposite option |graphicx| resets to loading the package.
\end{docPackageOptions}
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
\begin{docPackageOptions}
{
{
doc name = bookmark,
doc description = {no value, initially set},
},
{
doc name = nobookmark,
doc description = {no value, initially unset},
},
}
The option |nobookmark| prevents the loading of |bookmark|.\\
The opposite option |bookmark| resets to loading the package.
\end{docPackageOptions}
%-------------------------------------------------------------------------------
So, the minimal package loading is done with the following:
\begin{dispListing}
\usepackage[nopgf,nographicx,nobookmark]{incgraph}
\end{dispListing}
Note that you can always load the mentioned packages yourself. This is
intended to avoid possible option clashes the easy way.
\clearpage
%--------------------------------------
\section{User Interface}\label{sec:interface}
\subsection{Inclusion Macros for External Graphics}
The macros of this section rely on the |\includegraphics| command from
the package |graphicx| \cite{carlisle:graphics}.
%Section \ref{sec:basictoolbox} describes more basic commands.
\begin{docCommand}{incgraph}{\oarg{options}\oarg{graphics options}\marg{file name}}
The picture file with the given \meta{file name} is included in the center
of a separate page. Depending on the \meta{options}, this page keeps the
document size or is resized to the graphics dimensions.
The applicable \meta{options} are listed in Section \ref{sec:keys}.
If \meta{graphics options} are given, these are added to the options for
the underlying |\includegraphics| command. See the documentation of
|graphicx| \cite{carlisle:graphics} for a list of applicable \meta{graphics options}.
\begin{texexptitled}%
{The hand-drawn example (centered); see page~\pageref{exacenter}}{exacenter.listing}
\incgraph[paper=current,label={exacenter},overlay page number at bottom,
bookmark={The hand-drawn example (centered)}]{example.jpg}
\end{texexptitled}
\begin{texexptitled}%
{The hand-drawn example (resized page); see page~\pageref{exaresized}}{exaresized.listing}
\incgraph[paper=graphics,label={exaresized},
bookmark={The hand-drawn example (resized page)}]{example.jpg}
\end{texexptitled}
\begin{texexptitled}%
{The hand-drawn example (rotated and oversized); see page~\pageref{exarotated}}{exarotated.listing}
\incgraph[paper=current,label={exarotated},target=oversized,
bookmark={The hand-drawn example (rotated and oversized)}]%
[angle=30,scale=3]{example.jpg}
\end{texexptitled}
\end{docCommand}
\enlargethispage*{1cm}
\begin{docCommand}{incmultigraph}{\oarg{options}\oarg{graphics options}\marg{file name pattern}\marg{list}}
All picture files matching the given \meta{file name pattern} where some
parts are substituted by elements of the \meta{list}
are included in the center of a separate page. Depending on the \meta{options}, the pages keep the
document size or are resized to the graphics dimensions.
The applicable \meta{options} are listed in Section \ref{sec:keys}.
If \meta{graphics options} are given, these are added to the options for
the underlying |\includegraphics| command. See the documentation of
|graphicx| \cite{carlisle:graphics} for a list of applicable \meta{graphics options}.\\
The \meta{list} may contain any construction allowed for the |\foreach| statement \cite{tantau:tikz},
especially a list of numbers.
The elements of the list can be used inside the \meta{file name pattern}
with the following macros:
\begin{itemize}
\item\docAuxCommand{n}: The current element of the list (may be a number).
\item\docAuxCommand{ni}: The position of the current element inside the list, i.\,e.\ |\ni|
counts from 1 to the size of the list.
\item\docAuxCommand{nn}: The zero-filled |\n|, if |\n| is a number. The digit
number of |\nn| is determined by \refKey{/igr/zerofill}.
\end{itemize}
The resolved \meta{file name pattern} is stored inside the macro:
\begin{itemize}
\item\docAuxCommand{nt}: This file name may be used for bookmarking.
\end{itemize}
In the default behavior, non existing files are ignored.
\begin{texexptitled}%
{A series of pictures; see from page~\pageref{exaseries.1}. The image files
exaimage-0001.png to exaimage-0150.png are included but only three
of them exist.}{exaseries.listing}
\incmultigraph[zerofill=4,bookmark={A series of pictures: \nt},
paper=current,label={exaseries.\n}]{exaimage-\nn.png}{1,...,150}
\end{texexptitled}
\end{docCommand}
\subsection{Inclusion Macro for Internal Graphics}
\begin{docEnvironment}{inctext}{\oarg{options}}
The environment content is included in the center
of a separate page. Depending on the \meta{options}, this page keeps the
document size or is resized to the content dimensions.
The applicable \meta{options} are listed in Section \ref{sec:keys}.
\begin{texexptitled}%
{Some text on a shrunk paper; see page~\pageref{inctext1}}{inctext1.listing}
\begin{inctext}[paper=graphics,label={inctext1},bookmark={A huge ABC}]
\fontsize{20mm}{20mm}\selectfont\bfseries ABC
\end{inctext}
\end{texexptitled}
\begin{texexptitled}%
{A tikzpicture as text content; see page~\pageref{inctext2}}{inctext2.listing}
\begin{inctext}[paper=a6,landscape,label={inctext2},bookmark={Graph},
overlay page number at bottom=8mm]
\begin{tikzpicture}[zustand/.style={circle,fill=Gold,draw},scale=2]
\draw node[zustand] (s0) {$s_0$}
+(30:3cm) node[zustand] (s1) {$s_1$}
++(-30:3cm) node[zustand] (s2) {$s_2$}
+(30:3cm) node[zustand] (s3) {$s_3$};
\path[very thick,-latex]
(s0) edge node[above left] {a} (s1)
edge node[below left] {b} (s2)
(s1) edge[out=-120,in=120] node[left] {b} (s2)
edge node[above right] {a} (s3)
(s2) edge[out=60,in=-60] node[right] {a} (s1)
edge node[below right] {b} (s3);
\end{tikzpicture}
\end{inctext}
\end{texexptitled}
\end{docEnvironment}
\subsection{(Global) Option Setting}
\begin{docCommand}{igrset}{\marg{options}}
Sets options for \refCom{incgraph}, \refCom{incmultigraph}, and
\refEnv{inctext} inside the current \TeX\ group.
For example, the options \refKey{/igr/paper} and
\refKey{/igr/zerofill} may be defined for the whole document by this:
\begin{dispListing}
\igrset{paper=current,zerofill=3}
\end{dispListing}
\end{docCommand}
\clearpage
%--------------------------------------
\section{Option Keys}\label{sec:keys}
\subsection{Paper (Media) Size}\label{sec:papersize}
\begin{docIgrKey}{currentpaper}{}{no value}
The paper size keeps unchanged at the current size
except if \refKey{/igr/landscape} is used.
The current paper size has not to
be the document paper size.
See page \pageref{exacenter} for the output
of Example \ref{exacenter.listing} on page \pageref{exacenter.listing}.
\end{docIgrKey}
\begin{docIgrKey}{documentpaper}{}{no value}
The paper size is set to the initial document paper size.
\end{docIgrKey}
\begin{docIgrKey}{graphicspaper}{}{no value, initially set}
The paper is resized to the dimensions of the included image.
The \refKey{/igr/landscape} option is ignored for this paper.
See page \pageref{exaresized} for the output
of Example \ref{exaresized.listing} on page \pageref{exaresized.listing}.
\end{docIgrKey}
\begin{docIgrKey}{paper size}{=\meta{width}:\meta{height}}{no default}
The paper is resized to the given \meta{width} and \meta{height}.
\end{docIgrKey}
\begin{docIgrKey}{paper}{=\meta{name}}{no default}
The paper size is chosen according to the given \meta{name}.
Feasible values for the \meta{name} are
|current|, |document|, |graphics|,
|a0|, |a1|, |a2|, |a3|, |a4|, |a5|, |a6|, |a7|, |a8|, |a9|, |a10|,
|b0|, |b1|, |b2|, |b3|, |b4|, |b5|, |b6|, |b7|, |b8|, |b9|, |b10|,
|c0|, |c1|, |c2|, |c3|, |c4|, |c5|, |c6|, |c7|, |c8|, |c9|, |c10|,
|d0|, |d1|, |d2|, |d3|, |d4|, |d5|, |d6|, |d7|,
|executive|, |letter|, |legal|, |ledger|.
\end{docIgrKey}
\begin{docIgrKey}{landscape}{}{no value}
If set the width and height of the chosen paper are switched. Note that
this turns the paper by 90 degrees but the contents of the paper is not
turned.
\end{docIgrKey}
\begin{docIgrKey}{portrait}{}{no value, initially set}
Disables the \refKey{/igr/landscape} mode.
\end{docIgrKey}
\ExplSyntaxOn
\foreach \x in {a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,
b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,
c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,
d0,d1,d2,d3,d4,d5,d6,d7,
executive,letter,legal,ledger}
{\begin{docIgrKey}{\x paper}{}{no~value}
\igrset{\x paper}%
The~paper~size~is~set~to~
\texttt{\l__incgra_target_width_tl}~$\times$~\texttt{\l__incgra_target_heigth_tl}.
\end{docIgrKey}}
\ExplSyntaxOff
\begin{docIgrKey}{center}{}{no value, deprecated}
An alias for \refKey{/igr/currentpaper}.
\end{docIgrKey}
\begin{docIgrKey}{page}{}{no value, deprecated}
An alias for \refKey{/igr/graphicspaper}.
\end{docIgrKey}
\clearpage
\subsection{Graphics Inclusion}
\begin{docIgrKey}{options}{=\marg{graphics options}}{no default, initially empty}
The \meta{graphics options} are applied to the underlying \docAuxCommand*{includegraphics} command.
See the documentation of
|graphicx| \cite{carlisle:graphics} for a list of applicable \meta{graphics options}.
\begin{texexptitled}%
{A resized image; see page~\pageref{exagraphresize}}{exagraphresize.listing}
\igrset{options={width=10cm,height=10cm}, paper=graphics,
overlay page number at top=5mm
}
\incgraph[bookmark={A resized image}, label={exagraphresize}]%
{exaimage-0037.png}
\end{texexptitled}
\end{docIgrKey}
\begin{docIgrKey}{options add}{=\marg{graphics options}}{no default, initially empty}
The \meta{graphics options} are added to the current list of options
for the underlying \docAuxCommand*{includegraphics} command.
\end{docIgrKey}
\begin{docIgrKey}{include command}{\colOpt{=\meta{macro}}}{default and initially \cs{includegraphics}}
Replaces the internally used \docAuxCommand*{includegraphics} command by the given \meta{macro}.
Note that \meta{macro} has to have the same signature as \docAuxCommand*{includegraphics},
i.\,e.\ it has to take two arguments where the first argument is optional.
\end{docIgrKey}
\begin{docIgrKey}{existence check}{=\meta{macro}}{no default}
Replaces the internally used \docAuxCommand*{IfFileExists}
(in truth \docAuxCommand*{file_if_exist:nTF})
command by the given \meta{macro}.
Note that \meta{macro} has to have the same signature as \docAuxCommand*{IfFileExists},
i.\,e.\ it has to take three arguments.
\end{docIgrKey}
\begin{docIgrKeys}[
doc parameter = {},
doc description = {no value}
]
{
{
doc name = no existence check,
doc new = 2021-10-16,
},
{
doc name = fail on not found,
},
}
Omits any existence checks by the package, i.e. the underlying
\docAuxCommand*{includegraphics} is called directly and may
stop the compilation with an error if the included file does not exist.
Both options are equal, but the newer \refKey{/igr/no existence check}
is considered to be more comprehensible.
\end{docIgrKeys}
\begin{docIgrKey}{ignore on not found}{}{no value, initially set}
Not existing included files are ignored without warning. This is the default
setting and is intended to be used with fragmentary file lists.
\end{docIgrKey}
\clearpage
\begin{docIgrKeys}[
doc parameter = \colOpt{=\marg{extension list}},
doc description = {initially unset},
doc new = 2021-10-16,
]
{
{
doc name = ignore on not found with extensions,
},
{
doc name = ignore on not found with extensions*,
},
}
Tests, if the included file with an added \emph{extension} exists and
performs the inclusion on existence. Otherwise, included files are ignored without warning.
Tested \emph{extensions} are taken from the optional comma separated \meta{extension list}
or (exclusively) from the configured list from \refKey{/igr/extensions} and friends
(only, if \meta{extension list} is not given).\par
\refKey{/igr/ignore on not found with extensions*} also tests, if the included
file without added \emph{extension} exists and takes it on existence.\par
Note that if a file is included with a given extension, this extension is not
replaced by the listed extension, but prolonged with it.\par
These options are intended for mixed file lists, e.g. |.jpg| and |.png|, or
unkown type file lists.
Note that if you \emph{know} the (singular) extension of your files, you are
encouraged to use \refKey{/igr/ignore on not found} instead for performance reasons.
\begin{dispListing}
\incmultigraph[ignore on not found with extensions={.jpg,.png}]{myfile\n}{1,...,100}
% includes e.g. `myfile1.jpg`, `myfile2.png`, `myfile42.jpg`, ...
\incmultigraph[ignore on not found with extensions={.jpg,.png}]{myfile\n.xy}{1,...,100}
% includes e.g. `myfile1.xy.jpg`, `myfile2.xy.png`, `myfile42.xy.jpg`, ...
\incgraph[ignore on not found with extensions={.jpg,.png}]{myfile}
% tests `myfile.jpg` and `myfile.png` for existence (and inclusion)
\incgraph[ignore on not found with extensions*={.jpg,.png}]{myfile}
% tests `myfile`, `myfile.jpg`, and `myfile.png` for existence (and inclusion)
\incmultigraph[ignore on not found with extensions]{myfile\n}{1,...,100}
% includes files with extensions given by /igr/extensions
\end{dispListing}
\end{docIgrKeys}
\begin{docIgrKey}[][doc new=2021-10-16]{extensions}{=\marg{extension list}}{initially |.jpg,.png|}
Specifies a comma separated \meta{extension list} to be used in combination with
\refKey{/igr/ignore on not found with extensions}.
\end{docIgrKey}
\begin{docIgrKey}[][doc new=2021-10-16]{extensions add}{=\marg{extension list}}{initially unset}
Adds a comma separated \meta{extension list} to an already defined list from
\refKey{/igr/extensions}.
\end{docIgrKey}
\begin{docIgrKey}[][doc new=2021-10-16]{extensions from graphics}{}{initially unset}
Takes the list of extensions from \docAuxCommand*{DeclareGraphicsExtensions}
of the |graphics| \cite{carlisle:graphics} package as setup for \refKey{/igr/extensions}.
While this looks like the most comfortable options, this can significantely
increase compilation time when used for fragmentary file lists, because
every non-existing file from the file list will induce a lot of existence checks.
Also note that this options uses internals from |graphics| and is not
guaranteed to work with future versions of |graphics|.
\end{docIgrKey}
\clearpage
\subsection{Hypertargets, Labels, and Bookmarks}
\begin{docIgrKey}{hyper}{}{no value, initially set}
An automated hyper target is set to the current image. The hyper target is placed
at the top left corner of the page. It is used internally, when a bookmark is added.
\end{docIgrKey}
\begin{docIgrKey}{no hyper}{}{no value}
No automated hyper target is set to the current image. Use this option, if
the package |bookmark| is not included.
\end{docIgrKey}
\begin{docIgrKey}{target}{=\meta{anchor}}{no default}
The next hypertarget destination value is set to \meta{anchor} instead of
an automatically created value. This may be used for hyperlinks.
\begin{dispExample}
\hyperlink{oversized}{This is linked to the oversized example (click me)}.
The target value '|oversized|' was defined in Example~\ref{exarotated.listing},
see page~\pageref{exarotated.listing}.
\end{dispExample}
\end{docIgrKey}
\clearpage
\begin{docIgrKey}{label}{=\meta{text}}{no default, initially empty}
Adds a \LaTeX\ label to the included image.
\end{docIgrKey}
\begin{docIgrKey}{bookmark}{=\meta{text}}{no default, initially empty}
Adds a PDF bookmark with the given \meta{text} to the current image.
\end{docIgrKey}
\begin{docIgrKey}{bookmark options}{=\marg{bookmark options}}{no default, initially empty}
Sets the options for a bookmark.
See the documentation of
|bookmark| \cite{oberdiek:bookmark} for a list of applicable \meta{bookmark options}.
\begin{texexptitled}%
{Bookmark options; see page~\pageref{exabookmark}}{exabookmark.listing}
% not every PDF reader will show the effect!
\igrset{bookmark options={bold,color={red}},currentpaper}
\incgraph[bookmark={This ugly image again!},label={exabookmark}]%
{example.jpg}
\end{texexptitled}
\end{docIgrKey}
\begin{docIgrKey}{bookmark heading}{=\meta{text}}{no default, initially empty}
For \refCom{incmultigraph}, an additional bookmark with the given \meta{text}
is set as a heading before the images are included.
\begin{texexptitled}%
{A series of pictures; see from page~\pageref{exaheading.1}}{exaheading.listing}
\incmultigraph[zerofill=4,currentpaper,
bookmark heading={A series of pictures},
bookmark heading options={level=subsection},
bookmark={\nt},bookmark options={level=subsubsection},
overlay page number at bottom,
label={exaheading.\n}]{exaimage-\nn.png}{1,...,150}
\end{texexptitled}
\end{docIgrKey}
\begin{docIgrKey}{bookmark heading options}{=\marg{bookmark options}}{no default, initially empty}
Sets the options for a \refKey{/igr/bookmark heading}.
See the documentation of
|bookmark| \cite{oberdiek:bookmark} for a list of applicable \meta{bookmark options}.
\end{docIgrKey}
\clearpage
\subsection{Autosize}
\begin{docIgrKeys}
{
{
doc name = autosize,
doc parameter = \colOpt{=true\textbar false},
doc description = {default |true|, initially |false|},
doc new = {2024-03-09}
}
}
If set to |true|, the picture box is resized to fit into the paper while
keeping the aspect ratio. This
setting has no effect for \refKey{/igr/graphicspaper}.
Note that this autosize is applied after possible size and scaling options
for |\includegraphics| are conducted, see \refCom{incgraph} and \refCom{incmultigraph}.
\begin{texexptitled}%
{Autosized pictures; see from page~\pageref{autosize.1}}{autosize.listing}
\incmultigraph[zerofill=4, currentpaper, autosize,
bookmark heading={Autosized pictures},
bookmark heading options={level=subsection},
bookmark={\nt},bookmark options={level=subsubsection},
overlay page number at bottom,
label={autosize.\n}]{exaimage-\nn.png}{1,...,150}
\end{texexptitled}
The following tuning
options influence how the resizing is done.
\end{docIgrKeys}
\begin{docIgrKeys}
[
doc parameter = {=\meta{length}},
doc description = {no default, initially |0mm|},
doc new = {2024-03-09}
]
{
{ doc name = autosize width gap },
{ doc name = autosize height gap },
{ doc name = autosize gap }
}
\meta{length} is subtracted from the width or height of the current paper size
to compute the target size for the automatic picture box scaling.
\refKey{/igr/autosize gap} sets both values at the same time.
For example, |autosize gap=20mm| gives (at least) |10mm| space around
the rescaled picture box.\par
Negative \meta{length} values allow the picture box to extrude over the borders of
the current paper.
\end{docIgrKeys}
\begin{docIgrKeys}
[
doc parameter = {=\meta{floating-point expression}},
doc new = {2024-03-09}
]
{
{ doc name = autosize min scale, doc description = {no default, initially |0.001|} },
{ doc name = autosize max scale, doc description = {no default, initially |1000|} }
}
The scale number of the automatic scaling will
always be between \refKey{/igr/autosize min scale} and \refKey{/igr/autosize max scale}
even if other settings are violated.\par
|autosize min scale=1| means that the picture box is never to be shrunk.\par
|autosize max scale=1| means that the picture box is never to be enlarged.\par
\end{docIgrKeys}
\clearpage
\subsection{Borders and Shifts}
The following settings enlarge or shrink the picture box, if
\refKey{/igr/graphicspaper} is used. For other paper settings, the result
will be a certain shift of the picture box since the enlarged box
will be centered on the paper.
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{left border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the left hand side.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{bottom border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the bottom.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{right border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the right hand side.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{top border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the top.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{horizontal border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the left hand side and the right hand side.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{vertical border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at the top and bottom.
\end{docIgrKey}
\begin{docIgrKey}[][doc new and updated={2015-03-12}{2024-03-08}]{border}{=\meta{length}}{no default, initially |0pt|}
Adds a space of \meta{length} at all four sides.
\end{docIgrKey}
\begin{docIgrKey}[][doc new={2024-03-08}]{xshift}{=\meta{length}}{no default, initially |0pt|}
Shifts the picture box in horizontal direction without changing the paper size.
This adapts the current values of \refKey{/igr/left border} and \refKey{/igr/right border}.
Therefore, use this option \emph{after} the border values are set.
\end{docIgrKey}
\begin{docIgrKey}[][doc new={2024-03-08}]{yshift}{=\meta{length}}{no default, initially |0pt|}
Shifts the picture box in vertical direction without changing the paper size.
This adapts the current values of \refKey{/igr/top border} and \refKey{/igr/bottom border}.
Therefore, use this option \emph{after} the border values are set.
\end{docIgrKey}
\clearpage
\subsection{Map and Match}
\begin{docIgrKey}{set matches}{=\marg{list}}{no default, initially empty}
The \meta{list} is a comma separated list of \meta{key}=\meta{value} pairs.
For every pair, the given \meta{key} is mapped to the given \meta{value}.
Later, this \meta{value} can be retrieved by
\refKey{/igr/if match code},
\refKey{/igr/if match set}, and
\refKey{/igr/if match set bookmark}.
\begin{dispListing}
\igrset{set matches={
foo = bar,
1 = A very red image,
37 = A not so centered number,
123 = A greenish example}}
\end{dispListing}
\end{docIgrKey}
\tcbusetemp
\begin{docIgrKey}{if match code}{=\marg{key}\marg{then}\marg{else}}{no default}
If the \meta{key} was defined by \refKey{/igr/set matches},
\refCom{igrsetmatchvalue}, or \refCom{igrsetmatches},
the corresponding value is put in the
macro |\igrmatchvalue| and the \meta{then} code is
executed. If the \meta{key} is unknown, the \meta{else} code is
executed.
\end{docIgrKey}
\begin{docIgrKey}{if match set}{=\marg{key}\marg{then}\marg{else}}{no default}
If the \meta{key} was defined by \refKey{/igr/set matches},
\refCom{igrsetmatchvalue}, or \refCom{igrsetmatches},
the corresponding value is put in the
macro |\igrmatchvalue| and |\igrset{|\meta{then}|}| is executed.
If the \meta{key} is unknown, |\igrset{|\meta{else}|}| is executed.
\end{docIgrKey}
\begin{docIgrKey}{if match set bookmark}{=\marg{key}\marg{then}\marg{else}}{no default}
If the \meta{key} was defined by \refKey{/igr/set matches},
\refCom{igrsetmatchvalue}, or \refCom{igrsetmatches},
the corresponding value is put in the
macro |\igrmatchvalue| and the current PDF bookmark is set to \meta{then}.
If the \meta{key} is unknown, the current PDF bookmark is set to \meta{else}.
\begin{texexptitled}%
{Map and match example; see from page~\pageref{examatch.1}}{examatch.listing}
\incmultigraph[zerofill=4,paper=graphics,
bookmark heading={Map and match example},
bookmark heading options={level=subsection},
bookmark options={level=subsubsection},
if match set bookmark={\n}{\igrmatchvalue\ (\n)}{\nt},
overlay page number at bottom,
label={examatch.\n}]{exaimage-\nn.png}{1,...,150}
\end{texexptitled}
\end{docIgrKey}
\begin{docIgrKey}{disable match}{}{no value, initially set}
Disables the statements by
\refKey{/igr/if match code},
\refKey{/igr/if match set}, and
\refKey{/igr/if match set bookmark}.
\end{docIgrKey}
\clearpage
\subsection{Overlays}
\begin{docIgrKey}{overlay}{=\marg{tikz code}}{no default, initially unset}
Introduces arbitrary \meta{tikz code} to be drawn over the included image.
Note that the \tikzname\ package \cite{tantau:tikz} has to be loaded separately.
To support positioning inside the picture, two |tikz| nodes named
|box| and |page| are defined. |box| takes the dimensions of the included image
and |page| takes the dimensions of the image or of the page depending on the usage of
\refKey{/igr/paper}.
\begin{texexptitled}%
{Overlay; see page~\pageref{overlay}}{overlay.listing}
\igrset{bookmark options={level=subsection}, paper=current}
\incgraph[bookmark={Picture with overlay},label={overlay},
overlay={
\node[draw=red,line width=3pt,fill=red,fill opacity=0.1,
minimum width=14cm,circle] (circ) at (page.center) {};
\node[fill=blue!5!white,below right,text width=4cm] (A)
at ([xshift=1cm,yshift=-1cm]page.north west)
{This included image is overlayed with |tikz| code.};
\node[fill=green!10!white,above,text width=7cm] (B)
at ([yshift=2cm]page.south)
{Image Name: \nt\\Page number: \thepage\\
Example~\ref{overlay.listing} on page~\pageref{overlay.listing}};
\draw[line width=2pt,->] (A)--(circ);
\draw[line width=2pt,green!50!black,dashed]
(box.south west)--(box.south east);
\draw[line width=2pt,->,green!50!black] (B)--(box.south);
}]{example.jpg}
\end{texexptitled}
\end{docIgrKey}
\begin{docIgrKey}{overlay page number at}{=\meta{position}}{no default, initially unset}
Overlays the page number at the given |tikz| \meta{position}.
\end{docIgrKey}
\begin{docIgrKey}{overlay page number at bottom}{\colOpt{=\meta{length}}}{default |1.5cm|}
Overlays the page number at \meta{length} above the bottom edge of the paper.
See Example~\ref{exacenter.listing} on page~\pageref{exacenter.listing}
and the result on page~\pageref{exacenter}.
\end{docIgrKey}
\begin{docIgrKey}{overlay page number at top}{\colOpt{=\meta{length}}}{default |1.5cm|}
Overlays the page number at \meta{length} below the top edge of the paper.
See Example~\ref{exagraphresize.listing} on page~\pageref{exagraphresize.listing}
and the result on page~\pageref{exagraphresize}.
\end{docIgrKey}
\begin{docIgrKey}[][doc new=2021-10-11]{overlay page number options}{=\marg{tikz options}}{no default, initially\\
\texttt{fill opacity=0.35,draw opacity=0.5,text opacity=1,inner xsep=1em,\\
rounded corners,fill=white,draw=black}}
Defines the \tikzname\ node style for drawing the page number with one
of the options above, e.g. \refKey{/igr/overlay page number at}
\end{docIgrKey}
\begin{docIgrKey}[][doc new=2021-10-21]{overlay page number options app}{=\marg{tikz options}}{no default, initially unset}
Appends the given \meta{tikz options} to \refKey{/igr/overlay page number options}.
\end{docIgrKey}
\begin{docIgrKey}{no overlay}{}{no value, initially set}
Removes the overlay setting.
\end{docIgrKey}
\clearpage
\subsection{Miscellaneous}
\begin{docIgrKey}{pagestyle}{=\meta{page style}}{no default, initially |empty|}
Sets the \meta{page style} for the included graphics.
\end{docIgrKey}
\begin{docIgrKey}{zerofill}{=\meta{digits}}{no default, initially |0|}
For \refCom{incmultigraph}, the current number element
is filled up with leading zeros until the \meta{digits} count is reached.
If \meta{digits} is 0 or 1, nothing is added. A \meta{digits} value
greater than 10 is treated as 10 which is the maximum number of
possible digits. The result is accessible as |\nn|, see \refCom{incmultigraph}.
Note that |zerofill| should be set to |0| if the list elements
in \refCom{incmultigraph} are not numbers.
\end{docIgrKey}
\clearpage
\hypertarget{optkeyexamples}{}%
\bookmark[level=section,dest=optkeyexamples]{User Interface and Option Examples}
\igrset{bookmark options={level=subsubsection}}
\foreach \n in {1,...,12} {\inputlisting{\n}}
\clearpage
%--------------------------------------
\section{Examples}
\subsection{Including some Scans to Standard Paper}
In this scenario, we have some scans (or images from whatever source) which
should be combined to a PDF document for our paperless office.
The paper size of the PDF document is set to a standard paper (here: letter size)
to allow the document to be printed.
The following Example \ref{somescans} is a complete template for such a document.
Here, the images |example.jpg|,
|exaimage-0001.png|,
|exaimage-0037.png|, and
|exaimage-0123.png| are used for the resulting document.
All included images are automatically bookmarked with the page number and
the file name of the source image.
\inputexamplelisting{\jobname-example-a.tex}{somescans}
%\def\thecurrentexample{\jobname-example-a.tex}
%\tcbinputlisting{listing file=\thecurrentexample,listing only,
% example={\texttt{\thecurrentexample}}{somescans}}
The compiled result of this stand-alone source code is not found in this document but as
a separate file in the documentation directory of the package.
\clearpage
\subsection{Creating a Picture Book}
For this example, we assume again that a bunch of image files is to be
combined to a PDF document. This time, the target document should be read or
displayed mainly on computer screens and may never be printed. Therefore,
the paper size is set flexible for the current image.
The following Example \ref{picturebook} is a complete template for such a document.
All included images are resized to a common width, but this is not necessary.
The resulting document is considered as an e-book where the bookmarks are the
most important navigation accessory.
Single page inclusions with \refCom{incgraph} are bookmarked directly, but
multi-page inclusions with \refCom{incmultigraph} can be bookmarked using the
map-and-match feature of the package.
The example shows a mixed usage of the macros.
Note that the bookmarks of the multi-page part are matched with the numbers
contained in the file names of |exaimage-0001.png| to |exaimage-0150.png|.
\inputexamplelisting{\jobname-example-b.tex}{picturebook}
%\def\thecurrentexample{\jobname-example-b.tex}
%\tcbinputlisting{listing file=\thecurrentexample,listing only,
% example={\texttt{\thecurrentexample}}{picturebook}}
The compiled result of this stand-alone source code is not found in this document but as
a separate file in the documentation directory of the package.
\clearpage
\subsection{Reformatting from Letter to DIN A4 (and vice versa)}
In this scenario, we assume to have a PDF document with the 'wrong' paper size.
Here, |incgraph-example-a.pdf| has the letter format, but A4 paper
is needed. |incgraph| is used to reformat to the desired paper size.
Of course, it also works the other way around.
The following Example \ref{reformatting} is a complete template for such a document.
The document gets the desired paper size with the \refKey{/igr/paper} option.
Then, all four pages of the original document are imported to the new paper
size. Note that the actual document content itself is not resized because
letter and DIN A4 are not so very different. If needed, the content could be
shrunk or enlarged easily by adding a |scale| option for the underlying
|\includegraphics| macro or by using \refKey{/igr/autosize}.
\inputexamplelisting{\jobname-example-c.tex}{reformatting}
%\def\thecurrentexample{\jobname-example-c.tex}
%\tcbinputlisting{listing file=\thecurrentexample,listing only,
% example={\texttt{\thecurrentexample}}{reformatting}}
The compiled result of this stand-alone source code is not found in this document but as
a separate file in the documentation directory of the package.
\clearpage
\subsection{Drawing on Full Paper Size}
In the following examples, no external image is included to the document.
Instead, the image (or whatever) is created inside the document and put
on a separate page which could be resized or take the original document
paper size.
In Example \ref{fullpaperdrawing1}, a |tikzpicture| is drawn. The whole
picture is put inside an \refEnv{inctext} environment which puts the drawing
on a separate page which gets the dimensions of the drawing.
\begin{texexptitled}{Creation of a special text page (resized)}{fullpaperdrawing1}
\begin{inctext}[paper=graphics, bookmark=My special text page (resized)]
\begin{tikzpicture}%
\coordinate (A) at (0,0); \coordinate (B) at (16,16);
\path[use as bounding box,top color=Goldenrod!25,bottom color=Navy!25]
(A) rectangle (B);
\coordinate (C) at ([xshift=1cm,yshift=1cm]A);
\coordinate (D) at ([xshift=-1cm,yshift=-1cm]B);
\path (C) -- coordinate (E) (D);
\draw[rounded corners=5mm,very thick,Navy] (C) rectangle (D);
\path (C) |-
node [pos=0.75,fill=white,draw=Navy,very thick,inner sep=3mm]
{My Special Page \thepage} (D);
\node[text width=10cm,align=flush center,font=\Large] at (E) {
This is my special page. It takes the dimensions of the underlying
|tikzpicture| as seen in the source code of Example~\ref{fullpaperdrawing1}
on page~\pageref{fullpaperdrawing1}.};
\end{tikzpicture}
\end{inctext}
\end{texexptitled}
See the result on the following page.
\clearpage\inputlastlisting
In Example \ref{fullpaperdrawing2}, nearly the same |tikzpicture| is drawn.
This time, the current paper size is used which puts the drawing
on a separate page but without resizing the paper.
To draw seamlessly, the document paper size of 21cm to 29.7cm is used
directly inside the |tikzpicture|.
\begin{texexptitled}{Creation of a special text page (fitted)}{fullpaperdrawing2}
\begin{inctext}[paper=current, target=mytarget,
bookmark=My special text page (fitted)]
\begin{tikzpicture}%
\coordinate (A) at (0,0); \coordinate (B) at (21,29.7);
\path[use as bounding box,top color=Goldenrod!25,bottom color=Navy!25]
(A) rectangle (B);
\coordinate (C) at ([xshift=1cm,yshift=1cm]A);
\coordinate (D) at ([xshift=-1cm,yshift=-1cm]B);
\path (C) -- coordinate (E) (D);
\draw[rounded corners=5mm,very thick,Navy] (C) rectangle (D);
\path (C) |-
node [pos=0.75,fill=white,draw=Navy,very thick,inner sep=3mm]
{My Special Page \thepage} (D);
\node[text width=10cm,align=flush center,font=\Large] at (E) {
This is my special page. It consumes the whole document paper size with
an underlying |tikzpicture| as seen in the source code of
Example~\ref{fullpaperdrawing2} on page~\pageref{fullpaperdrawing2}.};
\end{tikzpicture}
\end{inctext}
\end{texexptitled}
See the result on the following \hyperlink{mytarget}{page}.
\clearpage\inputlastlisting
%--------------------------------------
\section{Basic Tool Box}\label{sec:basictoolbox}
In this section, some basic macros of the package are documented.
It is assumed that most users will only need the macros from the
user interface described in Section \ref{sec:interface} and Section \ref{sec:keys}.
\subsection{Page Size Commands}
The following macros are auxiliary tools which wrap corresponding length registers
from |pdflatex| and |lualatex|.
\begin{docCommand}[doc new=2021-10-12]{igrGetPageSize}{}
Reads the current page dimensions and stores them into the macros
\refCom{igrPageWidth} and \refCom{igrPageHeight}.
\end{docCommand}
\begin{docCommand}[doc new=2021-10-12]{igrPageWidth}{}
After using \refCom{igrGetPageSize}, \refCom{igrPageWidth} contains
the current page width. This is |\pdfpagewidth| for |pdflatex|,
|\pagewidth| for |lualatex| and a choice of |\pdfpagewidth| or |\paperwidth|
for other engines.
\end{docCommand}
\begin{docCommand}[doc new=2021-10-12]{igrPageHeight}{}
After using \refCom{igrGetPageSize}, \refCom{igrPageHeight} contains
the current page height. This is |\pdfpageheight| for |pdflatex|,
|\pageheight| for |lualatex| and a choice of |\pdfpageheight| or |\paperheight|
for other engines.
\end{docCommand}
\begin{docCommand}[doc new=2021-10-12]{igrSetPageSize}{\marg{width}\marg{height}}
Sets the current page dimensions to \meta{width} and \meta{height}.
In depends on the used engine, if a call to this command has success or
not. This should work for |pdflatex| and |lualatex|.
\end{docCommand}
\subsection{Last Page Commands (Number of Pages)}
The following macros are auxiliary tools which wrap corresponding functions
from |pdflatex| and |lualatex|.
\begin{docCommand}[doc new=2021-10-18]{igrGetLastPage}{\marg{file}}
Reads the last page (page count) from the given (PDF-)\meta{file}
and stores it into the macro \refCom{igrLastPage}.
\end{docCommand}
\begin{docCommand}[doc new=2021-10-18]{igrLastPage}{}
After using \refCom{igrGetLastPage}, \refCom{igrLastPage} contains
the last page of the currently tested file.
This is |\pdflastximagepages| for |pdflatex|,
|\lastsavedimageresourcepages| for |lualatex| and simply $1$
for other engines.
\end{docCommand}
\clearpage
\subsection{Full Page Commands}
\begin{docCommand}{igrpage}{\marg{text}}
The \meta{text} is put on a separate page which is resized to fit the
dimensions of the \meta{text}. \meta{text} may be single letter, an
included picture, or any \LaTeX\ code.
The page number is stored into \docAuxCommand{theigrpage} and
\docAuxCommand{igrAutoTarget} holds a hyper target value for bookmarking.
The style of the separate page is set to
the content of the macro
\docAuxCommand{igrpagestyle} which defaults to 'empty' but can be
redefined.
\end{docCommand}
\begin{docCommand}{igrcenter}{\marg{text}}
The \meta{text} is put in the center of a separate page which has the
current document dimensions. \meta{text} may be single letter, an
included picture or any \LaTeX\ code.
The page number is stored into \docAuxCommand{theigrpage} and
\docAuxCommand{igrAutoTarget} holds a hyper target value for bookmarking.
The style of the separate page is set to
the content of the macro
\docAuxCommand{igrpagestyle} which defaults to 'empty' but can be
redefined.
\end{docCommand}
\begin{docCommand}{igrcenterfit}{\marg{width}\marg{height}\marg{text}}
The \meta{text} is put in the center of a separate page which
is resized to the given \meta{width} and \meta{height}.
\meta{text} may be single letter, an
included picture or any \LaTeX\ code.
The page number is stored into \docAuxCommand{theigrpage} and
\docAuxCommand{igrAutoTarget} holds a hyper target value for bookmarking.
The style of the separate page is set to
the content of the macro
\docAuxCommand{igrpagestyle} which defaults to 'empty' but can be
redefined.
\end{docCommand}
\begin{docCommand}{igrtargetset}{\marg{anchor}}
The next value for \docAuxCommand{igrAutoTarget} is set to \meta{anchor}.
This can be used for hand-made hyperlinks or bookmarks.
An application for |igrtargetset| is found in Example~\ref{fullpaperdrawing2}
on page~\pageref{fullpaperdrawing2}.
\end{docCommand}
\clearpage
\subsection{Box Commands}
\begin{docCommand}{igrboxset}{\marg{text}}
The \meta{text} is put into a \TeX\ box named \docAuxCommand{igrbox}.
Additionally, some auxiliary macros are defined:
\begin{itemize}
\item\docAuxCommand{igrAutoTarget}: unique value for a hyper target.
\item\docAuxCommand{igrBoxWidth}: width of the |\igrbox|.
\item\docAuxCommand{igrBoxHeight}: total height of the |\igrbox|.
\item\docAuxCommand{igrBoxht}: height of the |\igrbox|.
\item\docAuxCommand{igrBoxdp}: depth of the |\igrbox|.
\end{itemize}
\begin{dispExample}
\igrboxset{This is an example}
|\igrAutoTarget| = \igrAutoTarget, |\igrBoxWidth| = \igrBoxWidth,
|\igrBoxHeight| = \igrBoxHeight,\\
|\igrBoxht| = \igrBoxht, |\igrBoxdp| = \igrBoxdp;
\end{dispExample}
\end{docCommand}
\begin{docCommand}{igrboxcenter}{}
The current content of the |\igrbox|
is put in the center of a separate page which has the
current |pdfpage| dimensions.\\
The style of the separate page is set to
the content of the macro
\docAuxCommand{igrpagestyle} which defaults to 'empty' but can be
redefined.
Note that a |\clearpage| or similar has to be inserted before this command.
\end{docCommand}
\clearpage
\begin{docCommand}{igrboxtikz}{}
The current content of the |\igrbox| is embedded into a |\node| command
from the |tikz| package \cite{tantau:tikz} which has to be loaded separately.
Also, the bounding box is adjusted to the |\igrbox|.\\
To support positioning inside the picture, two |tikz| nodes named
|box| and |page| are defined which both take the dimensions of the |\igrbox|.
\begin{dispExample}
\igrboxset{\includegraphics{example.jpg}}%
\begin{tikzpicture}%
\igrboxtikz%
\draw[blue,very thick] (0,0) rectangle (\igrBoxWidth,\igrBoxHeight);
\draw[red] (0,0) grid (\igrBoxWidth,\igrBoxHeight);
\draw[black] ([xshift=-1cm,yshift=-1cm]page.north east) circle (1cm);
\end{tikzpicture}
\end{dispExample}
The boxing macros can also be used nested (see the result on the following page):
\begin{dispListing}
\igrpage{\igrboxset{\includegraphics{example.jpg}}%
\begin{tikzpicture}%
\igrboxtikz%
\draw[blue,very thick] (0,0) rectangle (\igrBoxWidth,\igrBoxHeight);
\draw[red] (0,0) grid (\igrBoxWidth,\igrBoxHeight);
\draw[black] ([xshift=1cm,yshift=-1cm]page.north west) circle (1cm);
\end{tikzpicture}}
\end{dispListing}
\tcbusetemp
\end{docCommand}
\begin{docCommand}{igrboxtikzpage}{}
This is an alias for \refCom{igrboxtikz}.
\end{docCommand}
\begin{docCommand}{igrboxtikzcenter}{}
The current content of the |\igrbox| is embedded into a |\node| command
from the |tikz| package \cite{tantau:tikz} which has to be loaded separately.
This node is placed in the center of a bounding box which takes the current
page dimensions. Afterwards, |\igrBoxWidth| and |\igrBoxHeight| are
redefined to the dimensions of the total page.\\
To support positioning inside the picture, two |tikz| nodes named
|box| and |page| are defined. |box| takes the dimensions of the |\igrbox|
and |page| takes the dimensions of the |tikzpicture|.
\begin{dispListing}
\igrcenter{\igrboxset{\includegraphics{example.jpg}}%
\begin{tikzpicture}%
\igrboxtikzcenter%
\draw[help lines] (0,0) grid (\igrBoxWidth,\igrBoxHeight);
\draw[dashed] (box.south west) rectangle (box.north east);
\draw[very thick,<->] (page.north west)--(box.north west);
\draw[very thick,<->] (page.north east)--(box.north east);
\draw[very thick,<->] (page.south west)--(box.south west);
\draw[very thick,<->] (page.south east)--(box.south east);
\end{tikzpicture}}
\end{dispListing}
See the result on the following page.
\tcbusetemp
\end{docCommand}
\subsection{Map and Match Commands}
\begin{docCommand}{igrsetmatchvalue}{\marg{key}\marg{value}}
The given \meta{key} is mapped to the given \meta{value}. Later, this
\meta{value} can be retrieved by \refCom{igrifmatch}.
\begin{dispExample}
\igrsetmatchvalue{my key A}{my value A}
\def\keytester#1{\igrifmatch{#1}{Hurray: '\igrmatchvalue'}{'#1' unknown}}
\keytester{something}\\
\keytester{my key A}
\end{dispExample}
\end{docCommand}
\begin{docCommand}{igrsetmatches}{\marg{list}}
The \meta{list} is a comma separated list of \meta{key}=\meta{value} pairs.
On every pair, the \refCom{igrsetmatchvalue} macro is applied.
\begin{dispExample}
\igrsetmatches{my key A = my value A, bar = Shakespeare}
\def\keytester#1{\igrifmatch{#1}{Hurray: '\igrmatchvalue'}{'#1' unknown}}
\keytester{something}\\
\keytester{bar}\\
\keytester{my key A}
\end{dispExample}
\end{docCommand}
\begin{docCommand}{igrifmatch}{\marg{key}\marg{then}\marg{else}}
If a \meta{key} was defined by \refCom{igrsetmatchvalue} or
\refCom{igrsetmatches}, the corresponding value is put in the
macro \docAuxCommand{igrmatchvalue} and the \meta{then} code is
executed. If the \meta{key} is unknown, the \meta{else} code is
executed.
\begin{dispExample}
\igrsetmatches{1 = January, 2 = February, 3 = March, apr = April}
\def\monthname#1{\igrifmatch{#1}{The name of month #1\ is \igrmatchvalue.}{%
You are kidding.}}
\monthname{1} \monthname{foo} \monthname{2}\\
\monthname{3} \monthname{apr} \monthname{35}
\end{dispExample}
\end{docCommand}
\clearpage
\subsection{Zero Filling Commands}
\begin{docCommand}{igrmakezerofill}{\marg{macro}\marg{digits}}
With this command, a new \meta{macro} can be defined which takes a
non negative number as parameter.
This number is filled up with leading zeros until the
\meta{digits} count is reached.
If \meta{digits} is 0 or 1, nothing is added. A \meta{digits} value
greater than 10 is treated as 10 which is the maximum number of
possible digits.
\begin{dispExample}
\igrmakezerofill{\myfill}{0}
\myfill{7}, \myfill{12}, \myfill{934}, \myfill{665234}.\\
\igrmakezerofill{\myfill}{3}
\myfill{7}, \myfill{12}, \myfill{934}, \myfill{665234}.\\
\igrmakezerofill{\myfill}{5}
\myfill{7}, \myfill{12}, \myfill{934}, \myfill{665234}.\\
\igrmakezerofill{\myfill}{9}
\myfill{7}, \myfill{12}, \myfill{934}, \myfill{665234}.\\
\igrmakezerofill{\myfill}{30}
\myfill{7}, \myfill{12}, \myfill{934}, \myfill{665234}.
\end{dispExample}
\begin{dispExample}
\igrmakezerofill{\threedigits}{3}
\threedigits{1}%
\foreach \n in {2,...,100} {, \threedigits{\n}}.
\end{dispExample}
\end{docCommand}
\clearpage
%--------------------------------------
% Actually, it is not a good idea to include the references like this!
% Do not follow this bad example ...
\begin{tcbverbatimwrite}{\jobname.bib}
@manual{tantau:tikz,
author = {Till Tantau},
title = {The TikZ and PGF Packages},
subtitle = {Manual for version 3.1.10},
url = {https://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf},
date = {2023-01-15},
}
@manual{carlisle:graphics,
author = {D. P. Carlisle},
title = {Packages in the ‘graphics’ bundle},
url = {https://mirrors.ctan.org/macros/latex/required/graphics/grfguide.pdf},
date = {2021-03-05},
}
@manual{matthias:pdfpages,
author = {Andreas Matthias},
title = {The pdfpages Package},
url = {https://mirrors.ctan.org/macros/latex/contrib/pdfpages/pdfpages.pdf},
date = {2024-01-21},
}
@manual{oberdiek:bookmark,
author = {Heiko Oberdiek},
title = {The bookmark Package},
url = {https://mirrors.ctan.org/macros/latex/contrib/bookmark/bookmark.pdf},
date = {2023-12-10},
}
\end{tcbverbatimwrite}
\clearpage
\printbibliography[heading=bibintoc]
\printindex
\end{document}
|