summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ltxdockit/btxdockit.sty
blob: 53305c0099c61940aaa74fad48e8773ee9e597e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
% $Id: btxdockit.sty,v 1.1 2008/10/12 19:50:56 lehman stable $
%
% Copyright (c) 2008 Philipp Lehman.
%
% Permission is granted to copy, distribute and/or modify this
% software under the terms of the LaTeX Project Public License
% (LPPL), version 1.3.
%
% The LPPL maintenance status of this software is
% 'author-maintained'.
%
% This software is provided 'as is', without warranty of any kind,
% either expressed or implied, including, but not limited to, the
% implied warranties of merchantability and fitness for a
% particular purpose.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{btxdockit}[2008/10/12 v1.1 bibtex documentation kit]
\RequirePackage{etoolbox}
\RequirePackage{ltxdockit}

% environments

\newenvironment*{fieldlist}
  {\ltd@pdfinit
   \list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{\marglistsep}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}%
   \def\fielditem##1##2{%
     \item[##1]%
     \ltd@pdfbookmark{##1}{##1}%
     field (##2)\par\nobreak
     \vspace{\itemsep}}%
   \def\listitem##1##2{%
     \item[##1]%
     \ltd@pdfbookmark{##1}{##1}%
     list (##2)\par\nobreak
     \vspace{\itemsep}}}
  {\endlist
   \ltd@pdfrestore}

\newenvironment*{typelist}
  {\ltd@pdfinit
   \list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{\marglistsep}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}%
   \def\typeitem##1{%
     \item[{##1}]%
     \ltd@pdfbookmark{##1}{##1}}%
   \def\reqitem{%
     \par\begingroup\itemsep0.5\itemsep\item
     Required fields: \btd@fieldloop}
   \def\optitem{%
     \par\begingroup\itemsep0.5\itemsep\item
     Optional fields: \btd@fieldloop}}
  {\endlist
   \ltd@pdfrestore}

\def\btd@fieldloop#1{%
  \interlinepenalty\@M\raggedright
  \def\@tempa{\def\@tempa{, }}
  \def\do##1{\@tempa\bibfield{##1}}%
  \docsvlist{#1}%
  \par\endgroup}

% verbatim

\lstdefinestyle{bibtex}{%
  moredelim=[is][\spotcolor]{<<}{>>}}

% markup

\newrobustcmd*{\bibfield}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\bibtype}[1]{\mbox{\verbatimfont @#1}}

\ifpdf
  \pdfstringdefDisableCommands{%
    \def\bibfield#1{'#1'}%
    \def\bibtype#1{@#1}}
\fi

\endinput