summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ltxdockit/btxdockit.sty
blob: fe50f1c48f2f139779078e397228dbfb77756f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
% $Id: btxdockit.sty,v 1.2a 2010/02/12 20:20:16 lehman stable $
%
% Copyright (c) 2008-2010 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.

\def\ltd@rcsid$#1: #2 #3 #4 #5${#4 v#3}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{btxdockit}
[\ltd@rcsid $Id: btxdockit.sty,v 1.2a 2010/02/12 20:20:16 lehman stable $
 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