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
|
\makeatletter
% Development notes at
% http://docutils.python-hosting.com/wiki/NewLatex
\providecommand{\Dprinting}{false}
\providecommand{\DSearly}{}
\providecommand{\DSlate}{}
\providecommand{\Ddocumentclass}{scrartcl}
\providecommand{\Ddocumentoptions}{a4paper}
\documentclass[\Ddocumentoptions]{\Ddocumentclass}
\DSearly
\providecommand{\DSfontencoding}{
% Set up font encoding.
% AE is a T1-emulation. It provides most characters and features
% as T1-encoded fonts but doesn't use ugly bitmap fonts.
\usepackage{ae}
% Provide the characters not contained in AE from EC bitmap fonts.
\usepackage{aecompl}
% Guillemets ("<<", ">>") in AE.
\usepackage{aeguill}
}
\providecommand{\DSsymbols}{%
% Fix up symbols.
% The Euro symbol in Computer Modern looks, um, funny. Let's get a
% proper Euro symbol.
\RequirePackage{eurosym}%
\renewcommand{\texteuro}{\euro}%
}
% Taken from
% <http://groups.google.de/groups?selm=1i0n5tgtplti420e1omp4pctlv19jpuhbb%404ax.com>
% and modified. Used with permission.
\providecommand{\Dprovidelength}[2]{%
\begingroup%
\escapechar\m@ne%
\xdef\@gtempa{{\string#1}}%
\endgroup%
\expandafter\@ifundefined\@gtempa%
{\newlength{#1}\setlength{#1}{#2}}%
{}%
}
\providecommand{\Dprovidecounter}[1]{%
% Like \newcounter except that it doesn't crash if the counter
% already exists.
\@ifundefined{c@#1}{\newcounter{#1}}{}
}
\Dprovidelength{\Dboxparindent}{\parindent}
\providecommand{\Dmakeboxminipage}[1]{%
% Make minipage for use in a box created by \Dmakefbox.
\begin{minipage}[t]{0.9\linewidth}%
\setlength{\parindent}{\Dboxparindent}%
#1%
\end{minipage}%
}
\providecommand{\Dmakefbox}[1]{%
% Make a centered, framed box. Useful e.g. for admonitions.
\vspace{0.4\baselineskip}%
\begin{center}%
\fbox{\Dmakeboxminipage{#1}}%
\end{center}%
\vspace{0.4\baselineskip}%
}
\providecommand{\Dmakebox}[1]{%
% Make a centered, frameless box. Useful e.g. for block quotes.
% Do not use minipages here, but create pseudo-lists to allow
% page-breaking. (Don't use KOMA-script's addmargin environment
% because it messes up bullet lists.)
\Dmakelistenvironment{}{}{%
\setlength{\parskip}{0pt}%
\setlength{\parindent}{\Dboxparindent}%
\item{#1}%
}%
}
\RequirePackage{ifthen}
\providecommand{\Dfrenchspacing}{true}
\ifthenelse{\equal{\Dfrenchspacing}{true}}{\frenchspacing}{}
\Dprovidelength{\Dblocklevelvspace}{%
% Space between block-level elements other than paragraphs.
0.7\baselineskip plus 0.3\baselineskip minus 0.2\baselineskip%
}
\providecommand{\Dauxiliaryspace}{%
\ifthenelse{\equal{\Dneedvspace}{true}}{\vspace{\Dblocklevelvspace}}{}%
\par\noindent%
}
\providecommand{\Dparagraphspace}{\par}
\providecommand{\Dneedvspace}{true}
\providecommand{\DSlinks}{
% Targets and references.
\RequirePackage[colorlinks=false,pdfborder={0 0 0}]{hyperref}
\providecommand{\Draisedlink}[1]{\Hy@raisedlink{##1}}
% References.
% We're assuming here that the "refid" and "refuri" attributes occur
% only in inline context (in TextElements).
\providecommand{\DArefid}[5]{%
\ifthenelse{\equal{##4}{reference}}{%
\Dexplicitreference{\###3}{##5}%
}{%
% If this is not a target node (targets with refids are
% uninteresting and should be silently dropped).
\ifthenelse{\not\equal{##4}{target}}{%
% If this is a footnote reference, call special macro.
\ifthenelse{\equal{##4}{footnotereference}}{%
\Dimplicitfootnotereference{\###3}{##5}%
}{%
\ifthenelse{\equal{##4}{citationreference}}{%
\Dimplicitcitationreference{\###3}{##5}%
}{%
\Dimplicitreference{\###3}{##5}%
}%
}%
}{}%
}%
}
\providecommand{\DArefuri}[5]{%
\ifthenelse{\equal{##4}{target}}{%
% Hyperlink targets can (and should be) ignored because they are
% invisible.
}{%
% We only have explicit URI references, so one macro suffices.
\Durireference{##3}{##5}%
}%
}
% Targets.
\providecommand{\DAids}[5]{%
\label{##3}%
\ifthenelse{\equal{##4}{footnotereference}}{%
{%
\renewcommand{\HyperRaiseLinkDefault}{%
% Dirty hack to make backrefs to footnote references work.
% For some reason, \baselineskip is 0pt in fn references.
0.5\Doriginalbaselineskip%
}%
\Draisedlink{\hypertarget{##3}{}}##5%
}%
}{%
\Draisedlink{\hypertarget{##3}{}}##5%
}%
}
% Color in references.
\RequirePackage{color}
\providecommand{\Dimplicitreference}[2]{%
% Create implicit reference to ID. Implicit references occur
% e.g. in TOC-backlinks of section titles. Parameters:
% 1. Target.
% 2. Link text.
\href{##1}{##2}%
}
\providecommand{\Dimplicitfootnotereference}[2]{%
% Ditto, but for the special case of footnotes.
% We want them to be rendered like explicit references.
\Dexplicitreference{##1}{##2}%
}
\providecommand{\Dimplicitcitationreference}[2]{%
% Ditto for citation references.
\Dimplicitfootnotereference{##1}{##2}%
}
\ifthenelse{\equal{\Dprinting}{true}}{
\providecommand{\Dexplicitreferencecolor}{black}
}{
\providecommand{\Dexplicitreferencecolor}{blue}
}
\providecommand{\Dexplicitreference}[2]{%
% Create explicit reference to ID, e.g. created with "foo_".
% Parameters:
% 1. Target.
% 2. Link text.
\href{##1}{{\color{\Dexplicitreferencecolor}##2}}%
}
\providecommand{\Durireferencecolor}{\Dexplicitreferencecolor}
\providecommand{\Durireference}[2]{%
% Create reference to URI. Parameters:
% 1. Target.
% 2. Link text.
\href{##1}{{\color{\Durireferencecolor}##2}}%
}
}
\providecommand{\DSlanguage}{%
% Set up babel.
\ifthenelse{\equal{\Dlanguagebabel}{}}{}{
\RequirePackage[\Dlanguagebabel]{babel}
}
}
\providecommand{\DAclasses}[5]{%
\Difdefined{DN#4C#3}{%
% Pass only contents, nothing else!
\csname DN#4C#3\endcsname{#5}%
}{%
\Difdefined{DC#3}{%
\csname DC#3\endcsname{#5}%
}{%
#5%
}%
}%
}
\providecommand{\Difdefined}[3]{\@ifundefined{#1}{#3}{#2}}
\providecommand{\Dattr}[5]{%
% Global attribute dispatcher.
% Parameters:
% 1. Attribute number.
% 2. Attribute name.
% 3. Attribute value.
% 4. Node name.
% 5. Node contents.
\Difdefined{DN#4A#2V#3}{%
\csname DN#4A#2V#3\endcsname{#1}{#2}{#3}{#4}{#5}%
}{\Difdefined{DN#4A#2}{%
\csname DN#4A#2\endcsname{#1}{#2}{#3}{#4}{#5}%
}{\Difdefined{DA#2V#3}{%
\csname DA#2V#3\endcsname{#1}{#2}{#3}{#4}{#5}%
}{\Difdefined{DA#2}{%
\csname DA#2\endcsname{#1}{#2}{#3}{#4}{#5}%
}{#5%
}}}}%
}
\providecommand{\DNparagraph}[1]{%
\ifthenelse{\equal{\Dparagraphindented}{true}}{\indent}{\noindent}%
#1%
}
\providecommand{\Dformatboxtitle}[1]{{\Large\textbf{#1}}}
\providecommand{\Dformatboxsubtitle}[1]{{\large\textbf{#1}}}
\providecommand{\Dtopictitle}[1]{%
\Difinsidetoc{\vspace{1em}\par}{}%
\noindent\Dformatboxtitle{#1}%
\ifthenelse{\equal{\Dhassubtitle}{false}}{\vspace{1em}}{\vspace{0.5em}}%
\par%
}
\providecommand{\Dtopicsubtitle}[1]{%
\noindent\Dformatboxsubtitle{#1}%
\vspace{1em}%
\par%
}
\providecommand{\Dsidebartitle}[1]{\Dtopictitle{#1}}
\providecommand{\Dsidebarsubtitle}[1]{\Dtopicsubtitle{#1}}
\providecommand{\Ddocumenttitle}[1]{%
\begin{center}{\Huge#1}\end{center}%
\ifthenelse{\equal{\Dhassubtitle}{true}}{\vspace{0.1cm}}{\vspace{1cm}}%
}
\providecommand{\Ddocumentsubtitle}[1]{%
\begin{center}{\huge#1}\end{center}%
\vspace{1cm}%
}
% Can be overwritten by user stylesheet.
\providecommand{\Dformatsectiontitle}[1]{#1}
\providecommand{\Dformatsectionsubtitle}[1]{\Dformatsectiontitle{#1}}
\providecommand{\Dbookmarksectiontitle}[1]{%
% Return text suitable for use in \section*, \subsection*, etc.,
% containing a PDF bookmark. Parameter: The title (as node tree).
\Draisedlink{\Dpdfbookmark{\Dtitleastext}}%
#1%
}
\providecommand{\Dsectiontitlehook}[1]{#1}
\providecommand{\Dsectiontitle}[1]{%
\Dsectiontitlehook{%
\Ddispatchsectiontitle{\Dbookmarksectiontitle{\Dformatsectiontitle{#1}}}%
}%
}
\providecommand{\Ddispatchsectiontitle}[1]{%
\@ifundefined{Dsectiontitle\roman{Dsectionlevel}}{%
\Ddeepsectiontitle{#1}%
}{%
\csname Dsectiontitle\roman{Dsectionlevel}\endcsname{#1}%
}%
}
\providecommand{\Ddispatchsectionsubtitle}[1]{%
\Ddispatchsectiontitle{#1}%
}
\providecommand{\Dsectiontitlei}[1]{\section*{#1}}
\providecommand{\Dsectiontitleii}[1]{\subsection*{#1}}
\providecommand{\Ddeepsectiontitle}[1]{%
% Anything below \subsubsection (like \paragraph or \subparagraph)
% is useless because it uses the same font. The only way to
% (visually) distinguish such deeply nested sections is to use
% section numbering.
\subsubsection*{#1}%
}
\providecommand{\Dsectionsubtitlehook}[1]{#1}
\Dprovidelength{\Dsectionsubtitleraisedistance}{0.7em}
\providecommand{\Dsectionsubtitlescaling}{0.85}
\providecommand{\Dsectionsubtitle}[1]{%
\Dsectionsubtitlehook{%
% Move the subtitle nearer to the title.
\vspace{-\Dsectionsubtitleraisedistance}%
% Don't create a PDF bookmark.
\Ddispatchsectionsubtitle{%
\Dformatsectionsubtitle{\scalebox{\Dsectionsubtitlescaling}{#1}}%
}%
}%
}
% Boolean variable.
\providecommand{\Dhassubtitle}{false}
\providecommand{\DNtitle}[1]{%
\csname D\Dparent title\endcsname{#1}%
}
\providecommand{\DNsubtitle}[1]{%
\csname D\Dparent subtitle\endcsname{#1}%
}
\newcounter{Dpdfbookmarkid}
\setcounter{Dpdfbookmarkid}{0}
\providecommand{\Dpdfbookmark}[1]{%
% Temporarily decrement Desctionlevel counter.
\addtocounter{Dsectionlevel}{-1}%
%\typeout{\arabic{Dsectionlevel}}%
%\typeout{#1}%
%\typeout{docutils\roman{Dpdfbookmarkid}}%
%\typeout{}%
\pdfbookmark[\arabic{Dsectionlevel}]{#1}{docutils\arabic{Dpdfbookmarkid}}%
\addtocounter{Dsectionlevel}{1}%
\addtocounter{Dpdfbookmarkid}{1}%
}
%\providecommand{\DNliteralblock}[1]{\begin{quote}\ttfamily\raggedright#1\end{quote}}
\providecommand{\DNliteralblock}[1]{%
\Dmakelistenvironment{}{%
\ifthenelse{\equal{\Dinsidetabular}{true}}{%
\setlength{\leftmargin}{0pt}%
}{}%
\setlength{\rightmargin}{0pt}%
}{%
\raggedright\item\noindent\nohyphens{\textnhtt{#1\Dfinalstrut}}%
}%
}
\providecommand{\DNdoctestblock}[1]{%
% Treat doctest blocks the same as literal blocks.
\DNliteralblock{#1}%
}
\RequirePackage{hyphenat}
\providecommand{\DNliteral}[1]{\textnhtt{#1}}
\providecommand{\DNemphasis}[1]{\emph{#1}}
\providecommand{\DNstrong}[1]{\textbf{#1}}
\providecommand{\Dvisitdocument}{\begin{document}\noindent}
\providecommand{\Ddepartdocument}{\end{document}}
\providecommand{\DNtopic}[1]{%
\ifthenelse{\equal{\DcurrentNtopicAcontents}{1}}{%
\addtocounter{Dtoclevel}{1}%
\par\noindent%
#1%
\addtocounter{Dtoclevel}{-1}%
}{%
\par\noindent%
\Dmakebox{#1}%
}%
}
\providecommand{\Dformatrubric}[1]{\textbf{#1}}
\Dprovidelength{\Dprerubricspace}{0.3em}
\providecommand{\DNrubric}[1]{%
\vspace{\Dprerubricspace}\par\noindent\Dformatrubric{#1}\par%
}
\providecommand{\Dbullet}{}
\providecommand{\Dsetbullet}[1]{\renewcommand{\Dbullet}{#1}}
\providecommand{\DNbulletlist}[1]{%
\Difinsidetoc{%
\Dtocbulletlist{#1}%
}{%
\Dmakelistenvironment{\Dbullet}{}{#1}%
}%
}
\renewcommand{\@pnumwidth}{2.2em}
\providecommand{\DNlistitem}[1]{%
\Difinsidetoc{%
\ifthenelse{\equal{\theDtoclevel}{1}\and\equal{\Dlocaltoc}{false}}{%
{%
\par\addvspace{1em}\noindent%
\sectfont%
#1\hfill\pageref{\DcurrentNlistitemAtocrefid}%
}%
}{%
\@dottedtocline{0}{\Dtocindent}{0em}{#1}{%
\pageref{\DcurrentNlistitemAtocrefid}%
}%
}%
}{%
\item{#1}%
}%
}
\providecommand{\DNenumeratedlist}[1]{#1}
\newcounter{Dsectionlevel}
\providecommand{\Dvisitsectionhook}{}
\providecommand{\Ddepartsectionhook}{}
\providecommand{\Dvisitsection}{%
\addtocounter{Dsectionlevel}{1}%
\Dvisitsectionhook%
}
\providecommand{\Ddepartsection}{%
\Ddepartsectionhook%
\addtocounter{Dsectionlevel}{-1}%
}
% Using \_ will cause hyphenation after _ even in \textnhtt-typewriter
% because the hyphenat package redefines \_. So we use
% \textunderscore here.
\providecommand{\Dtextunderscore}{\textunderscore}
\providecommand{\Dtextinlineliteralfirstspace}{{ }}
\providecommand{\Dtextinlineliteralsecondspace}{{~}}
\Dprovidelength{\Dlistspacing}{0.8\baselineskip}
\providecommand{\Dsetlistrightmargin}{%
\ifthenelse{\lengthtest{\linewidth>12em}}{%
% Equal margins.
\setlength{\rightmargin}{\leftmargin}%
}{%
% If the line is narrower than 10em, we don't remove any further
% space from the right.
\setlength{\rightmargin}{0pt}%
}%
}
\providecommand{\Dresetlistdepth}{false}
\Dprovidelength{\Doriginallabelsep}{\labelsep}
\providecommand{\Dmakelistenvironment}[3]{%
% Make list environment with support for unlimited nesting and with
% reasonable default lengths. Parameters:
% 1. Label (same as in list environment).
% 2. Spacing (same as in list environment).
% 3. List contents (contents of list environment).
\ifthenelse{\equal{\Dinsidetabular}{true}}{%
% Unfortunately, vertical spacing doesn't work correctly when
% using lists inside tabular environments, so we use a minipage.
\begin{minipage}[t]{\linewidth}%
}{}%
{%
\renewcommand{\Dneedvspace}{false}%
% \parsep0.5\baselineskip
\renewcommand{\Dresetlistdepth}{false}%
\ifnum \@listdepth>5%
\protect\renewcommand{\Dresetlistdepth}{true}%
\@listdepth=5%
\fi%
\begin{list}{%
#1%
}{%
\setlength{\itemsep}{0pt}%
\setlength{\partopsep}{0pt}%
\setlength{\topsep}{0pt}%
% List should take 90% of total width.
\setlength{\leftmargin}{0.05\linewidth}%
\ifthenelse{\lengthtest{\leftmargin<1.8em}}{%
\setlength{\leftmargin}{1.8em}%
}{}%
\setlength{\labelsep}{\Doriginallabelsep}%
\Dsetlistrightmargin%
#2%
}{%
#3%
}%
\end{list}%
\ifthenelse{\equal{\Dresetlistdepth}{true}}{\@listdepth=5}{}%
}%
\ifthenelse{\equal{\Dinsidetabular}{true}}{\end{minipage}}{}%
}
\providecommand{\Dfinalstrut}{\@finalstrut\@arstrutbox}
\providecommand{\DAlastitem}[5]{#5\Dfinalstrut}
\Dprovidelength{\Ditemsep}{0pt}
\providecommand{\Dmakeenumeratedlist}[6]{%
% Make enumerated list.
% Parameters:
% - prefix
% - type (\arabic, \roman, ...)
% - suffix
% - suggested counter name
% - start number - 1
% - list contents
\newcounter{#4}%
\Dmakelistenvironment{#1#2{#4}#3}{%
% Use as much space as needed for the label.
\setlength{\labelwidth}{10em}%
% Reserve enough space so that the label doesn't go beyond the
% left margin of preceding paragraphs. Like that:
%
% A paragraph.
%
% 1. First item.
\setlength{\leftmargin}{2.5em}%
\Dsetlistrightmargin%
\setlength{\itemsep}{\Ditemsep}%
% Use counter recommended by Python module.
\usecounter{#4}%
% Set start value.
\addtocounter{#4}{#5}%
}{%
% The list contents.
#6%
}%
}
% Single quote in literal mode. \textquotesingle from package
% textcomp has wrong width when using package ae, so we use a normal
% single curly quote here.
\providecommand{\Dtextliteralsinglequote}{'}
% "Tabular lists" are field lists and options lists (not definition
% lists because there the term always appears on its own line). We'll
% use the terminology of field lists now ("field", "field name",
% "field body"), but the same is also analogously applicable to option
% lists.
%
% We want these lists to be breakable across pages. We cannot
% automatically get the narrowest possible size for the left column
% (i.e. the field names or option groups) because tabularx does not
% support multi-page tables, ltxtable needs to have the table in an
% external file and we don't want to clutter the user's directories
% with auxiliary files created by the filecontents environment, and
% ltablex is not included in teTeX.
%
% Thus we set a fixed length for the left column and use list
% environments. This also has the nice side effect that breaking is
% now possible anywhere, not just between fields.
%
% Note that we are creating a distinct list environment for each
% field. There is no macro for a whole tabular list!
\Dprovidelength{\Dtabularlistfieldnamewidth}{6em}
\Dprovidelength{\Dtabularlistfieldnamesep}{0.5em}
\providecommand{\Dinsidetabular}{false}
\providecommand{\Dsavefieldname}{}
\providecommand{\Dsavefieldbody}{}
\Dprovidelength{\Dusedfieldnamewidth}{0pt}
\Dprovidelength{\Drealfieldnamewidth}{0pt}
\providecommand{\Dtabularlistfieldname}[1]{\renewcommand{\Dsavefieldname}{#1}}
\providecommand{\Dtabularlistfieldbody}[1]{\renewcommand{\Dsavefieldbody}{#1}}
\Dprovidelength{\Dparskiptemp}{0pt}
\providecommand{\Dtabularlistfield}[1]{%
{%
% This only saves field name and field body in \Dsavefieldname and
% \Dsavefieldbody, resp. It does not insert any text into the
% document.
#1%
% Recalculate the real field name width everytime we encounter a
% tabular list field because it may have been changed using a
% "raw" node.
\setlength{\Drealfieldnamewidth}{\Dtabularlistfieldnamewidth}%
\addtolength{\Drealfieldnamewidth}{\Dtabularlistfieldnamesep}%
\Dmakelistenvironment{%
\makebox[\Drealfieldnamewidth][l]{\Dsavefieldname}%
}{%
\setlength{\labelwidth}{\Drealfieldnamewidth}%
\setlength{\leftmargin}{\Drealfieldnamewidth}%
\setlength{\rightmargin}{0pt}%
\setlength{\labelsep}{0pt}%
}{%
\item%
\settowidth{\Dusedfieldnamewidth}{\Dsavefieldname}%
\setlength{\Dparskiptemp}{\parskip}%
\ifthenelse{%
\lengthtest{\Dusedfieldnamewidth>\Dtabularlistfieldnamewidth}%
}{%
\mbox{}\par%
\setlength{\parskip}{0pt}%
}{}%
\Dsavefieldbody%
\setlength{\parskip}{\Dparskiptemp}%
%XXX Why did we need this?
%\@finalstrut\@arstrutbox%
}%
\par%
}%
}
\providecommand{\Dformatfieldname}[1]{\textbf{#1:}}
\providecommand{\DNfieldlist}[1]{#1}
\providecommand{\DNfield}[1]{\Dtabularlistfield{#1}}
\providecommand{\DNfieldname}[1]{%
\Dtabularlistfieldname{%
\Dformatfieldname{#1}%
}%
}
\providecommand{\DNfieldbody}[1]{\Dtabularlistfieldbody{#1}}
\providecommand{\Dformatoptiongroup}[1]{%
% Format option group, e.g. "-f file, --input file".
\texttt{#1}%
}
\providecommand{\Dformatoption}[1]{%
% Format option, e.g. "-f file".
% Put into mbox to avoid line-breaking at spaces.
\mbox{#1}%
}
\providecommand{\Dformatoptionstring}[1]{%
% Format option string, e.g. "-f".
#1%
}
\providecommand{\Dformatoptionargument}[1]{%
% Format option argument, e.g. "file".
\textsl{#1}%
}
\providecommand{\Dformatoptiondescription}[1]{%
% Format option description, e.g.
% "\DNparagraph{Read input data from file.}"
#1%
}
\providecommand{\DNoptionlist}[1]{#1}
\providecommand{\Doptiongroupjoiner}{,{ }}
\providecommand{\Disfirstoption}{%
% Auxiliary macro indicating if a given option is the first child
% of its option group (if it's not, it has to preceded by
% \Doptiongroupjoiner).
false%
}
\providecommand{\DNoptionlistitem}[1]{%
\Dtabularlistfield{#1}%
}
\providecommand{\DNoptiongroup}[1]{%
\renewcommand{\Disfirstoption}{true}%
\Dtabularlistfieldname{\Dformatoptiongroup{#1}}%
}
\providecommand{\DNoption}[1]{%
% If this is not the first option in this option group, add a
% joiner.
\ifthenelse{\equal{\Disfirstoption}{true}}{%
\renewcommand{\Disfirstoption}{false}%
}{%
\Doptiongroupjoiner%
}%
\Dformatoption{#1}%
}
\providecommand{\DNoptionstring}[1]{\Dformatoptionstring{#1}}
\providecommand{\DNoptionargument}[1]{{ }\Dformatoptionargument{#1}}
\providecommand{\DNdescription}[1]{%
\Dtabularlistfieldbody{\Dformatoptiondescription{#1}}%
}
\providecommand{\DNdefinitionlist}[1]{%
\begin{description}%
\parskip0pt%
#1%
\end{description}%
}
\providecommand{\DNdefinitionlistitem}[1]{%
% LaTeX expects the label in square brackets; we provide an empty
% label.
\item[]#1%
}
\providecommand{\Dformatterm}[1]{#1}
\providecommand{\DNterm}[1]{\hspace{-5pt}\Dformatterm{#1}}
% I'm still not sure what's the best rendering for classifiers. The
% colon syntax is used by reStructuredText, so it's at least WYSIWYG.
% Use slanted text because italic would cause too much emphasis.
\providecommand{\Dformatclassifier}[1]{\textsl{#1}}
\providecommand{\DNclassifier}[1]{~:~\Dformatclassifier{#1}}
\providecommand{\Dformatdefinition}[1]{#1}
\providecommand{\DNdefinition}[1]{\par\Dformatdefinition{#1}}
\providecommand{\Dlineblockindentation}{2.5em}
\providecommand{\DNlineblock}[1]{%
\Dmakelistenvironment{}{%
\ifthenelse{\equal{\Dparent}{lineblock}}{%
% Parent is a line block, so indent.
\setlength{\leftmargin}{\Dlineblockindentation}%
}{%
% At top level; don't indent.
\setlength{\leftmargin}{0pt}%
}%
\setlength{\rightmargin}{0pt}%
\setlength{\parsep}{0pt}%
}{%
#1%
}%
}
\providecommand{\DNline}[1]{\item#1}
\providecommand{\DNtransition}{%
\raisebox{0.25em}{\parbox{\linewidth}{\hspace*{\fill}\hrulefill\hrulefill\hspace*{\fill}}}%
}
\providecommand{\Dformatblockquote}[1]{%
% Format contents of block quote.
% This occurs in block-level context, so we cannot use \textsl.
{\slshape#1}%
}
\providecommand{\Dformatattribution}[1]{---\textup{#1}}
\providecommand{\DNblockquote}[1]{%
\Dmakebox{%
\Dformatblockquote{#1}
}%
}
\providecommand{\DNattribution}[1]{%
\par%
\begin{flushright}\Dformatattribution{#1}\end{flushright}%
}
% Sidebars:
\RequirePackage{picins}
% Vertical and horizontal margins.
\Dprovidelength{\Dsidebarvmargin}{0.5em}
\Dprovidelength{\Dsidebarhmargin}{1em}
% Padding (space between contents and frame).
\Dprovidelength{\Dsidebarpadding}{1em}
% Frame width.
\Dprovidelength{\Dsidebarframewidth}{2\fboxrule}
% Position ("l" or "r").
\providecommand{\Dsidebarposition}{r}
% Width.
\Dprovidelength{\Dsidebarwidth}{0.45\linewidth}
\providecommand{\DNsidebar}[1]{
\parpic[\Dsidebarposition]{%
\begin{minipage}[t]{\Dsidebarwidth}%
% Doing this with nested minipages is ugly, but I haven't found
% another way to place vertical space before and after the fbox.
\vspace{\Dsidebarvmargin}%
{%
\setlength{\fboxrule}{\Dsidebarframewidth}%
\setlength{\fboxsep}{\Dsidebarpadding}%
\fbox{%
\begin{minipage}[t]{\linewidth}%
\setlength{\parindent}{\Dboxparindent}%
#1%
\end{minipage}%
}%
}%
\vspace{\Dsidebarvmargin}%
\end{minipage}%
}%
}
% Citations and footnotes.
\providecommand{\Dformatfootnote}[1]{%
% Format footnote.
{%
\footnotesize#1%
% \par is necessary for LaTeX to adjust baselineskip to the
% changed font size.
\par%
}%
}
\providecommand{\Dformatcitation}[1]{\Dformatfootnote{#1}}
\Dprovidelength{\Doriginalbaselineskip}{0pt}
\providecommand{\DNfootnotereference}[1]{%
{%
% \baselineskip is 0pt in \textsuperscript, so we save it here.
\setlength{\Doriginalbaselineskip}{\baselineskip}%
\textsuperscript{#1}%
}%
}
\providecommand{\DNcitationreference}[1]{{[}#1{]}}
\Dprovidelength{\Dfootnotesep}{3.5pt}
\providecommand{\Dsetfootnotespacing}{%
% Spacing commands executed at the beginning of footnotes.
\setlength{\parindent}{0pt}%
\hspace{1em}%
}
\providecommand{\DNfootnote}[1]{%
% See ltfloat.dtx for details.
{%
\insert\footins{%
\vspace{\Dfootnotesep}%
\Dsetfootnotespacing%
\Dformatfootnote{#1}%
}%
}%
}
\providecommand{\DNcitation}[1]{\DNfootnote{#1}}
\providecommand{\Dformatfootnotelabel}[1]{%
% Keep \footnotesize in footnote labels (\textsuperscript would
% reduce the font size even more).
\textsuperscript{\footnotesize#1{ }}%
}
\providecommand{\Dformatcitationlabel}[1]{{[}#1{]}{ }}
\providecommand{\Dformatmultiplebackrefs}[1]{%
% If in printing mode, do not write out multiple backrefs.
\ifthenelse{\equal{\Dprinting}{true}}{}{\textsl{#1}}%
}
\providecommand{\Dthislabel}{}
\providecommand{\DNlabel}[1]{%
\renewcommand{\Dthislabel}{#1}
\ifthenelse{\not\equal{\Dsinglebackref}{}}{%
\let\Doriginallabel=\Dthislabel%
\def\Dthislabel{%
\Dsinglefootnotebacklink{\Dsinglebackref}{\Doriginallabel}%
}%
}{}%
\ifthenelse{\equal{\Dparent}{footnote}}{%
% Footnote label.
\Dformatfootnotelabel{\Dthislabel}%
}{%
\ifthenelse{\equal{\Dparent}{citation}}{%
% Citation label.
\Dformatcitationlabel{\Dthislabel}%
}{}%
}%
% If there are multiple backrefs, add them now.
\Dformatmultiplebackrefs{\Dmultiplebackrefs}%
}
\providecommand{\Dsinglefootnotebacklink}[2]{%
% Create normal backlink of a footnote label. Parameters:
% 1. ID.
% 2. Link text.
% Treat like a footnote reference.
\Dimplicitfootnotereference{\##1}{#2}%
}
\providecommand{\Dmultifootnotebacklink}[2]{%
% Create generated backlink, as in (1, 2). Parameters:
% 1. ID.
% 2. Link text.
% Treat like a footnote reference.
\Dimplicitfootnotereference{\##1}{#2}%
}
\providecommand{\Dsinglecitationbacklink}[2]{\Dsinglefootnotebacklink{#1}{#2}}
\providecommand{\Dmulticitationbacklink}[2]{\Dmultifootnotebacklink{#1}{#2}}
\RequirePackage{longtable}
\providecommand{\Dmaketable}[2]{%
% Make table. Parameters:
% 1. Table spec (like "|p|p|").
% 2. Table contents.
{%
\ifthenelse{\equal{\Dinsidetabular}{true}}{%
% Inside longtable; we cannot have nested longtables.
\begin{tabular}{#1}%
\hline%
#2%
\end{tabular}%
}{%
\renewcommand{\Dinsidetabular}{true}%
\begin{longtable}{#1}%
\hline%
#2%
\end{longtable}%
}%
}%
}
\providecommand{\DNthead}[1]{%
#1%
\endhead%
}
\providecommand{\DNrow}[1]{%
#1\tabularnewline%
\hline%
}
\providecommand{\Dinsidemulticolumn}{false}
\providecommand{\Dcompensatingmulticol}[3]{%
\multicolumn{#1}{#2}{%
{%
\renewcommand{\Dinsidemulticolumn}{true}%
% Compensate for weird missing vertical space at top of paragraph.
\raisebox{-2.5pt}{#3}%
}%
}%
}
\providecommand{\Dcolspan}[2]{%
% Take care of the morecols attribute (but incremented by 1).
&%
\Dcompensatingmulticol{#1}{l|}{#2}%
}
\providecommand{\Dcolspanleft}[2]{%
% Like \Dmorecols, but called for the leftmost entries in a table
% row.
\Dcompensatingmulticol{#1}{|l|}{#2}%
}
\providecommand{\Dsubsequententry}[1]{%
%
}
\providecommand{\DNentry}[1]{%
% The following sequence adds minimal vertical space above the top
% lines of the first cell paragraph, so that vertical space is
% balanced at the top and bottom of table cells.
\ifthenelse{\equal{\Dinsidemulticolumn}{false}}{%
\vspace{-1em}\vspace{-\parskip}\par%
}{}%
#1%
% No need to add an ampersand ("&"); that's done by \Dsubsequententry.
}
\providecommand{\DAtableheaderentry}[5]{\Dformattableheaderentry{#5}}
\providecommand{\Dformattableheaderentry}[1]{{\bfseries#1}}
\providecommand{\DNsystemmessage}[1]{%
{%
\ifthenelse{\equal{\Dprinting}{false}}{\color{red}}{}%
\bfseries%
#1%
}%
}
\providecommand{\Dinsidehalign}{false}
\newsavebox{\Dalignedimagebox}
\Dprovidelength{\Dalignedimagewidth}{0pt}
\providecommand{\Dhalign}[2]{%
% Horizontally align the contents to the left or right so that the
% text flows around it.
% Parameters:
% 1. l or r
% 2. Contents.
\renewcommand{\Dinsidehalign}{true}%
% For some obscure reason \parpic consumes some vertical space.
\vspace{-3pt}%
% Now we do something *really* ugly, but this enables us to wrap the
% image in a minipage while still allowing tight frames when
% class=border (see \DNimageCborder).
\sbox{\Dalignedimagebox}{#2}%
\settowidth{\Dalignedimagewidth}{\usebox{\Dalignedimagebox}}%
\parpic[#1]{%
\begin{minipage}[b]{\Dalignedimagewidth}%
% Compensate for previously added space, but not entirely.
\vspace*{2.0pt}%
\vspace*{\Dfloatimagetopmargin}%
\usebox{\Dalignedimagebox}%
\vspace*{1.5pt}%
\vspace*{\Dfloatimagebottommargin}%
\end{minipage}%
}%
\renewcommand{\Dinsidehalign}{false}%
}
\RequirePackage{graphicx}
% Maximum width of an image.
\providecommand{\Dimagemaxwidth}{\linewidth}
\providecommand{\Dfloatimagemaxwidth}{0.5\linewidth}
% Auxiliary variable.
\Dprovidelength{\Dcurrentimagewidth}{0pt}
\providecommand{\DNimageAalign}[5]{%
\ifthenelse{\equal{#3}{left}}{%
\Dhalign{l}{#5}%
}{%
\ifthenelse{\equal{#3}{right}}{%
\Dhalign{r}{#5}%
}{%
\ifthenelse{\equal{#3}{center}}{%
% Text floating around centered figures is a bad idea. Thus
% we use a center environment. Note that no extra space is
% added by the writer, so the space added by the center
% environment is fine.
\begin{center}#5\end{center}%
}{%
#5%
}%
}%
}%
}
% Base path for images.
\providecommand{\Dimagebase}{}
% Auxiliary command. Current image path.
\providecommand{\Dimagepath}{}
\providecommand{\DNimageAuri}[5]{%
% Insert image. We treat the URI like a path here.
\renewcommand{\Dimagepath}{\Dimagebase#3}%
\Difdefined{DcurrentNimageAwidth}{%
\Dwidthimage{\DcurrentNimageAwidth}{\Dimagepath}%
}{%
\Dsimpleimage{\Dimagepath}%
}%
}
\Dprovidelength{\Dfloatimagevmargin}{0pt}
\providecommand{\Dfloatimagetopmargin}{\Dfloatimagevmargin}
\providecommand{\Dfloatimagebottommargin}{\Dfloatimagevmargin}
\providecommand{\Dwidthimage}[2]{%
% Image with specified width.
% Parameters:
% 1. Image width.
% 2. Image path.
% Need to make bottom-alignment dependent on align attribute (add
% functional test first). Need to observe height attribute.
%\begin{minipage}[b]{#1}%
\includegraphics[width=#1,height=\textheight,keepaspectratio]{#2}%
%\end{minipage}%
}
\providecommand{\Dcurrentimagemaxwidth}{}
\providecommand{\Dsimpleimage}[1]{%
% Insert image, without much parametrization.
\settowidth{\Dcurrentimagewidth}{\includegraphics{#1}}%
\ifthenelse{\equal{\Dinsidehalign}{true}}{%
\renewcommand{\Dcurrentimagemaxwidth}{\Dfloatimagemaxwidth}%
}{%
\renewcommand{\Dcurrentimagemaxwidth}{\Dimagemaxwidth}%
}%
\ifthenelse{\lengthtest{\Dcurrentimagewidth>\Dcurrentimagemaxwidth}}{%
\Dwidthimage{\Dcurrentimagemaxwidth}{#1}%
}{%
\Dwidthimage{\Dcurrentimagewidth}{#1}%
}%
}
\providecommand{\Dwidthimage}[2]{%
% Image with specified width.
% Parameters:
% 1. Image width.
% 2. Image path.
\Dwidthimage{#1}{#2}%
}
% Figures.
\providecommand{\DNfigureAalign}[5]{%
% Hack to make it work Right Now.
%\def\DcurrentNimageAwidth{\DcurrentNfigureAwidth}%
%
%\def\DcurrentNimageAwidth{\linewidth}%
\DNimageAalign{#1}{#2}{#3}{#4}{%
\begin{minipage}[b]{0.4\linewidth}#5\end{minipage}}%
%\let\DcurrentNimageAwidth=\relax%
%
%\let\DcurrentNimageAwidth=\relax%
}
\providecommand{\DNcaption}[1]{\par\noindent{\slshape#1}}
\providecommand{\DNlegend}[1]{\Dauxiliaryspace#1}
\providecommand{\DCborder}[1]{\fbox{#1}}
% No padding between image and border.
\providecommand{\DNimageCborder}[1]{\frame{#1}}
% Need to replace with language-specific stuff. Maybe look at
% csquotes.sty and ask the author for permission to use parts of it.
\providecommand{\Dtextleftdblquote}{``}
\providecommand{\Dtextrightdblquote}{''}
% Table of contents:
\Dprovidelength{\Dtocininitialsectnumwidth}{2.4em}
\Dprovidelength{\Dtocadditionalsectnumwidth}{0.7em}
% Level inside a table of contents. While this is at -1, we are not
% inside a TOC.
\Dprovidecounter{Dtoclevel}%
\setcounter{Dtoclevel}{-1}
\providecommand{\Dlocaltoc}{false}%
\providecommand{\DNtopicClocal}[1]{%
\renewcommand{\Dlocaltoc}{true}%
\addtolength{\Dtocsectnumwidth}{2\Dtocadditionalsectnumwidth}%
\addtolength{\Dtocindent}{-2\Dtocadditionalsectnumwidth}%
#1%
\addtolength{\Dtocindent}{2\Dtocadditionalsectnumwidth}%
\addtolength{\Dtocsectnumwidth}{-2\Dtocadditionalsectnumwidth}%
\renewcommand{\Dlocaltoc}{false}%
}
\Dprovidelength{\Dtocindent}{0pt}%
\Dprovidelength{\Dtocsectnumwidth}{\Dtocininitialsectnumwidth}
% Compensate for one additional TOC indentation space so that the
% top-level is unindented.
\addtolength{\Dtocsectnumwidth}{-\Dtocadditionalsectnumwidth}
\addtolength{\Dtocindent}{-\Dtocsectnumwidth}
\providecommand{\Difinsidetoc}[2]{%
\ifthenelse{\not\equal{\theDtoclevel}{-1}}{#1}{#2}%
}
\providecommand{\DNgeneratedCsectnum}[1]{%
\Difinsidetoc{%
% Section number inside TOC.
\makebox[\Dtocsectnumwidth][l]{#1}%
}{%
% Section number inside section title.
#1\quad%
}%
}
\providecommand{\Dtocbulletlist}[1]{%
\addtocounter{Dtoclevel}{1}%
\addtolength{\Dtocindent}{\Dtocsectnumwidth}%
\addtolength{\Dtocsectnumwidth}{\Dtocadditionalsectnumwidth}%
#1%
\addtolength{\Dtocsectnumwidth}{-\Dtocadditionalsectnumwidth}%
\addtolength{\Dtocindent}{-\Dtocsectnumwidth}%
\addtocounter{Dtoclevel}{-1}%
}
% For \Dpixelunit, the length value is pre-multiplied with 0.75, so by
% specifying "pt" we get the same notion of "pixel" as graphicx.
\providecommand{\Dpixelunit}{pt}
% Normally lengths are relative to the current linewidth.
\providecommand{\Drelativeunit}{\linewidth}
%\RequirePackage{fixmath}
%\RequirePackage{amsmath}
\DSfontencoding
\DSlanguage
\DSlinks
\DSsymbols
\DSlate
\makeatother
|