-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPharmTeX.cls
2630 lines (2398 loc) · 106 KB
/
PharmTeX.cls
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
%%% PharmTeX class, part of the PharmTeX platform.
%%% Copyright (C) 2023 Christian Hove Claussen ([email protected]).
%%% This program is free software: You can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program (see file named LICENSE). If not, see <https://www.gnu.org/licenses/>.
\def\pharmtexdate{2023/09/28}
\def\pharmtexversion{2.6}
%%% Define PharmTeX Class for LaTeX
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{PharmTeX}[\pharmtexdate\space v\pharmtexversion\space PharmTeX Class]
%%%% Load bundle version if possible
\newread\pharmtexread
\IfFileExists{bundleversion.txt}{
\openin\pharmtexread=bundleversion.txt
\read\pharmtexread to \bundleversion
\closein\pharmtexread
}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Apply user options (for \documentclass[options]{PharmTeX})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Default font size is 12pt
\def\@@ptsize{12pt}
\DeclareOption{10pt}{\def\@@ptsize{10pt}}
\DeclareOption{11pt}{\def\@@ptsize{11pt}}
\DeclareOption{12pt}{\def\@@ptsize{12pt}}
%%% Option to show appendix
\newif\ifappendix\appendixtrue
\newif\ifcappendix\cappendixfalse
\DeclareOption{appendix}{\appendixtrue\cappendixtrue}
\DeclareOption{noappendix}{\appendixfalse\cappendixtrue}
%%% Option to show cover page
\newif\ifcoverpage\coverpagetrue
\newif\ifccoverpage\ccoverpagefalse
\DeclareOption{nocoverpage}{\coverpagefalse\ccoverpagetrue}
\DeclareOption{coverpage}{\coverpagetrue\ccoverpagetrue}
%%% Option to show QA page
\newif\ifqapage\qapagetrue
\newif\ifcqapage\cqapagefalse
\DeclareOption{noqapage}{\qapagefalse\cqapagetrue}
\DeclareOption{qapage}{\qapagetrue\cqapagetrue}
%%% Option to show TOC
\newif\iftocintoc\tocintocfalse
\newif\iftoc\toctrue
\newif\ifctoc\ctocfalse
\DeclareOption{toc}{\toctrue\ctoctrue}
\DeclareOption{notoc}{\tocfalse\ctoctrue}
%%% Option to show LOA
\newif\ifloa\loatrue
\newif\ifcloa\cloafalse
\DeclareOption{loa}{\loatrue\cloatrue}
\DeclareOption{noloa}{\loafalse\cloatrue}
%%% Option to show LOF
\newif\iflofcl\lofclfalse
\newif\iflof\loftrue
\newif\ifclof\cloffalse
\DeclareOption{nolof}{\loffalse\cloftrue}
\DeclareOption{lof}{\loftrue\cloftrue}
%%% Option to show LOT
\newif\ifloftfirst\loftfirsttrue
\newif\iflot\lottrue
\newif\ifclot\clotfalse
\DeclareOption{nolot}{\lotfalse\clottrue}
\DeclareOption{lot}{\lottrue\clottrue}
%%% Option to show glossary
\newif\ifglossary\glossarytrue
\newif\ifcglossary\cglossaryfalse
\newif\ifglossaryupper\glossaryuppertrue
\newif\ifglossarypostdot\glossarypostdottrue
\DeclareOption{noglossary}{\glossaryfalse\cglossarytrue}
\DeclareOption{glossary}{\glossarytrue\cglossarytrue}
%%% Option to reset glossary for each appendix
\newif\ifappgls\appglstrue
\newif\ifcappgls\cappglsfalse
\DeclareOption{noappgls}{\appglsfalse\cappglstrue}
\DeclareOption{appgls}{\appglstrue\cappglstrue}
%%% Option to show synopsis
\newif\ifsynopsis\synopsistrue
\newif\ifcsynopsis\csynopsisfalse
\DeclareOption{nosynopsis}{\synopsisfalse\csynopsistrue}
\DeclareOption{synopsis}{\synopsistrue\csynopsistrue}
%%% Option to print signature page as a separate file
\newif\ifprintsigpage\printsigpagetrue
\newif\ifcprintsigpage\cprintsigpagefalse
\DeclareOption{noprintsigpage}{\printsigpagefalse\cprintsigpagetrue}
\DeclareOption{printsigpage}{\printsigpagetrue\cprintsigpagetrue}
%%% Option to show signature page
\newif\ifsigpage\sigpagetrue
\newif\ifcsigpage\csigpagefalse
\DeclareOption{nosigpage}{\sigpagefalse\csigpagetrue}
\DeclareOption{sigpage}{\sigpagetrue\csigpagetrue}
%%% Option allow same page hyperlinks
\newif\ifsamepagelinks\samepagelinkstrue
\newif\ifcsamepagelinks\csamepagelinksfalse
\DeclareOption{nosamepagelinks}{\samepagelinksfalse\csamepagelinkstrue}
\DeclareOption{samepagelinks}{\samepagelinkstrue\csamepagelinkstrue}
%%% Option to show glossary hyperlinks
\newif\ifglosshyper\glosshyperfalse
\newif\ifcglosshyper\cglosshyperfalse
\DeclareOption{noglosshyper}{\glosshyperfalse\cglosshypertrue}
\DeclareOption{glosshyper}{\glosshypertrue\cglosshypertrue}
%%% Option to show web hyperlink
\newif\ifwebhyper\webhyperfalse
\newif\ifcwebhyper\cwebhyperfalse
\DeclareOption{nowebhyper}{\webhyperfalse\cwebhypertrue}
\DeclareOption{webhyper}{\webhypertrue\cwebhypertrue}
%%% Option to show item IDs
\newif\ifshowinlinetable\showinlinetabletrue
\newif\ifitemid\itemidtrue
\newif\ifcitemid\citemidfalse
\DeclareOption{noitemid}{\itemidfalse\citemidtrue}
\DeclareOption{itemid}{\itemidtrue\citemidtrue}
%%% Option to display List of Numbers
\newif\iflon\IfFileExists{batch.txt}{\lonfalse}{\lontrue}
\newif\ifclon\clonfalse
\DeclareOption{nolon}{\lonfalse\clontrue}
\DeclareOption{lon}{\lontrue\clontrue}
%%% Option to item number hyperlinks
\newif\ifitemhyper\itemhypertrue
\newif\ifcitemhyper\citemhyperfalse
\DeclareOption{noitemhyper}{\itemhyperfalse\citemhypertrue}
\DeclareOption{itemhyper}{\itemhypertrue\citemhypertrue}
%%% Option to show artifact IDs
\newif\ifartifactid\artifactidtrue
\newif\ifcartifactid\cartifactidfalse
\DeclareOption{noartifactid}{\artifactidfalse\cartifactidtrue}
\DeclareOption{artifactid}{\artifactidtrue\cartifactidtrue}
%%% Option to show artifact ID hyperlinks
\newif\ifartihyper\artihyperfalse
\newif\ifcartihyper\cartihyperfalse
\DeclareOption{noartihyper}{\artihyperfalse\cartihypertrue}
\DeclareOption{artihyper}{\artihypertrue\cartihypertrue}
%%% Option for draftmode
\newif\ifdraftmode\IfFileExists{batch.txt}{\draftmodefalse}{\draftmodetrue}
\newif\ifcdraftmode\cdraftmodefalse
\DeclareOption{nodraftmode}{\draftmodefalse\cdraftmodetrue}
\DeclareOption{draftmode}{\draftmodetrue\cdraftmodetrue}
%%% Option for qc
\newif\ifqc\qcfalse
\newif\ifcqc\cqcfalse
\DeclareOption{noqc}{\qcfalse\cqctrue}
\DeclareOption{qc}{\qctrue\cqctrue}
%%% Option for fasttmode
\newif\iffast\fastfalse
\newif\ifcfast\cfastfalse
\DeclareOption{nofast}{\fastfalse\cfasttrue}
\DeclareOption{fast}{\fasttrue\cfasttrue}
%%% Option for synopsis only mode
\newif\ifsynonly\synonlyfalse
\newif\ifcsynonly\csynonlyfalse
\DeclareOption{nosynonly}{\synonlyfalse\csynonlytrue}
\DeclareOption{synonly}{\synonlytrue\csynonlytrue}
%%% Option to put watermark on all pages
\newif\ifwatermark\watermarktrue
\newif\ifcwatermark\cwatermarkfalse
\DeclareOption{nowatermark}{\watermarkfalse\cwatermarktrue}
\DeclareOption{watermark}{\watermarktrue\cwatermarktrue}
%%% Option to exclude logo
\newif\iflogo\logotrue
\newif\ifclogo\clogofalse
\DeclareOption{nologo}{\logofalse\clogotrue}
\DeclareOption{logo}{\logotrue\clogotrue}
%%% Option to exclude external PDF documents
\newif\ifexpdf\expdftrue
\newif\ifcexpdf\cexpdffalse
\DeclareOption{noexpdf}{\expdffalse\cexpdftrue}
\DeclareOption{expdf}{\expdftrue\cexpdftrue}
%%% Option to put figure captions below the figure
\newif\iffigcapbelow\figcapbelowfalse
\newif\ifcfigcapbelow\cfigcapbelowfalse
\DeclareOption{nofigcapbelow}{\figcapbelowfalse\cfigcapbelowtrue}
\DeclareOption{figcapbelow}{\figcapbelowtrue\cfigcapbelowtrue}
%%% Option to print and include equations as images
\newif\ifeqnimg\eqnimgfalse
\newif\ifceqnimg\ceqnimgfalse
\DeclareOption{noeqnimg}{\eqnimgfalse\ceqnimgtrue}
\DeclareOption{eqnimg}{\eqnimgtrue\ceqnimgtrue}
%%% Option to print and include inline math as images
\newif\ifmathimg\mathimgfalse
\newif\ifcmathimg\cmathimgfalse
\DeclareOption{nomathimg}{\mathimgfalse\cmathimgtrue}
\DeclareOption{mathimg}{\mathimgtrue\cmathimgtrue}
%%% Option to print and include inline math as images (only for \convimg command)
\newif\ifconvimg\convimgfalse
\newif\ifcconvimg\cconvimgfalse
\DeclareOption{noconvimg}{\convimgfalse\cconvimgtrue}
\DeclareOption{convimg}{\convimgtrue\cconvimgtrue}
%%% Option to copy all inputfiles to ./pmxinputfiles and load from there if present
\newif\ifitemsbytime\itemsbytimefalse
\newif\ifcitemsbytime\citemsbytimefalse
\DeclareOption{itemsbyid}{\itemsbytimefalse\citemsbytimetrue}
\DeclareOption{itemsbytime}{\itemsbytimetrue\citemsbytimetrue}
%%% Option to copy all inputfiles to ./inputfiles and load from there if present
\newif\ifcopy\copyfalse
\newif\ifccopy\ccopyfalse
\DeclareOption{nocopy}{\copyfalse\ccopytrue}
\DeclareOption{copy}{\copytrue\ccopytrue}
%%% Option for paper size
\newif\ifletterpaper\letterpaperfalse
\newcommand{\mypaperkoma}{a4}
\newif\ifcletterpaper\cletterpaperfalse
\DeclareOption{a4paper}{\letterpaperfalse\cletterpapertrue\renewcommand{\mypaperkoma}{a4}}
\DeclareOption{isopaper}{\letterpaperfalse\cletterpapertrue\renewcommand{\mypaperkoma}{a4}}
\DeclareOption{letterpaper}{\letterpapertrue\cletterpapertrue\renewcommand{\mypaperkoma}{letter}}
%%% Ready-to-use mutually exclusive document type options: rep = report-type document (default), sow = scope of work
\newif\ifrep\reptrue
\DeclareOption{rep}{\reptrue\sowfalse\emptyfalse}
\newif\ifsow\sowfalse
\DeclareOption{sow}{\repfalse\sowtrue\emptyfalse\ExecuteOptions{10pt}}
\newif\ifempty\emptyfalse
\DeclareOption{empty}{\repfalse\sowfalse\emptytrue}
%%% Use \footnotesize in synopsis true/false
\newif\ifsynopsisfootfont\synopsisfootfontfalse
%%% Display table swapping information
\newif\ifsubstnote\substnotetrue
%%% Option to select paper size.
\PassOptionsToClass{\CurrentOption}{article}
%%% Make url package obey spaces
\PassOptionsToPackage{obeyspaces}{url}
%%% Suppress errors about certain symbols
\PassOptionsToPackage{warn}{textcomp}
%%% Load user options
\openin\pharmtexread=useroptions.txt
\read\pharmtexread to \useroptions
\closein\pharmtexread
\useroptions
%%% Transfer options to main class
\DeclareOption*{\PassOptionsToClass{\CurrentOption,\@@ptsize}{article}}
\ProcessOptions\relax
\LoadClass[\@@ptsize]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Change some settings after option processing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Settings for watermarks
\newcommand{\Watermark}{}
\newcommand{\WatermarkOpacity}{0.2}
\newcommand{\WatermarkScale}{4.5}
\newcommand{\watermark}[1]{\renewcommand{\Watermark}{#1}\ifdraftmode\renewcommand{\Watermark}{Draft}\fi}
\newcommand{\watermarkopacity}[1]{\renewcommand{\WatermarkOpacity}{#1}}
\newcommand{\watermarkscale}[1]{\pgfmathsetmacro{\WatermarkScale}{#1*4.5}}
%%% Settings for synopsis only mode
\ifsynonly
\ifcsigpage\else\sigpagefalse\fi
\ifctoc\else\tocfalse\fi
\ifclot\else\lotfalse\fi
\ifclof\else\loffalse\fi
\fi
%%% Settings for draftmode
\ifdraftmode
\renewcommand{\Watermark}{Draft}
\ifcwatermark\else\watermarktrue\fi
\ifcglosshyper\else\glosshypertrue\fi
\ifcwebhyper\else\webhypertrue\fi
\ifcitemhyper\else\itemhypertrue\fi
\ifcartihyper\else\artihypertrue\fi
\ifcsamepagelinks\else\samepagelinkstrue\fi
\fi
%%% Settings for qc
\ifqc
\ifcglosshyper\else\glosshypertrue\fi
\ifcwebhyper\else\webhypertrue\fi
\ifcitemhyper\else\itemhypertrue\fi
\ifcartihyper\else\artihypertrue\fi
\ifcsamepagelinks\else\samepagelinkstrue\fi
\fi
%%% Settings for blank
\ifempty
\ifcletterpaper\else\letterpapertrue\fi
\ifccoverpage\else\coverpagefalse\fi
\ifctoc\else\tocfalse\fi
\ifcloa\else\loafalse\fi
\ifclot\else\lotfalse\fi
\ifclof\else\loffalse\fi
\ifcglossary\else\glossaryfalse\fi
\ifcitemid\else\itemidfalse\fi
\fi
%%% Settings for Word compatible PDF mode
\newcommand{\DocPDFWord}{}
\newcommand{\doDocPDFWord}{0}
\ifeqnimg\renewcommand{\doDocPDFWord}{1}\fi
\ifmathimg\renewcommand{\doDocPDFWord}{1}\fi
\ifconvimg\renewcommand{\doDocPDFWord}{1}\fi
\ifnum\doDocPDFWord=1\renewcommand{\DocPDFWord}{-word}\fi
%%% Settings for copy
\ifcopy
\newcommand{\docopy}{1}
\else
\newcommand{\docopy}{0}
\fi
%%% Settings for sorting itemlist
\ifitemsbytime
\newcommand{\doitemsbytime}{1}
\else
\newcommand{\doitemsbytime}{0}
\fi
%%% Fix error thrown by chngcntr package. Should be fixed in a later release of MiKTeX
\let\counterwithout\relax
\let\counterwithin\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Include packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{scrwfile}
%\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[extendedchars]{grffile}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{footnotehyper}
\usepackage[table]{xcolor}
\usepackage[usegeometry]{typearea}
\usepackage{scrlayer-scrpage}
\usepackage{geometry, afterpage, etoolbox}
\usepackage[nomessages]{fp}
\usepackage{changepage, amsmath, amssymb, parskip, sectsty, color, setspace, pdfpages}
\usepackage[nooneline, font={small,bf}]{caption}
\usepackage{listings} % or listingsutf8, but it seems to be buggy
\usepackage[figure,table,lstlisting]{totalcount}
\usepackage[hhmmss]{datetime}
\usepackage[pagewise]{lineno}
\usepackage{afterpage, currfile, graphicx, xspace, enumitem, moreenum}
\usepackage[absolute]{textpos}
\usepackage{calc, lipsum}
\usepackage[square, comma, numbers, sort&compress]{natbib}
\usepackage{lastpage, textcomp, tocvsec2}
\usepackage[titles]{tocloft}
\usepackage[compact,bf,explicit]{titlesec}
\usepackage{expl3}
\usepackage{regexpatch}
\usepackage[hang, flushmargin, bottom]{footmisc}
\usepackage[bookmarksnumbered, pdftex, unicode]{hyperref}
\usepackage[open,openlevel=1]{bookmark}
\usepackage[nameinlink, capitalise, noabbrev]{cleveref}
\usepackage{needspace, refcount}
\usepackage{mathptmx, helvet, courier, sansmath}
\usepackage{threeparttable, threeparttablex, booktabs, longtable, tabularx, ltablex, nameref, hhline}
\usepackage[longtable]{multirow}
\usepackage[originalparameters, document]{ragged2e}
\usepackage{bigstrut, here, float, rotating, subcaption, appendix, upquote, chngcntr}
\usepackage{printlen, upgreek, csvsimple, pbox, arrayjobx, xstring, pgf, ifthen, pax, filecontents, ifplatform}
\usepackage{verbatim, newfile, totcount, framed, alltt, environ}
\usepackage{tikz}
\usepackage[en-US]{datetime2} % provide \todayiso date format
\usepackage{soul,pdfcomment} % source code-generated PDF comments
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{calc}
%%% Packages needed for glossaries package - glossaries is loaded in PharmTeX.sty to allow for pre-compilation of PharmTeX.cls
\usepackage{mfirstuc, textcase, xfor, datatool-base, substr, datatool-fp}
%%% Package for checking page design, showing boxes etc.
%\usepackage{layouts}
%%% Set paper size for KOMA
\KOMAoptions{paper=\mypaperkoma}\recalctypearea
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Custom commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Fix bug in pax package when using filenames with spaces
\newcommand{\mypaxfileinput}{}
\def\PAX@AddAnnots#1#2{%
\kvsetkeys{PAX@Gin}{#1}%
\Grot@setangle{\PAX@Gin@angle}%
% a little careful, is type of angle int or real?
\loop
\ifdim\PAX@Gin@angle\p@<360\p@
\else
\edef\PAX@Gin@angle{\the\numexpr-360+\number\PAX@Gin@angle}%
\repeat
\loop
\ifdim\PAX@Gin@angle\p@<\z@
\edef\PAX@Gin@angle{\strip@pt\dimexpr\PAX@Gin@angle\p@+360\p@}%
\repeat
\ifcase0\ifnum\PAX@Gin@angle=0 1\fi
\ifnum\PAX@Gin@angle=90 1\fi
\ifnum\PAX@Gin@angle=180 1\fi
\ifnum\PAX@Gin@angle=270 1\fi
\PackageWarning{pax}{Unsupported value for option angle}%
\fi
\filename@parse{#2}%
\def\PAX@file{\filename@area\[email protected]}%
\let\[\PAX@parser
\def\<{<}%
\def\>{>}%
\endlinechar=-1 %
\InputIfFileExists{"\PAX@file"}{%
}{%
\typeout{* Missing: \PAX@file}%
}%
}
%%% PharmTeX and bundle versions as numbers
\newcommand{\intpart}[1]{\expandafter\int@part#1..\@nil}
\def\int@part#1.#2.#3\@nil{\if\relax#1\relax0\else#1\fi}
\newcommand{\fracpart}[1]{\expandafter\frac@part#1..\@nil}
\def\frac@part#1.#2.#3\@nil{\if\relax#2\relax0\else#2\fi}
\ifdefined\bundleversion
\pgfmathsetmacro{\bundlenumber}{int(\intpart{\bundleversion}*100 + \fracpart{\bundleversion})}
\else
\newcommand{\bundlenumber}{99999}
\fi
\pgfmathsetmacro{\pharmtexnumber}{int(\intpart{\pharmtexversion}*100 + \fracpart{\pharmtexversion})}
%%% Settings for webhyper
% see bottom of this document
%%% Allow page breaks in multiline equations
\allowdisplaybreaks
%%% Remove extra blank line before equations
\newif\ifsubequations\subequationsfalse
\BeforeBeginEnvironment{subequations}{\nlalign\subequationstrue}
\AfterEndEnvironment{subequations}{\subequationsfalse}
\AtBeginEnvironment{equation}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{equation*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{eqnarray}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{eqnarray*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{align}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{align*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{alignat}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{alignat*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{gather}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{gather*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{multline}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{multline*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{flalign}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
\AtBeginEnvironment{flalign*}{\ifsubequations\nopagebreak[4]\else\nlalign\fi}
%%% Settings for eqnimg option
\newenvironment{oldsubequations}{%
\refstepcounter{equation}%
\protected@edef\theparentequation{\theequation}%
\setcounter{parentequation}{\value{equation}}%
\setcounter{equation}{0}%
\def\theequation{\theparentequation\alph{equation}}%
\ignorespaces
}{%
\setcounter{equation}{\value{parentequation}}%
\ignorespacesafterend
}
\newenvironment{oldalign}{%
\start@align\@ne\st@rredfalse\m@ne
}{%
\math@cr \black@\totwidth@
\egroup
\ifingather@
\restorealignstate@
\egroup
\nonumber
\ifnum0=`{\fi\iffalse}\fi
\else
$$%
\fi
\ignorespacesafterend
}
%%% Set date format
\def\today{\two@digits{\the\day}~\ifcase\month\or JAN\or FEB\or MAR\or APR\or MAY\or JUN\or JUL\or AUG\or SEP\or OCT\or NOV\or DEC\fi~\number\year}
%%% Settings for artifactid
\newcommand{\artifacttext}{artifact ID\xspace}
\newcommand{\aid}{}
\newcommand{\afid}{}
\ifartihyper
\newcommand{\artiref}[1]{#1\xspace} % change this line to add a hyperlink using \href
\newcommand{\folderref}[1]{#1\xspace} % change this line to add a hyperlink using \href
\else
\newcommand{\artiref}[1]{#1\xspace}
\newcommand{\folderref}[1]{#1\xspace}
\fi
\ifartifactid
\newcommand{\artifactid}[1]{\artifacttext \artiref{#1}\xspace}
\else
\newcommand{\artifactid}[1]{\artifacttext (omitted)\xspace}
\renewcommand{\artiref}[1]{(omitted)\xspace}
\renewcommand{\folderref}[1]{(omitted)\xspace}
\fi
%%% Settings for itemid
\newcommand{\itemref}{\ifitemhyper\hyperlink{itemnumberlist\theitemnumber}{Item \theitemnumber}\else{}Item \theitemnumber\fi}
\newcommand{\ioutput}{0}
\newcommand{\itemid}[1]{}
\ifitemid
\renewcommand{\itemid}[1]{\ifthenelse{\equal{\ioutput}{1}}{\renewcommand{\ioutput}{0}\raisebox{3cm}[0pt][0pt]{\hypertarget{itemnumber\theitemnumber}{}}\itemref\xspace}{\raisebox{3cm}[0pt][0pt]{\hypertarget{itemnumber\theitemnumber}{}}\itemref, \artifacttext \artiref{#1}}}
\else
\renewcommand{\itemid}[1]{}
\renewcommand{\artiref}[1]{(omitted)\xspace}
\renewcommand{\folderref}[1]{(omitted)\xspace}
\fi
%%% Lengths
\newlength\maxwidth\newlength\maxheight
\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}
\newlength{\myspacer}\setlength{\myspacer}{14.5pt}
%%% Regex for artifacts
\newcommand{\artiregex}{RA[0-9]{3,}}
\newcommand{\artiregexsubfig}{(RA[0-9]{3,})}
%%% Create string to store artifact IDs.
%%% The \findartifacts perl command determines in the first input from \pmxXXXXX is a filepath or an artifact.
%%% The \checkartifact latex command adds the artifact ID, if present, to a list of items to be fetched. It also creates latex variables, including \fname for the given artifact containing the full name of the artifact filename, e.g. RAXXXXXXXX_xxxxx.xxx, that is then used for e.g. the \includegraphics command.
\newcounter{noartifacts}
\newcommand{\noextname}{}
\newcommand{\fname}{}
\newcounter{itemnumber}
\newcommand{\rfiles}{myveryuniqueseparator}
\newcommand{\itemartifact}{}
\newcommand{\itemrfile}{}
\newcommand{\curitem}{}
\newcommand{\artifacts}{}
\newcommand{\missingartifacts}{}
\newcommand{\missingrfiles}{}
%%% Note that the % symbols are required to be there, since otherwise a few of the commands using the \checkartifact command will have issues with line spacing
\newcommand\additemrfile{\edef\exptmp{\theitemnumber}\expandafter\g@addto@macro\expandafter\itemrfile\expandafter{\expandafter;\exptmp}}
\newcommand\additemartifact{\edef\exptmp{\theitemnumber}\expandafter\g@addto@macro\expandafter\itemartifact\expandafter{\expandafter;\exptmp}}
\newcommand{\checkartifact}[1]{%
\findartifact{#1}{\docopy}{\artiregex}%
\addtocounter{itemnumber}{1}%
\ifnum\ioutput=1%
\additemrfile%
\iffast\let\fname\empty\fi%
\filename@parse{\fname}%
\edef\fbase{\filename@base}%
\edef\fext{\filename@ext}%
\g@addto@macro\rfiles{myveryuniqueseparator#1}%
\ifx\fname\empty\g@addto@macro\missingrfiles{myveryuniqueseparator#1}\fi%
\else%
\additemartifact%
\ifx\fname\empty%
\edef\fbase{}%
\edef\fext{}%
\g@addto@macro\missingartifacts{#1,}%
\g@addto@macro\artifacts{#1,}%
\addtocounter{noartifacts}{1}%
\else%
\iffast\let\fname\empty\fi%
\filename@parse{\fname}%
\edef\fbase{\filename@base}%
\edef\fext{\filename@ext}%
\g@addto@macro\artifacts{#1,}%
\addtocounter{noartifacts}{1}%
\fi%
\fi%
}%
%%% Other commands
\newcommand{\x}{\;\!} % implicit multiplier for equations. Put in a small space.
\newcommand{\tild}{\string~\xspace} % tilde in text
\newcommand{\regtm}{\textsuperscript{\textregistered}\xspace} % registered trademark
\newcommand{\tm}{\texttrademark\xspace} % trademark
\newcommand{\nt}{\noindent} % do not indent the first line after an empty line in the .tex file
\newcommand{\nl}{\vspace{-0.9\baselineskip}} % skip back approximately one line, used just before a new equation
\newcommand{\nlalign}{\vspace{-0.9\baselineskip}} % same command, just for use with eqnimg
\newcommand{\nn}{\nonumber} % skip the equation number for a given equation.
\newcommand{\ee}[1]{\cdot 10^{#1}} % *10^ scientific format in pretty print
\newcommand{\degree}{^\circ} % degree symbyl
\newcommand{\s}[1]{_\mathrm{\:\!#1}} % subscript with non-italics in math mode
\newcommand{\diff}[2]{\frac{\text{d} #1}{\text{d} #2}} % d{someting}/d{something else}
\newcommand{\pdfpages}[1]{\pdfximage{#1}\edef\numberofpages{\the\pdflastximagepages}} % comment out if switching to xelatex. Counts the number of pages in a PDF file.
\newcommand{\figlabel}[2]{\hypertarget{#2}{}\caption{#1}\label{#2}\addtocontents{lof}{\protect{\bookmark[rellevel=1,keeplevel,dest=#2]{\figurename~\thefigure. #1}}}} % command for creating a figure label that also adds itself to the List of Figures entry in the top of the PDF bookmarks.
\newcommand{\figlabelpl}[2]{\hypertarget{#2}{}\caption{#1}\label[plfigure]{#2}\addtocontents{lof}{\protect{\bookmark[rellevel=1,keeplevel,dest=#2]{\figurename~\thefigure. #1}}}}
\newcommand{\tablabel}[2]{\caption{#1}\label{#2}\raisebox{\ht\strutbox}{\hypertarget{#2}{}}\addtocontents{lot}{\protect{\bookmark[rellevel=1,keeplevel,dest=#2]{\tablename~\thetable. #1}}}} % command for creating a table label that also adds itself to the List of Figures entry in the top of the PDF bookmarkss.
\newcommand{\back}{\textbackslash\xspace} % prints backslash
\newcommand{\matlab}{MATLAB\regtm} % MATLAB
\newcommand{\nonmem}{NONMEM\regtm} % NONMEM
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}} % used with DRM (Dose Rationale Memo) document
\newcommand{\tab}[1]{\hspace{2.5cm}\rlap{#1}} % used with DRM (Dose Rationale Memo) document
\newcommand{\descfont}{\footnotesize} % default fontsize for description
\newcommand{\tabledeffont}{\footnotesize} % default fontsize for tables
\newcommand{\listingdeffont}{\scriptsize} % default fontsize for listings
\newcommand{\tablefont}{\tabledeffont} % default fontsize for tables
\newcommand{\listingfont}{\listingdeffont} % fontsize for listings
\newcommand{\dotight}{0} % flag for make a table look tighter, i.e. with less whitespace
\newcommand{\pmxtight}{\renewcommand{\dotight}{1}} % command for setting the \dotight flag
\newcommand{\allowchangefont}{1} % change to 0 to disable font changing option (\tablefont) for main body - will then only work in appendices.
\newcommand{\pmxfont}[1]{\ifnum\allowchangefont=1 \renewcommand{\tablefont}{#1} \renewcommand{\listingfont}{#1} \fi} % command for changing the tablefont and listingfont
\newcommand{\pmxtoprule}{\toprule} % default toprule for tables (horizontal line). Apparently the commands interact in different ways with the tabularx environment.
\newcommand{\pmxmidrule}{\midrule} % default midrule for tables (horizontal line). Apparently the commands interact in different ways with the tabularx environment.
\newcommand{\pmxbottomrule}{\bottomrule} % default bottomrule for tables (horizontal line). Apparently the commands interact in different ways with the tabularx environment.
%\newoutputstream{tmp}\newcommand{\savefile}[2]{\openoutputfile{#1}{tmp}\addtostream{tmp}{#2}\closeoutputstream{tmp}}
\newcommand{\hyperoff}[1]{\begin{NoHyper}#1\end{NoHyper}} % command for turning off a specific hyperlink for a \cref command
\newcommand{\bundleos}{\ifwindows{}Win\else{}Lin\fi}
\newcommand{\thefontsize}{\f@size} % font size in pt (print e.g. 12)
\newcommand{\secheadfont}{\normalsize} % font size for section, subsection, etc. headings
\newcommand*{\getlength}[1]{\strip@pt#1} % get length as number without units
\newcommand*\makeAlph[1]{\ifnum#1<27\symbol{\numexpr96+#1}\else\PackageError{PharmTeX}{Number exceeds the number of letters in the alphabet.}{}\fi}
\newcommand{\citelocation}{}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\def\todayiso{\the\year-\twodigits\month-\twodigits\day}
%%% Set page margins
% Headheight:
% 12 pt 1 lines = 14.5 pt (14.49998pt)
% 12 pt 2 lines = 29.0 pt (28.99998pt)
% 12 pt 3 lines = 43.5 pt (43.49998pt)
% 10 pt 1 lines = 14.5pt = \baselineskip
% 10 pt 2 lines = 24.0pt
% 10 pt 3 lines = 36.0pt
% 8 pt 1 lines = 12.0pt = \baselineskip
% 8 pt 2 lines = 19.0pt (18.99998pt)
% 8 pt 3 lines = 28.5pt (28.49998pt)
\newlength{\PmxTopBase}\setlength{\PmxTopBase}{2.55 cm}
\newlength{\PmxBottomBase}\setlength{\PmxBottomBase}{2.65 cm}
\newlength{\PmxLeftBase}\setlength{\PmxLeftBase}{3.175 cm}
\newlength{\PmxRightBase}\setlength{\PmxRightBase}{2.54 cm}
\newlength{\PmxHeadBase}\setlength{\PmxHeadBase}{0.8 cm}
\newlength{\PmxFootBase}\setlength{\PmxFootBase}{1.35 cm}
\newlength{\PmxHeadHeightBase}\setlength{\PmxHeadHeightBase}{43.5 pt}
\newlength{\PmxFootHeightBase}\setlength{\PmxFootHeightBase}{24 pt}
\newlength{\PmxTop}\setlength{\PmxTop}{2.55 cm}
\newlength{\PmxBottom}\setlength{\PmxBottom}{2.65 cm}
\newlength{\PmxLeft}\setlength{\PmxLeft}{3.175 cm}
\newlength{\PmxRight}\setlength{\PmxRight}{2.54 cm}
\newlength{\PmxHead}\setlength{\PmxHead}{0.8 cm}
\newlength{\PmxFoot}\setlength{\PmxFoot}{1.35 cm}
\newlength{\PmxHeadHeight}\setlength{\PmxHeadHeight}{43.5 pt}
\newlength{\PmxFootHeight}\setlength{\PmxFootHeight}{24 pt}
\newcommand{\pmxtop}[1]{\setlength{\PmxTop}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxbottom}[1]{\setlength{\PmxBottom}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxleft}[1]{\setlength{\PmxLeft}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxright}[1]{\setlength{\PmxRight}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxhead}[1]{\setlength{\PmxHead}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxfoot}[1]{\setlength{\PmxFoot}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxheadheight}[1]{\setlength{\PmxHeadHeight}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\newcommand{\pmxfootheight}[1]{\setlength{\PmxFootHeight}{#1}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}\KOMAoptions{footheight=\PmxFootHeight}}
\geometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}
\KOMAoptions{footheight=\PmxFootHeight}
\setlength{\maxwidth}{\textwidth}
\setlength{\maxheight}{\textheight}
\newcommand*{\useportrait}{\clearpage\KOMAoptions{paper=portrait,DIV=current}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}}
\newcommand*{\uselandscape}{\clearpage\KOMAoptions{paper=landscape,DIV=current}\newgeometry{top = \PmxTop, bottom = \PmxBottom, left = \PmxLeft, right = \PmxRight, head = \PmxHeadHeight, headsep = \PmxTop-\PmxHead-\PmxHeadHeight, footskip = \PmxBottom-\PmxFoot}\setlength{\maxwidth}{\textwidth}\setlength{\maxheight}{\textheight}}
\newenvironment{landscape}{}{}
\BeforeBeginEnvironment{landscape}{\uselandscape}
\AfterEndEnvironment{landscape}{\useportrait}
\addtokomafont{pagehead}{\normalfont\footnotesize}
\addtokomafont{pagefoot}{\normalfont\footnotesize}
\ihead{\ifdefined\HeaderText\HeaderText\fi}
\chead{}
\ohead{}
\ifoot{}
\cfoot{\ifdefined\FooterText\FooterText\else\quad\fi \\ Page \thepage~of~\pageref*{LastPage}\ifwatermark\begin{tikzpicture}[remember picture,overlay,opacity=\WatermarkOpacity,scale=\WatermarkScale,every node/.style={scale=\WatermarkScale}]\node[rotate = 45] at (current page.center) {\Huge{\Watermark}};\end{tikzpicture}\fi}
\ofoot{}
%%% Settings in enumerate and itemize
\setlist{noitemsep}
\setlist[1]{labelindent=\parindent} % < Usually a good idea
\setlist[itemize]{align=parleft,itemsep=3pt,partopsep=0pt,topsep=3pt,labelsep=*,leftmargin=0.3in} % use labelsep=0.3in,leftmargin=* to switch to right side of label for aligning
\setlist[itemize,1]{label=\footnotesize$\bullet$,topsep=3pt}
\setlist[itemize,2]{label=\footnotesize$\circ$,topsep=3pt}
\setlist[itemize,3]{label=\tiny$\square$,topsep=3pt}
\setlist[itemize,4]{label=\tiny$\triangle$,topsep=3pt}
\setlist[enumerate]{align=parleft,itemsep=3pt,partopsep=0pt,topsep=3pt,labelsep=*,leftmargin=0.3in} % use labelsep=0.3in,leftmargin=* to switch to right side of label for aligning
\setlist[enumerate,1]{label=\arabic*.,ref=\arabic*}
\setlist[enumerate,2]{label=\alph*.,ref=\theenumi.\alph*}
\setlist[enumerate,3]{label=\roman*.,ref=\theenumii.\roman*}
\setlist[enumerate,4]{label=\greek*.,ref=\theenumiii.\greek*}
%%% Include .tex doc from another run
%%% This is used for socalled daughter steps where another LatexReport step can be loaded into the present one. All code between \begin{document} and \references is included in the spot where the \pmxinclude command is put in the mother document. It will download the daughter .tex document and print a file called "dotwice" telling runlatex.bat to compile latex an extra time and include any artifacts from the daughter document.
\newcommand{\dotwicecmd}{\dotwice}
\newcommand{\newunderscorename}{}
\newcommand{\includetexdoc}{}
% \perlnewcommand{\dotwice}{
\newcommand{\pmxinclude}[1]{
\renewcommand{\newunderscorename}{}
\checkartifact{#1}
\fixunderscore{#1}
\ifx\fname\empty
ITEM \newunderscorename{} NOT FOUND
\else
\hypertarget{itemnumber\theitemnumber}{}
\includetex{\fname}
\fi
}
%%% Include a text file from a run.
%%% This command can e.g. load a text file created by an R run containing an important number that will then be put into the spot where the \pmxinput is used. If the artifact is found a \footnote will be created showing the artifact ID.
% \perlnewcommand{\inputtext}[1]{
\newcommand{\pmxtxt}[1]{%
\renewcommand{\newunderscorename}{}
\checkartifact{#1}%
\fixunderscore{#1}%
\ifx\fname\empty%
ITEM \newunderscorename{} NOT FOUND%
\else%
\hypertarget{itemnumber\theitemnumber}{}
\inputtext{\fname}%
\fi%
}%
%%% General settings for tables.
%\setlength{\extrarowheight}{10pt} % option for added extra row height in a table. NOT USED.
\def\arraystretch{1.2} % stretches the table a bit to allow for more whitespace.
%\setlength\parindent{0pt} % reduce whitespace on edges of table. NOT USED.
\keepXColumns % setting required for the tabularx and longtable packages.
\newcolumntype{L}[1]{>{\hsize=#1\hsize\raggedright\arraybackslash}X} % left justified column, sharing column space according to the coefficient #1
\newcolumntype{R}[1]{>{\hsize=#1\hsize\raggedleft\arraybackslash}X} % right justified column, sharing column space according to the coefficient #1
\newcolumntype{C}[1]{>{\hsize=#1\hsize\centering\arraybackslash}X} % center justified column, sharing column space according to the coefficient #1
% the next 3 lines holds code used for inputting a specified length measurement, e.g. 1.3cm. Not actually used, since perl code in \pmxtable and \pmxtextable will detect the presence of units for e.g. L{1.3cm} and replace with O{1.3cm}.
\newcolumntype{O}[1]{>{\raggedright\arraybackslash}p{#1}} % used for \pmxtable and \pmxtextable as described above.
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}} % used for \pmxtable and \pmxtextable as described above.
\newcolumntype{Q}[1]{>{\centering\arraybackslash}p{#1}} % used for \pmxtable and \pmxtextable as described above.
\def\hlinewd#1{\noalign{\ifnum0=`}\fi\hrule \@height #1\futurelet\reserved@a\@xhline} % creates extra thick horizontal line for first and last rows. Used only with tables that have vertical separation lines, e.g. {|C|C|C|} in the table column specifier. Handled by perl code in \pmxtable and \pmxtextable.
\newcolumntype{$}{>{\global\let\currentrowstyle\relax}} % probably not used, but may be needed for tabularx
\newcolumntype{^}{>{\currentrowstyle}} % probably not used, but may be needed for tabularx
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}% may be needed for tabularx
#1\ignorespaces
}
\setlength{\LTleft}{0pt} % fills out longtables (used for glossary and List of Items) to fill the full page width
\setlength{\LTright}{0pt} % fills out longtables to fill the full page width
% \def\@cline#1-#2\@nil{%
% \omit
% \@multicnt#1%
% \advance\@multispan\m@ne
% \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
% \@multicnt#2%
% \advance\@multicnt-#1%
% \advance\@multispan\@ne
% \leaders\hrule\@height\arrayrulewidth\hfill
% \cr
% \noalign{\nobreak\vskip-\arrayrulewidth}}
% \let\pmxcline\cline
\let\pmxcline\cmidrule
% Tools for keeping the description of a table on the same page as the table itself
\renewcommand\TPTminimum{\maxwidth}
\newcommand\gettablemaxwidth{%
\noalign{\begingroup
\setlength\TPTL@width{0pt}
\renewcommand\LT@entry[2]{\global\advance\TPTL@width by ##2}
\@nameuse{LT@\romannumeral\c@LT@tables}
\ifdim\TPTL@width<\TPTminimum\relax\global\TPTL@width=\TPTminimum\fi
\endgroup}
}
\newlength\TPTL@widthh
\newcommand\gettablewidth{%
\noalign{\begingroup
\setlength\TPTL@widthh{0pt}
\renewcommand\LT@entry[2]{\global\advance\TPTL@widthh by ##2}
\@nameuse{LT@\romannumeral\c@LT@tables}
\endgroup}
}
\newcommand{\ltcols}{\LT@cols}
\newcommand{\tptlwidth}{\TPTL@width}
\newcommand{\tptlwidthh}{\TPTL@widthh}
%%% Turn off badness 10000 warning
\hbadness=10000
\vbadness=10000
\newcount\hbadness
\newcount\vbadness
%%% Set threshold for overfull hbox/vbox
\hfuzz=10pt
\vfuzz=20pt
\newdimen\hfuzz
\newdimen\vfuzz
%%% Tablenotes. These are local notes within a given table that reset their alpha counter (a, b, c, etc.) for each new table.
\newcounter{tnote}
\newcounter{tnoteglobal}
\crefname{tnote}{Tablenote}{Tablenotes}
%\renewcommand{\thetnote}{$^\text{\alph{tnote}}$}
\renewcommand{\thetnote}{\textsuperscript{\alph{tnote}}}
\renewcommand{\tnote}[2]{\refstepcounter{tnote}\thetnote\space#2\label{#1}}
%\renewcommand{\tnote}[2]{\raisebox{\ht\strutbox}{\hypertarget{#1}{}}\refstepcounter{tnote}\thetnote\space#2\label{#1}}
\newcommand{\tref}[1]{\ref*{#1}} % Disables hyperlinks within tables
%\newcommand{\tref}[1]{\nref{#1}} % Enables hyperlinks within tables. But the hyperlinks in header doesn't always respect nosamepagelinks due to the setup of package longtable/tabularx (firsthead and lasthead are compiled on first and second page only, respectively, not on every page). Thus, hyperlinks are disabled for \tnote. They still work for a \cref to a \tnote.
\newcommand{\tablenote}{} % compatibility with earlier versions of the template
%%% Function for making tables from csv file
\newlength{\pmxtabcolsep}\setlength{\pmxtabcolsep}{\tabcolsep}
\newcounter{pmxcolumnnumber}\setcounter{pmxcolumnnumber}{1}
\newcommand{\istable}{0}
\newcommand{\istextable}{0}
\newcommand{\mypmxcaption}{}
\newcommand{\dodescription}{0}
\newcommand{\myfloatdescription}{}
\newcommand{\mytableitemnumber}{}
\newcommand{\syntab}{0}
\newcommand{\csvtable}{}
\newcommand{\tabletopnote}{}
\ifitemid\newcommand{\doitemid}{1}\else\newcommand{\doitemid}{0}\fi
% \perlnewcommand{\includecsv}[8]{
% start of actual \pmxtable command using \includecsv. RETAIN empty lines in the beginning and end of \pmxtable to make sure line spacing before and after tables is correct.
\newcommand{\tmpsubstnote}{}
\newcommand{\pmxtable}[8][1]{
\setcounter{pmxcolumnnumber}{1}
\renewcommand{\istable}{1}
\renewcommand{\istextable}{0}
\renewcommand{\myfloatdescription}{}
\renewcommand{\dodescription}{0}
\renewcommand{\syntab}{1}
\renewcommand{\csvtable}{}
\renewcommand{\tabletopnote}{}
\renewcommand{\tmpsubstnote}{}
\setcounter{tnote}{0}
\renewcommand{\newunderscorename}{}
\renewcommand{\mypmxcaption}{#6}
\fixglscaption{\mypmxcaption}
\fixunderscore{#2}
\checkartifact{#2}
{\tablefont
\ifx\fname\empty
\renewcommand{\mytableitemnumber}{\itemid{#2}}
\fixnewline{\detokenize{#7}}{\doitemid}
\ifitemid{}\renewcommand{\dodescription}{1}\fi\ifthenelse{\equal{\detokenize{#7}}{}}{}{\renewcommand{\dodescription}{1}}
\begin{tabularx}{\maxwidth}{C{1}} \tablabel{\mypmxcaption}{#5}
\\\toprule
ITEM \newunderscorename{} NOT FOUND \\\midrule\endfirsthead\caption[]{\mypmxcaption}\\\toprule
ITEM \newunderscorename{} NOT FOUND \\\midrule\endhead
\endfoot\bottomrule\endlastfoot
\end{tabularx}
\vspace{-1.6\baselineskip}
\ifitemid\ifnum\istextable=1\ifshowinlinetable\mytableitemnumber.\xspace\fi\else\mytableitemnumber.\xspace\fi\fi\tmpsubstnote\myfloatdescription
\else
\renewcommand{\mytableitemnumber}{\itemid{#2}}
\fixnewline{\detokenize{#7}}{\doitemid}
\ifitemid{}\renewcommand{\dodescription}{1}\fi\ifthenelse{\equal{\detokenize{#7}}{}}{}{\renewcommand{\dodescription}{1}}
\includecsv{#1}{\fname}{#3}{#4}{#5}{\mypmxcaption}{\detokenize{#8}}{\dotight}{0}
\csvtable
\fi
}
\renewcommand{\tablefont}{\tabledeffont}
\renewcommand{\listingfont}{\listingdeffont}
\renewcommand{\dotight}{0}
\renewcommand{\mypmxcaption}{}
\setlength{\tabcolsep}{\pmxtabcolsep}
}
%%% Function for making tables from a tex file
%%% RETAIN empty lines in the beginning and end of \pmxtextable to make sure line spacing before and after tables is correct.
\newcounter{textable}\setcounter{textable}{0}
\newcommand{\pmxtextable}[6][1]{
\setcounter{pmxcolumnnumber}{1}
\renewcommand{\istable}{1}
\renewcommand{\istextable}{1}
\renewcommand{\myfloatdescription}{}
\renewcommand{\dodescription}{0}
\renewcommand{\syntab}{1}
\renewcommand{\csvtable}{}
\renewcommand{\tabletopnote}{}
\renewcommand{\tmpsubstnote}{}
\setcounter{tnote}{0}
\renewcommand{\mypmxcaption}{#4}
\fixglscaption{\mypmxcaption}
\addtocounter{textable}{1}
%% Load via printed file.
\savefile{file.tmp.txt}{\detokenize{#6}}
{\tablefont
\renewcommand{\mytableitemnumber}{Inline table}
\fixnewline{\detokenize{#5}}{\doitemid}
\ifitemid{}\renewcommand{\dodescription}{1}\fi\ifthenelse{\equal{\detokenize{#5}}{}}{}{\renewcommand{\dodescription}{1}}
\includecsv{#1}{file.tmp.txt}{tex}{#2}{#3}{\mypmxcaption}{}{\dotight}{1}
\csvtable
}
\renewcommand{\tablefont}{\tabledeffont}
\renewcommand{\listingfont}{\listingdeffont}
\renewcommand{\dotight}{0}
\renewcommand{\mypmxcaption}{}
\setlength{\tabcolsep}{\pmxtabcolsep}
}
%%% Function for inserting tables from image files
\newcommand{\pmxfigtable}[5]{
\renewcommand{\myfloatdescription}{}
\fixnewline{\detokenize{#4}}{\doitemid}
\renewcommand{\istable}{1}
\renewcommand{\newunderscorename}{}
\renewcommand{\mypmxcaption}{#3}
\fixglscaption{\mypmxcaption}
\fixunderscore{#1}
\checkartifact{#1}
\ifx\fname\empty
\edef\numberofpages{1}
\else
\ifthenelse{\equal{\fext}{pdf}}{\pdfpages{\fname}}{\edef\numberofpages{1}}
\fi
\begin{table}[H]
\hypertarget{#2}{}\caption{\mypmxcaption}\label{#2}
\addtocontents{lot}{\protect{\bookmark[rellevel=1,keeplevel,dest=#2]{\tablename~\thetable. \mypmxcaption}}}
\ifx\fname\empty ITEM \newunderscorename{} NOT FOUND \else \includegraphics[page=1,#5]{\fname} \fi
\ifnum\numberofpages=1
\\\vspace{0.2\baselineskip}
\descfont\ifitemid{}\itemid{#1}.\fi\ifthenelse{\equal{\detokenize{#4}}{}}{}{\xspace\myfloatdescription~}
\fi
\end{table}
\vspace{-0.8\baselineskip}
\ifnum\numberofpages>1
\foreach \x in {2,...,\numberofpages}{
\addtocounter{table}{-1}
\begin{table}[H]
\caption[]{\mypmxcaption}
\includegraphics[page=\x,#5]{\fname}
\ifnum\x=\numberofpages
\\\vspace{0.2\baselineskip}
\descfont\ifitemid{}\itemid{#1}.\fi\ifthenelse{\equal{\detokenize{#4}}{}}{}{\xspace\myfloatdescription}
\fi
\end{table}
\vspace{-0.8\baselineskip}
\ifnum\x<\numberofpages
\clearpage
\fi}
\fi
\renewcommand{\mypmxcaption}{}
}
%%% List of Numbers
\newcommand{\numberlistname}{LIST OF NUMBERS}
\newcounter{listofnumbersvalue}
\newcommand{\rout}[1]{\ifdefined\LonFile\loadlistofnumbersvalue{\pmxlonallnum}{\pmxlonallpath}{\pmxlonallvar}{\pmxlonalltime}{\detokenize{#1}}{\thelistofnumbersvalue}\addtocounter{listofnumbersvalue}{1}\else\PackageError{PharmTeX}{\@backslashchar lonfile needs to be defined for \@backslashchar rout to work.}{}\fi}
\newcommand{\pmxlonnum}{}
\newcommand{\pmxlonpath}{}
\newcommand{\pmxlonvar}{}
\newcommand{\pmxlontime}{}
\newcommand{\pmxlonpage}{}
\newcommand{\numberlist}{
\renewcommand{\csvtable}{}
\section*{\centering\numberlistname}
\phantomsection
\addtocounter{numberappendix}{-1}
\hypertarget{numberlisttarget}{}
% \IfFileExists{batch.txt}{}{\hypertarget{itemnumber\thelonitemid}{}}
\label{numberlist}
\addtocontents{toc}{\@backslashchar contentsline {section}{\numberlistname}{\@backslashchar pageref{numberlist}}{numberlisttarget}}
\bookmark[level=1,dest=numberlisttarget,startatroot]{\numberlistname}
\IfStrEqCase{\thefontsize}{
{10}{\small}
{10.95}{\footnotesize}
{12}{\scriptsize}
}[]
\printlistofnumbers{\pmxlonnum}{\pmxlonpath}{\pmxlonvar}{\pmxlontime}
\addtocounter{table}{-1}
\normalsize